Skip to content

Commit a5685d6

Browse files
author
Alexander (Sasha) Nosov
committed
Fixed current tenant
1 parent 587071e commit a5685d6

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
"TenantID","SubID","ResourceName","ResourceType","Status","OriginalLicenseType","ResourceGroup","Location"
2+
"72f988bf-86f1-41af-91ab-2d7cd011db47","fa58cf66-caaf-4ba9-875d-f310d3694845","SQL2012EEArc","WindowsAgent.SqlServer","Connected","Paid","ajayj","westus2"

samples/manage/azure-arc-enabled-sql-server/modify-license-type/modify-arc-sql-license-type.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ if($null -ne $ExclusionTags){
140140
}
141141

142142
if (-not $TenantId) {
143-
$TenantId = $context.Tenant.Id
143+
$TenantId = (Get-AzContext).Tenant.Id
144144
Write-Output "No TenantId provided. Using current context TenantId: $TenantId"
145145
} else {
146146
Write-Output "Using provided TenantId: $TenantId"
@@ -177,9 +177,10 @@ $modifiedResources = @()
177177
if ($SubId -like "*.csv") {
178178
$subscriptions = Import-Csv $SubId
179179
}elseif($SubId -ne "") {
180-
$subscriptions = Get-AzSubscription -SubscriptionId $SubId
180+
$subscriptions = Get-AzSubscription -SubscriptionId $SubId | Sort-Object TenantId
181+
181182
}else {
182-
$subscriptions = Get-AzSubscription | Where-Object { $_.TenantId -eq $tenantId }
183+
$subscriptions = Get-AzSubscription | Where-Object { $_.TenantId -eq $tenantId }
183184
}
184185

185186
# Handle MachineName input (single or CSV)

0 commit comments

Comments
 (0)