Skip to content

Commit fe3ff58

Browse files
committed
Add a ps command for expired shir search
1 parent e19a5b5 commit fe3ff58

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

articles/data-factory/self-hosted-integration-runtime-auto-update.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,45 @@ If you have multiple nodes, and for some reasons that some of them aren't auto-u
4848
## Self-hosted Integration Runtime Expire Notification
4949
If you want to manually control which version of self-hosted integration runtime, you can disable the setting of auto-update and install it manually. Each version of self-hosted integration runtime expires in one year. The expiring message is shown in ADF portal and self-hosted integration runtime client **90 days** before expiration.
5050

51+
When you receive the expire notification, you can use below PowerShell command to find all expired and expiring self-hosted integration runtime in your environment. Then you can upgrade them accordingly.
52+
53+
```powershell
54+
$upperVersion = "<expiring version>" # the format is [major].[minor]. For example: 5.25
55+
$subscription = "<subscription id>"
56+
57+
az login
58+
az account set --subscription "$subscription"
59+
60+
$factories = az datafactory list | ConvertFrom-Json
61+
62+
$results = @();
63+
for ($i = 0; $i -lt $factories.Count; $i++) {
64+
$factory = $factories[$i]
65+
Write-Progress -Activity "Checking data factory '$($factory.name)'" -PercentComplete $($i * 100.0 / $factories.Count)
66+
$shirs = az datafactory integration-runtime list --factory-name $factory.name --resource-group $factory.resourceGroup | ConvertFrom-Json | Where-Object {$_.properties.type -eq "SelfHosted"}
67+
for ($j = 0; $j -lt $shirs.Count; $j++) {
68+
$shir = $shirs[$j]
69+
Write-Progress -Activity "Checking data factory '$($factory.name)', checking integration runtime '$($shir.name)'" -PercentComplete $($i * 100.0 / $factories.Count + (100.0 * $j / ($factories.Count * $shirs.Count)))
70+
$status = az datafactory integration-runtime get-status --factory-name $factory.name --resource-group $factory.resourceGroup --integration-runtime-name $shir.name | ConvertFrom-Json
71+
$shirVersion = $status.properties.version
72+
$result = @{
73+
subscription = $subscription
74+
resourceGroup = $factory.resourceGroup
75+
factory = $factory.name
76+
integrationRuntime = $shir.name
77+
integrationRuntimeVersion = $shirVersion
78+
expiring_or_expired = (-not [string]::IsNullOrWhiteSpace($shirVersion) -and ((([Version]$shirVersion) -lt ([Version]"$($upperVersion).0.0")) -or $shirVersion.StartsWith("$($upperVersion).")))
79+
}
80+
$result | Format-Table -AutoSize
81+
$results += [PSCustomObject]$result
82+
}
83+
}
84+
85+
Write-Host "Expiring or expired Self-Hosted Integration Runtime includes: "
86+
$results | Where-Object {$_.expiring_or_expired -eq $true} | Select-Object -Property subscription,resourceGroup,factory,integrationRuntime,integrationRuntimeVersion | Format-Table -AutoSize
87+
```
88+
89+
5190
## Related content
5291

5392
- Review [integration runtime concepts in Azure Data Factory](./concepts-integration-runtime.md).

0 commit comments

Comments
 (0)