mirror of
https://github.com/Microsoft/sql-server-samples.git
synced 2025-12-08 14:58:54 +00:00
creating a hashtable for the settings to fix the az extension configuration for licensetype, no longer piping the ext object but using the Setting parameter
This commit is contained in:
+7
-3
@@ -432,8 +432,12 @@ foreach ($sub in $subscriptions) {
|
||||
|
||||
if (-not $ReportOnly) {
|
||||
If ($WriteSettings) {
|
||||
try {
|
||||
$ext | Set-AzConnectedMachineExtension -Name $setID.Name -ResourceGroupName $setID.ResourceGroup -MachineName $setID.MachineName -NoWait -ErrorAction SilentlyContinue | Out-Null
|
||||
try {
|
||||
$settings = @{}
|
||||
foreach ($h in $ext.Setting.Keys) {
|
||||
$settings[$h]=$($ext.Setting[$h])
|
||||
}
|
||||
Set-AzConnectedMachineExtension -Name $setID.Name -ResourceGroupName $setID.ResourceGroup -MachineName $setID.MachineName -Setting $settings -NoWait -ErrorAction SilentlyContinue | Out-Null
|
||||
Write-Output "Updated -- Resource group: [$($setID.ResourceGroup)], Connected machine: [$($setID.MachineName)]"
|
||||
} catch {
|
||||
write-Output "The request to modify the extension object failed with the following error:"
|
||||
@@ -464,4 +468,4 @@ $scriptEndTime = Get-Date
|
||||
$executionDuration = $scriptEndTime - $scriptStartTime
|
||||
Write-Output "Script execution ended at: $($scriptEndTime.ToString('yyyy-MM-dd HH:mm:ss'))"
|
||||
Write-Output "Total execution time: $($executionDuration.ToString('hh\:mm\:ss'))"
|
||||
Stop-Transcript
|
||||
Stop-Transcript
|
||||
|
||||
Reference in New Issue
Block a user