File tree Expand file tree Collapse file tree 3 files changed +9
-7
lines changed
samples/manage/azure-arc-enabled-sql-server
uninstall-azure-extension-for-sql-server Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,7 @@ Update-AzConfig -DisplayBreakingChangeWarning $false
108
108
109
109
# Load required modules
110
110
$requiredModules = @ (
111
+ " AzureAD" ,
111
112
" Az.Accounts" ,
112
113
" Az.ConnectedMachine" ,
113
114
" Az.ResourceGraph"
Original file line number Diff line number Diff line change @@ -84,10 +84,10 @@ This option is recommended because Cloud shell has the Azure PowerShell modules
84
84
curl https://raw.githubusercontent.com/microsoft/sql-server-samples/master/samples/manage/azure-arc-enabled-sql-server/uninstall-azure-extension-for-sql-server/uninstall-azure-extension-for-sql-server.ps1 -o uninstall-azure-extension-for-sql-server.ps1
85
85
```
86
86
87
- 1. Run the script.
87
+ 1. Run the script using the desired scope. For example:
88
88
89
89
```console
90
- .\uninstall-azure-extension-for-sql-server.ps1 -SubId ALL
90
+ .\uninstall-azure-extension-for-sql-server.ps1 -SubId <sub_id>
91
91
```
92
92
93
93
> [! NOTE]
@@ -124,8 +124,8 @@ Use the following steps to run the script in a PowerShell session on your PC.
124
124
Connect-AzAccount -TenantID (Get-AzureADTenantDetail).ObjectId
125
125
```
126
126
127
- 1. Run the script using the desired scope.
127
+ 1. Run the script using the desired scope. For example:
128
128
129
129
```console
130
- .\uninstall-azure-extension-for-sql-server.ps1 -All $True
130
+ .\uninstall-azure-extension-for-sql-server.ps1 -SubId <sub_id> -ResourceGroup <resource_group>
131
131
```
Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ foreach ($sub in $subscriptions){
88
88
try {
89
89
Set-AzContext - SubscriptionId $sub.Id
90
90
}catch {
91
- write-host " [Environment]::NewLine + Invalid subscription: $ ( $sub.Id ) "
91
+ write-host ( [Environment ]::NewLine + " Invalid subscription: $ ( $sub.Id ) " )
92
92
{continue }
93
93
}
94
94
@@ -142,8 +142,9 @@ foreach ($sub in $subscriptions){
142
142
$resources = Search-AzGraph - Query " $ ( $query2 ) "
143
143
144
144
foreach ($r in $resources ) {
145
-
146
- Remove-AzResource - ResourceId $r.resourceId - Force | Out-Null
145
+
146
+ $job = Remove-AzResource - ResourceId $r.resourceId - Force - AsJob | Out-Null
147
+ write-host ([Environment ]::NewLine + " Removing resource: $ ( $r.resourceId ) " )
147
148
148
149
}
149
150
You can’t perform that action at this time.
0 commit comments