mirror of
https://github.com/Microsoft/sql-server-samples.git
synced 2025-12-08 14:58:54 +00:00
removed microsoft.graph
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","PAYG","ajayj","westus2"
|
||||||
|
+4
-18
@@ -39,7 +39,7 @@
|
|||||||
Optional. If specified, excludes the resources that have this tag assigned.
|
Optional. If specified, excludes the resources that have this tag assigned.
|
||||||
|
|
||||||
.PARAMETER TenantId
|
.PARAMETER TenantId
|
||||||
Optional. If specified, this tenant id to log in both PowerShell and CLI. Otherwise, the current login context is used.
|
Required. If specified, this tenant id to log in both PowerShell and CLI. Otherwise, the current login context is used.
|
||||||
|
|
||||||
.PARAMETER ReportOnly
|
.PARAMETER ReportOnly
|
||||||
Optional. If true, generates a csv file with the list of resources that are to be modified, but doesn't make the actual change.
|
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 (
|
|||||||
[Parameter (Mandatory= $false)]
|
[Parameter (Mandatory= $false)]
|
||||||
[object] $ExclusionTags,
|
[object] $ExclusionTags,
|
||||||
|
|
||||||
[Parameter (Mandatory= $false)]
|
[Parameter (Mandatory= $true)]
|
||||||
[string] $TenantId,
|
[string] $TenantId,
|
||||||
|
|
||||||
[Parameter (Mandatory= $false)]
|
[Parameter (Mandatory= $false)]
|
||||||
@@ -123,6 +123,7 @@ function Connect-Azure {
|
|||||||
}
|
}
|
||||||
Write-Output "Connected to Azure PowerShell as: $($ctx.Account)"
|
Write-Output "Connected to Azure PowerShell as: $($ctx.Account)"
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -152,21 +153,7 @@ if ($UseManagedIdentity) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Ensure the required modules are imported
|
# Ensure the required modules are imported
|
||||||
try{
|
|
||||||
# Check if Microsoft.Graph module is installed
|
|
||||||
if (-not (Get-Module -ListAvailable -Name Microsoft.Graph)) {
|
|
||||||
Write-Host "Microsoft.Graph module not found. Installing..."
|
|
||||||
Install-Module -Name Microsoft.Graph -Scope CurrentUser -Force
|
|
||||||
}else {
|
|
||||||
Write-Host "Microsoft.Graph module is already installed."
|
|
||||||
}
|
|
||||||
|
|
||||||
# Import the module
|
|
||||||
Import-Module Microsoft.Graph
|
|
||||||
}
|
|
||||||
catch{
|
|
||||||
Write-Output "Can't import module Microsoft.Graph"
|
|
||||||
}
|
|
||||||
try{
|
try{
|
||||||
Import-Module Az.Accounts
|
Import-Module Az.Accounts
|
||||||
}catch{
|
}catch{
|
||||||
@@ -190,7 +177,6 @@ $modifiedResources = @()
|
|||||||
if ($SubId -like "*.csv") {
|
if ($SubId -like "*.csv") {
|
||||||
$subscriptions = Import-Csv $SubId
|
$subscriptions = Import-Csv $SubId
|
||||||
}elseif($SubId -ne "") {
|
}elseif($SubId -ne "") {
|
||||||
Write-Output "Passed Subscription $($SubId)"
|
|
||||||
$subscriptions = Get-AzSubscription -SubscriptionId $SubId
|
$subscriptions = Get-AzSubscription -SubscriptionId $SubId
|
||||||
}else {
|
}else {
|
||||||
$subscriptions = Get-AzSubscription | Where-Object { $_.TenantId -eq $tenantId }
|
$subscriptions = Get-AzSubscription | Where-Object { $_.TenantId -eq $tenantId }
|
||||||
@@ -264,7 +250,7 @@ foreach ($sub in $subscriptions) {
|
|||||||
| project machineName, extensionName, resourceGroup, location, subscriptionId, extensionPublisher, extensionType
|
| project machineName, extensionName, resourceGroup, location, subscriptionId, extensionPublisher, extensionType
|
||||||
"
|
"
|
||||||
|
|
||||||
Write-Output $query
|
#Write-Output $query
|
||||||
|
|
||||||
$resources = Search-AzGraph -Query "$($query)"
|
$resources = Search-AzGraph -Query "$($query)"
|
||||||
Write-Output "Found $($resources.Count) resource(s) to update"
|
Write-Output "Found $($resources.Count) resource(s) to update"
|
||||||
|
|||||||
Reference in New Issue
Block a user