Skip to content

Commit 86cf430

Browse files
author
Alexander (Sasha) Nosov
committed
removed microsoft.graph
1 parent 593ba9a commit 86cf430

2 files changed

Lines changed: 6 additions & 18 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","PAYG","ajayj","westus2"

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

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
Optional. If specified, excludes the resources that have this tag assigned.
4040
4141
.PARAMETER TenantId
42-
Optional. If specified, this tenant id to log in both PowerShell and CLI. Otherwise, the current login context is used.
42+
Required. If specified, this tenant id to log in both PowerShell and CLI. Otherwise, the current login context is used.
4343
4444
.PARAMETER ReportOnly
4545
Optional. If true, generates a csv file with the list of resources that are to be modified, but doesn't make the actual change.
@@ -81,7 +81,7 @@ param (
8181
[Parameter (Mandatory= $false)]
8282
[object] $ExclusionTags,
8383

84-
[Parameter (Mandatory= $false)]
84+
[Parameter (Mandatory= $true)]
8585
[string] $TenantId,
8686

8787
[Parameter (Mandatory= $false)]
@@ -123,6 +123,7 @@ function Connect-Azure {
123123
}
124124
Write-Output "Connected to Azure PowerShell as: $($ctx.Account)"
125125

126+
126127
}
127128

128129

@@ -152,21 +153,7 @@ if ($UseManagedIdentity) {
152153
}
153154

154155
# Ensure the required modules are imported
155-
try{
156-
# Check if Microsoft.Graph module is installed
157-
if (-not (Get-Module -ListAvailable -Name Microsoft.Graph)) {
158-
Write-Host "Microsoft.Graph module not found. Installing..."
159-
Install-Module -Name Microsoft.Graph -Scope CurrentUser -Force
160-
}else {
161-
Write-Host "Microsoft.Graph module is already installed."
162-
}
163156

164-
# Import the module
165-
Import-Module Microsoft.Graph
166-
}
167-
catch{
168-
Write-Output "Can't import module Microsoft.Graph"
169-
}
170157
try{
171158
Import-Module Az.Accounts
172159
}catch{
@@ -190,7 +177,6 @@ $modifiedResources = @()
190177
if ($SubId -like "*.csv") {
191178
$subscriptions = Import-Csv $SubId
192179
}elseif($SubId -ne "") {
193-
Write-Output "Passed Subscription $($SubId)"
194180
$subscriptions = Get-AzSubscription -SubscriptionId $SubId
195181
}else {
196182
$subscriptions = Get-AzSubscription | Where-Object { $_.TenantId -eq $tenantId }
@@ -264,7 +250,7 @@ foreach ($sub in $subscriptions) {
264250
| project machineName, extensionName, resourceGroup, location, subscriptionId, extensionPublisher, extensionType
265251
"
266252

267-
Write-Output $query
253+
#Write-Output $query
268254

269255
$resources = Search-AzGraph -Query "$($query)"
270256
Write-Output "Found $($resources.Count) resource(s) to update"

0 commit comments

Comments
 (0)