mirror of
https://github.com/Microsoft/sql-server-samples.git
synced 2025-12-08 14:58:54 +00:00
Fixed current tenant
This commit is contained in:
+2
@@ -0,0 +1,2 @@
|
||||
"TenantID","SubID","ResourceName","ResourceType","Status","OriginalLicenseType","ResourceGroup","Location"
|
||||
"72f988bf-86f1-41af-91ab-2d7cd011db47","fa58cf66-caaf-4ba9-875d-f310d3694845","SQL2012EEArc","WindowsAgent.SqlServer","Connected","Paid","ajayj","westus2"
|
||||
|
+4
-3
@@ -140,7 +140,7 @@ if($null -ne $ExclusionTags){
|
||||
}
|
||||
|
||||
if (-not $TenantId) {
|
||||
$TenantId = $context.Tenant.Id
|
||||
$TenantId = (Get-AzContext).Tenant.Id
|
||||
Write-Output "No TenantId provided. Using current context TenantId: $TenantId"
|
||||
} else {
|
||||
Write-Output "Using provided TenantId: $TenantId"
|
||||
@@ -177,9 +177,10 @@ $modifiedResources = @()
|
||||
if ($SubId -like "*.csv") {
|
||||
$subscriptions = Import-Csv $SubId
|
||||
}elseif($SubId -ne "") {
|
||||
$subscriptions = Get-AzSubscription -SubscriptionId $SubId
|
||||
$subscriptions = Get-AzSubscription -SubscriptionId $SubId | Sort-Object TenantId
|
||||
|
||||
}else {
|
||||
$subscriptions = Get-AzSubscription | Where-Object { $_.TenantId -eq $tenantId }
|
||||
$subscriptions = Get-AzSubscription | Where-Object { $_.TenantId -eq $tenantId }
|
||||
}
|
||||
|
||||
# Handle MachineName input (single or CSV)
|
||||
|
||||
Reference in New Issue
Block a user