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