From 932ad04c05de92d5ac7a7753ff9a2e37e70bad74 Mon Sep 17 00:00:00 2001 From: Hyonho Lee Date: Tue, 17 Mar 2020 10:57:18 -0700 Subject: [PATCH 1/2] Update New-AzVmss for AutomaticRepairsPolicy issue. --- .../ScenarioTests/VirtualMachineScaleSetProfileTests.ps1 | 9 ++++++++- src/Compute/Compute/ChangeLog.md | 1 + .../Config/NewAzureRmVmssConfigCommand.cs | 9 ++++++--- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/Compute/Compute.Test/ScenarioTests/VirtualMachineScaleSetProfileTests.ps1 b/src/Compute/Compute.Test/ScenarioTests/VirtualMachineScaleSetProfileTests.ps1 index e87d85a4d2bd..773c1679588a 100644 --- a/src/Compute/Compute.Test/ScenarioTests/VirtualMachineScaleSetProfileTests.ps1 +++ b/src/Compute/Compute.Test/ScenarioTests/VirtualMachineScaleSetProfileTests.ps1 @@ -128,6 +128,9 @@ function Test-VirtualMachineScaleSetProfile # AdditionalCapabilities Assert-Null $vmss.VirtualMachineProfile.AdditionalCapabilities; + # AutomaticRepairsPolicy + Assert-Null $vmss.AutomaticRepairsPolicy; + $extname2 = 'catextension'; $publisher2 = 'Microsoft.AzureCAT.AzureEnhancedMonitoring'; $exttype2 = 'AzureCATExtensionHandler'; @@ -150,12 +153,16 @@ function Test-VirtualMachineScaleSetProfile Assert-AreEqual $extname $vmss2.VirtualMachineProfile.ExtensionProfile.Extensions[1].ProvisionAfterExtensions[0]; $vmss3 = New-AzVmssConfig -Location $loc -SkuCapacity 2 -SkuName 'Standard_A0' -UpgradePolicyMode 'Automatic' -DisableAutoRollback $true -EnableUltraSSD ` - -TerminateScheduledEvents -TerminateScheduledEventNotBeforeTimeoutInMinutes 15; + -TerminateScheduledEvents -TerminateScheduledEventNotBeforeTimeoutInMinutes 15 ` + -EnableAutomaticRepair; Assert-True { $vmss3.UpgradePolicy.AutomaticOSUpgradePolicy.DisableAutomaticRollback }; Assert-True { $vmss3.AdditionalCapabilities.UltraSSDEnabled }; Assert-True { $vmss3.VirtualMachineProfile.ScheduledEventsProfile.TerminateNotificationProfile.Enable }; Assert-AreEqual "PT15M" $vmss3.VirtualMachineProfile.ScheduledEventsProfile.TerminateNotificationProfile.NotBeforeTimeout; + # AutomaticRepairsPolicy + Assert-True { $vmss3.AutomaticRepairsPolicy.Enabled }; + $ppgid = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/proximityPlacementGroups/ppgname" $vmss4 = New-AzVmssConfig -Location $loc -SkuCapacity $skuCapacity -SkuName $skuName -UpgradePolicyMode $upgradePolicy -ProximityPlacementGroupId $ppgid; Assert-Null $vmss4.Identity; diff --git a/src/Compute/Compute/ChangeLog.md b/src/Compute/Compute/ChangeLog.md index e73bac41adad..24e52604e17d 100644 --- a/src/Compute/Compute/ChangeLog.md +++ b/src/Compute/Compute/ChangeLog.md @@ -21,6 +21,7 @@ ## Upcoming Release * Fix errors in examples of help document * Show the exact string value for VM PowerState in the table format. +* New-AzVmssConfig does not create AutomaticRepairs property when it is disabled. ## Version 3.5.0 * Allowed empty value for ProximityPlacementGroupId during update diff --git a/src/Compute/Compute/Generated/VirtualMachineScaleSet/Config/NewAzureRmVmssConfigCommand.cs b/src/Compute/Compute/Generated/VirtualMachineScaleSet/Config/NewAzureRmVmssConfigCommand.cs index 8a3bfa582a54..d0578c63b6de 100644 --- a/src/Compute/Compute/Generated/VirtualMachineScaleSet/Config/NewAzureRmVmssConfigCommand.cs +++ b/src/Compute/Compute/Generated/VirtualMachineScaleSet/Config/NewAzureRmVmssConfigCommand.cs @@ -376,11 +376,14 @@ private void Run() } vUpgradePolicy.AutomaticOSUpgradePolicy.EnableAutomaticOSUpgrade = this.AutoOSUpgrade.IsPresent; - if (vAutomaticRepairsPolicy == null) + if (this.EnableAutomaticRepair.IsPresent) { - vAutomaticRepairsPolicy = new PSAutomaticRepairsPolicy(); + if (vAutomaticRepairsPolicy == null) + { + vAutomaticRepairsPolicy = new PSAutomaticRepairsPolicy(); + } + vAutomaticRepairsPolicy.Enabled = this.EnableAutomaticRepair.IsPresent; } - vAutomaticRepairsPolicy.Enabled = this.EnableAutomaticRepair.IsPresent; if (this.IsParameterBound(c => c.AutomaticRepairGracePeriod)) { From f294c8684a29f1a2fee704358b86eb4bd4b8a376 Mon Sep 17 00:00:00 2001 From: Hyonho Lee Date: Tue, 17 Mar 2020 10:57:51 -0700 Subject: [PATCH 2/2] Update Compute SDK version to 33.0.0 --- src/Compute/Compute.Test/Compute.Test.csproj | 2 +- src/Compute/Compute/Compute.csproj | 2 +- src/Network/Network.Test/Network.Test.csproj | 2 +- .../RecoveryServices.Backup.Test.csproj | 2 +- .../RecoveryServices.SiteRecovery.Test.csproj | 2 +- .../SqlVirtualMachine.Test/SqlVirtualMachine.Test.csproj | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Compute/Compute.Test/Compute.Test.csproj b/src/Compute/Compute.Test/Compute.Test.csproj index bb766d75378a..b9c680a91343 100644 --- a/src/Compute/Compute.Test/Compute.Test.csproj +++ b/src/Compute/Compute.Test/Compute.Test.csproj @@ -12,7 +12,7 @@ - + diff --git a/src/Compute/Compute/Compute.csproj b/src/Compute/Compute/Compute.csproj index 67e479e8cf3c..ba1c4da141bc 100644 --- a/src/Compute/Compute/Compute.csproj +++ b/src/Compute/Compute/Compute.csproj @@ -13,7 +13,7 @@ - + diff --git a/src/Network/Network.Test/Network.Test.csproj b/src/Network/Network.Test/Network.Test.csproj index 9ab94f9c4382..6c189f9cfdb1 100644 --- a/src/Network/Network.Test/Network.Test.csproj +++ b/src/Network/Network.Test/Network.Test.csproj @@ -16,7 +16,7 @@ - + diff --git a/src/RecoveryServices/RecoveryServices.Backup.Test/RecoveryServices.Backup.Test.csproj b/src/RecoveryServices/RecoveryServices.Backup.Test/RecoveryServices.Backup.Test.csproj index ef87b52925a6..6f251088aafd 100644 --- a/src/RecoveryServices/RecoveryServices.Backup.Test/RecoveryServices.Backup.Test.csproj +++ b/src/RecoveryServices/RecoveryServices.Backup.Test/RecoveryServices.Backup.Test.csproj @@ -11,7 +11,7 @@ - + diff --git a/src/RecoveryServices/RecoveryServices.SiteRecovery.Test/RecoveryServices.SiteRecovery.Test.csproj b/src/RecoveryServices/RecoveryServices.SiteRecovery.Test/RecoveryServices.SiteRecovery.Test.csproj index ca9777e8ee81..4aef173fe44c 100644 --- a/src/RecoveryServices/RecoveryServices.SiteRecovery.Test/RecoveryServices.SiteRecovery.Test.csproj +++ b/src/RecoveryServices/RecoveryServices.SiteRecovery.Test/RecoveryServices.SiteRecovery.Test.csproj @@ -11,7 +11,7 @@ - + diff --git a/src/SqlVirtualMachine/SqlVirtualMachine.Test/SqlVirtualMachine.Test.csproj b/src/SqlVirtualMachine/SqlVirtualMachine.Test/SqlVirtualMachine.Test.csproj index e44bb74737ae..abfa519bec26 100644 --- a/src/SqlVirtualMachine/SqlVirtualMachine.Test/SqlVirtualMachine.Test.csproj +++ b/src/SqlVirtualMachine/SqlVirtualMachine.Test/SqlVirtualMachine.Test.csproj @@ -15,7 +15,7 @@ - +