Removed DR from filter for MI

This commit is contained in:
Alexander (Sasha) Nosov
2025-10-13 20:13:39 -07:00
parent e0577ae597
commit 57e5b0afb4
2 changed files with 10 additions and 3 deletions
@@ -0,0 +1,7 @@
"TenantID","SubID","ResourceName","ResourceType","Status","OriginalLicenseType","ResourceGroup","Location"
"72f988bf-86f1-41af-91ab-2d7cd011db47","fa58cf66-caaf-4ba9-875d-f310d3694845","SQL2012EEArc","Microsoft.SqlVirtualMachine/sqlVirtualMachines","VM running","AHUB","ajayj","westus2"
"72f988bf-86f1-41af-91ab-2d7cd011db47","fa58cf66-caaf-4ba9-875d-f310d3694845","SQL2022EE","Microsoft.SqlVirtualMachine/sqlVirtualMachines","VM running","AHUB","ajayj","westus2"
"72f988bf-86f1-41af-91ab-2d7cd011db47","fa58cf66-caaf-4ba9-875d-f310d3694845","sql2022rtm","Microsoft.SqlVirtualMachine/sqlVirtualMachines","VM running","AHUB","ajayj","westus2"
"72f988bf-86f1-41af-91ab-2d7cd011db47","fa58cf66-caaf-4ba9-875d-f310d3694845","sql2025devstd","Microsoft.SqlVirtualMachine/sqlVirtualMachines","VM running","AHUB","ajayj","westus2"
"72f988bf-86f1-41af-91ab-2d7cd011db47","fa58cf66-caaf-4ba9-875d-f310d3694845","ajayjsqlmi","Microsoft.Sql/managedInstances","Ready","BasePrice","ajayj","westus2"
"72f988bf-86f1-41af-91ab-2d7cd011db47","fa58cf66-caaf-4ba9-875d-f310d3694845","AdventureworksLT","Microsoft.Sql/servers/databases","Online","BasePrice","ajayj","westus2"
1 TenantID SubID ResourceName ResourceType Status OriginalLicenseType ResourceGroup Location
2 72f988bf-86f1-41af-91ab-2d7cd011db47 fa58cf66-caaf-4ba9-875d-f310d3694845 SQL2012EEArc Microsoft.SqlVirtualMachine/sqlVirtualMachines VM running AHUB ajayj westus2
3 72f988bf-86f1-41af-91ab-2d7cd011db47 fa58cf66-caaf-4ba9-875d-f310d3694845 SQL2022EE Microsoft.SqlVirtualMachine/sqlVirtualMachines VM running AHUB ajayj westus2
4 72f988bf-86f1-41af-91ab-2d7cd011db47 fa58cf66-caaf-4ba9-875d-f310d3694845 sql2022rtm Microsoft.SqlVirtualMachine/sqlVirtualMachines VM running AHUB ajayj westus2
5 72f988bf-86f1-41af-91ab-2d7cd011db47 fa58cf66-caaf-4ba9-875d-f310d3694845 sql2025devstd Microsoft.SqlVirtualMachine/sqlVirtualMachines VM running AHUB ajayj westus2
6 72f988bf-86f1-41af-91ab-2d7cd011db47 fa58cf66-caaf-4ba9-875d-f310d3694845 ajayjsqlmi Microsoft.Sql/managedInstances Ready BasePrice ajayj westus2
7 72f988bf-86f1-41af-91ab-2d7cd011db47 fa58cf66-caaf-4ba9-875d-f310d3694845 AdventureworksLT Microsoft.Sql/servers/databases Online BasePrice ajayj westus2
@@ -335,13 +335,13 @@ foreach ($sub in $subscriptions) {
Write-Error "An error occurred while updating SQL VMs: $_"
}
# --- Section: Update SQL Managed Instances (Stopped then Ready) "hybridSecondaryUsage": "Passive"---
# --- Section: Update SQL Managed Instances (Stopped then Ready) "
$sqlMIsToUpdate = [System.Collections.ArrayList]::new()
try {
# Build Managed Instance query
$miRunningQuery = "[?licenseType!='${LicenseType}' && licenseType!='DR' && hybridSecondaryUsage!='Passive' && state=='Ready'"
$miRunningQuery = "[?licenseType!='${LicenseType}' && state=='Ready'"
# Add resource group filter if specified
if ($rgFilter) {
@@ -621,7 +621,7 @@ foreach ($sub in $subscriptions) {
Write-Output "Searching for SQL Instance Pools that require a license update..."
# Build instance pool query (skip the passive replicas)
$instancePoolsQuery = "[?licenseType!='${LicenseType}' && licenseType!='DR' && hybridSecondaryUsage!='Passive' && state=='Ready'"
$instancePoolsQuery = "[?licenseType!='${LicenseType}' && state=='Ready'"
# Add resource group filter if specified
if ($rgFilter) {