From ff1bc90d023f77e559ec16ea9f0b34118212de40 Mon Sep 17 00:00:00 2001 From: Ojo Okoka Date: Tue, 21 Oct 2025 13:09:42 -0400 Subject: [PATCH] Added -EnableAutomaticUpgrade + -TreatFailureAsDeploymentFailure to New Az-VmGalleryApp + New Az-VmssGalleryApp and updated Changelog/Help Docs --- src/Compute/Compute/ChangeLog.md | 1 + .../NewAzureVmGalleryApplicationCommand.cs | 20 ++++++++++++ .../NewAzureVmssGalleryApplicationCommand.cs | 22 +++++++++++++ .../help/New-AzVmGalleryApplication.md | 32 +++++++++++++++++++ .../help/New-AzVmssGalleryApplication.md | 32 +++++++++++++++++++ 5 files changed, 107 insertions(+) diff --git a/src/Compute/Compute/ChangeLog.md b/src/Compute/Compute/ChangeLog.md index 10a47ff76288..768b9fda0c1e 100644 --- a/src/Compute/Compute/ChangeLog.md +++ b/src/Compute/Compute/ChangeLog.md @@ -20,6 +20,7 @@ --> ## Upcoming Release +* Added `-EnableAutomaticUpgrade` and `-TreatFailureAsDeploymentFailure` parameters (Bool) to `New-AzVmGalleryApplication` and `New-AzVmssGalleryApplication` cmdlets. * Added `-Redeploy` switch parameter for `Update-AzHost` cmdlet to enable dedicated host redeployment. * ComputeRP related cmdlets will now use 2025-04-01 version of the ComputeRP API. * Added `-AddProxyAgentExtension` parameter (Switch) to `New-AzVmss` and `New-AzVM` diff --git a/src/Compute/Compute/Generated/Gallery/NewAzureVmGalleryApplicationCommand.cs b/src/Compute/Compute/Generated/Gallery/NewAzureVmGalleryApplicationCommand.cs index 8757425e9115..9ff18b4c41e3 100644 --- a/src/Compute/Compute/Generated/Gallery/NewAzureVmGalleryApplicationCommand.cs +++ b/src/Compute/Compute/Generated/Gallery/NewAzureVmGalleryApplicationCommand.cs @@ -38,6 +38,18 @@ public class NewAzureVmGalleryApplicationCommand : Microsoft.Azure.Commands.Reso [ValidateNotNullOrEmpty] public string ConfigReferenceId { get; set; } + [Parameter( + Mandatory = false, + HelpMessage = "If set to true, when a new Gallery Application version is available in PIR/SIG it will be automatically updated for the VM.")] + [ValidateNotNullOrEmpty] + public bool? EnableAutomaticUpgrade { get; set; } + + [Parameter( + Mandatory = false, + HelpMessage = "If set to true, any failure for any operation in the VmApplication will fail the deployment.")] + [ValidateNotNullOrEmpty] + public bool? TreatFailureAsDeploymentFailure { get; set; } + public override void ExecuteCmdlet() { @@ -47,6 +59,14 @@ public override void ExecuteCmdlet() { vmGal.ConfigurationReference = this.ConfigReferenceId; } + if (this.IsParameterBound(c => c.EnableAutomaticUpgrade)) + { + vmGal.EnableAutomaticUpgrade = this.EnableAutomaticUpgrade; + } + if (this.IsParameterBound(c => c.TreatFailureAsDeploymentFailure)) + { + vmGal.TreatFailureAsDeploymentFailure = this.TreatFailureAsDeploymentFailure; + } WriteObject(vmGal); } diff --git a/src/Compute/Compute/Generated/Gallery/NewAzureVmssGalleryApplicationCommand.cs b/src/Compute/Compute/Generated/Gallery/NewAzureVmssGalleryApplicationCommand.cs index 5fc788b4805b..95e9210d8a67 100644 --- a/src/Compute/Compute/Generated/Gallery/NewAzureVmssGalleryApplicationCommand.cs +++ b/src/Compute/Compute/Generated/Gallery/NewAzureVmssGalleryApplicationCommand.cs @@ -37,6 +37,18 @@ public class NewAzureVmssGalleryApplicationCommand : Microsoft.Azure.Commands.Re [ValidateNotNullOrEmpty] public string ConfigReferenceId { get; set; } + [Parameter( + Mandatory = false, + HelpMessage = "If set to true, when a new Gallery Application version is available in PIR/SIG it will be automatically updated for the VM.")] + [ValidateNotNullOrEmpty] + public bool? EnableAutomaticUpgrade { get; set; } + + [Parameter( + Mandatory = false, + HelpMessage = "If set to true, any failure for any operation in the VmApplication will fail the deployment.")] + [ValidateNotNullOrEmpty] + public bool? TreatFailureAsDeploymentFailure { get; set; } + public override void ExecuteCmdlet() { @@ -47,6 +59,16 @@ public override void ExecuteCmdlet() vmGal.ConfigurationReference = this.ConfigReferenceId; } + if (this.IsParameterBound(c => c.EnableAutomaticUpgrade)) + { + vmGal.EnableAutomaticUpgrade = this.EnableAutomaticUpgrade; + } + + if (this.IsParameterBound(c => c.TreatFailureAsDeploymentFailure)) + { + vmGal.TreatFailureAsDeploymentFailure = this.TreatFailureAsDeploymentFailure; + } + WriteObject(vmGal); } } diff --git a/src/Compute/Compute/help/New-AzVmGalleryApplication.md b/src/Compute/Compute/help/New-AzVmGalleryApplication.md index 09b6e08beada..24e64ecfc85c 100644 --- a/src/Compute/Compute/help/New-AzVmGalleryApplication.md +++ b/src/Compute/Compute/help/New-AzVmGalleryApplication.md @@ -14,6 +14,7 @@ Create a local PSVMGalleryApplication object. ``` New-AzVmGalleryApplication -PackageReferenceId [-ConfigReferenceId ] + [-EnableAutomaticUpgrade ] [-TreatFailureAsDeploymentFailure ] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -27,6 +28,7 @@ Creates a local PSVMGalleryApplication object. ```powershell $vm = Get-AzVM -ResourceGroupName $rgName -Name $vmName $vmGal = New-AzVmGalleryApplication -PackageReferenceId $packageRefId -ConfigReferenceId $configRefId +-EnableAutomaticUpgrade $true -TreatFailureAsDeploymentFailure $true Add-AzVmGalleryApplication -VM $vm -GalleryApplication $vmGal -Order 1 ``` @@ -79,6 +81,36 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -EnableAutomaticUpgrade +Specifies whether the underlying VMSS should automatically update when a new version of the Gallery Application becomes available in the Public Image Repository (PIR) or Shared Image Gallery (SIG). + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TreatFailureAsDeploymentFailure +Determines whether a failure encountered during the application process should be treated as a deployment failure. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Confirm Prompts you for confirmation before running the cmdlet. diff --git a/src/Compute/Compute/help/New-AzVmssGalleryApplication.md b/src/Compute/Compute/help/New-AzVmssGalleryApplication.md index cc9476cef8ea..35e81f3dc555 100644 --- a/src/Compute/Compute/help/New-AzVmssGalleryApplication.md +++ b/src/Compute/Compute/help/New-AzVmssGalleryApplication.md @@ -14,6 +14,7 @@ Create a local PSVMGalleryApplication object. ``` New-AzVmssGalleryApplication -PackageReferenceId [-ConfigReferenceId ] + [-EnableAutomaticUpgrade ] [-TreatFailureAsDeploymentFailure ] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -27,6 +28,7 @@ Creates a local PSVMGalleryApplication object. ```powershell $vmss = Get-AzVmss -ResourceGroupName $rgName -Name $vmssName $vmGal = New-AzVmssGalleryApplication -PackageReferenceId $packageRefId -ConfigReferenceId $configRefId +-EnableAutomaticUpgrade $true -TreatFailureAsDeploymentFailure $true Add-AzVmssGalleryApplication -VirtualMachineScaleSetVM $vmss.VirtualMachineProfile -GalleryApplication $vmGal -Order 1 ``` @@ -79,6 +81,36 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -EnableAutomaticUpgrade +Specifies whether the underlying VMSS should automatically update when a new version of the Gallery Application becomes available in the Public Image Repository (PIR) or Shared Image Gallery (SIG). + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TreatFailureAsDeploymentFailure +Determines whether a failure encountered during the application process should be treated as a deployment failure. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Confirm Prompts you for confirmation before running the cmdlet.