diff --git a/src/Compute/Compute.Test/ScenarioTests/VirtualMachineScaleSetTests.ps1 b/src/Compute/Compute.Test/ScenarioTests/VirtualMachineScaleSetTests.ps1 index 8a565c2710c6..d367d26556ab 100644 --- a/src/Compute/Compute.Test/ScenarioTests/VirtualMachineScaleSetTests.ps1 +++ b/src/Compute/Compute.Test/ScenarioTests/VirtualMachineScaleSetTests.ps1 @@ -6143,4 +6143,49 @@ function Test-VirtualMachineScaleSetGalleryApplicationFlags { Clean-ResourceGroup $rgname } +} + +<# +.SYNOPSIS +Test Virtual Machine Scale Set ResiliencyView parameter +#> +function Test-VirtualMachineScaleSetResiliencyView +{ + # Setup + $rgname = Get-ComputeTestResourceName + + try + { + # Common + $loc = Get-ComputeVMLocation; + New-AzResourceGroup -Name $rgname -Location $loc -Force; + + # New VMSS Parameters + $vmssName = 'vmss' + $rgname; + $vmssType = 'Microsoft.Compute/virtualMachineScaleSets'; + + $adminUsername = 'Foo12'; + $adminPassword = Get-PasswordForVM | ConvertTo-SecureString -AsPlainText -Force; + + $vmssConfig = New-AzVmssConfig -Location $loc -SkuCapacity 2 -SkuName 'Standard_DS1_v2' -UpgradePolicyMode 'Manual'; + + $vmss = New-AzVmss -ResourceGroupName $rgname -Name $vmssName -VirtualMachineScaleSet $vmssConfig; + + # Test ResiliencyView parameter + $vmssVMList = Get-AzVmssVM -ResourceGroupName $rgname -VMScaleSetName $vmssName -ResiliencyView; + Assert-NotNull $vmssVMList; + Assert-True { $vmssVMList.Count -ge 1 }; + + # Test ResiliencyView with specific instance + $vmssVM = Get-AzVmssVM -ResourceGroupName $rgname -VMScaleSetName $vmssName -InstanceId $vmssVMList[0].InstanceId -ResiliencyView; + Assert-NotNull $vmssVM; + Assert-NotNull $vmssVM.InstanceId; + # ResilientVMDeletionStatus property should be available when ResiliencyView is requested + # Note: The property may be null if Resilient Delete is not enabled on the VMSS + } + finally + { + # Cleanup + Clean-ResourceGroup $rgname + } } \ No newline at end of file diff --git a/src/Compute/Compute/ChangeLog.md b/src/Compute/Compute/ChangeLog.md index 3b20e3949f01..acf33e82204d 100644 --- a/src/Compute/Compute/ChangeLog.md +++ b/src/Compute/Compute/ChangeLog.md @@ -24,6 +24,9 @@ * Updated Azure.Core from 1.45.0 to 1.47.3 * Added `-EnableAutomaticUpgrade` and `-TreatFailureAsDeploymentFailure` parameters (Bool) to `New-AzVmGalleryApplication` and `New-AzVmssGalleryApplication` cmdlets. * Added `-EnableAutomaticUpgrade` and `-TreatFailureAsDeploymentFailure` parameters (Switch) to `Add-AzVmGalleryApplication` and `Add-AzVmssGalleryApplication` cmdlets. +* Added `-ResiliencyView` parameter to `Get-AzVmssVM` cmdlet + - Retrieves the real-time status of VM (Virtual Machine) delete retries for the Resilient Delete feature + - Includes `ResilientVMDeletionStatus` property indicating whether retries are in progress, failed, or not started ## Version 10.5.0 * Added `-Redeploy` switch parameter for `Update-AzHost` cmdlet to enable dedicated host redeployment. diff --git a/src/Compute/Compute/Generated/Models/PSVirtualMachineScaleSetVM.cs b/src/Compute/Compute/Generated/Models/PSVirtualMachineScaleSetVM.cs index 6f256e6589ea..0667cd51bde0 100644 --- a/src/Compute/Compute/Generated/Models/PSVirtualMachineScaleSetVM.cs +++ b/src/Compute/Compute/Generated/Models/PSVirtualMachineScaleSetVM.cs @@ -46,6 +46,7 @@ public string ResourceGroupName public string VmId { get; set; } public VirtualMachineScaleSetVMInstanceView InstanceView { get; set; } public HardwareProfile HardwareProfile { get; set; } + public string ResilientVMDeletionStatus { get; set; } public StorageProfile StorageProfile { get; set; } public AdditionalCapabilities AdditionalCapabilities { get; set; } public OSProfile OsProfile { get; set; } diff --git a/src/Compute/Compute/Generated/VirtualMachineScaleSetVM/VirtualMachineScaleSetVMGetMethod.cs b/src/Compute/Compute/Generated/VirtualMachineScaleSetVM/VirtualMachineScaleSetVMGetMethod.cs index 91af1289a013..6205afe762bd 100644 --- a/src/Compute/Compute/Generated/VirtualMachineScaleSetVM/VirtualMachineScaleSetVMGetMethod.cs +++ b/src/Compute/Compute/Generated/VirtualMachineScaleSetVM/VirtualMachineScaleSetVMGetMethod.cs @@ -39,6 +39,7 @@ public partial class GetAzureRmVmssVM : ComputeAutomationBaseCmdlet protected const string DefaultParameterSet = "DefaultParameter", FriendMethodParameterSet = "FriendMethod"; private VmssVMInstanceViewTypes UserDataExpand = VmssVMInstanceViewTypes.UserData; + private VmssVMInstanceViewTypes ResiliencyViewExpand = VmssVMInstanceViewTypes.ResiliencyView; public override void ExecuteCmdlet() { @@ -58,6 +59,13 @@ public override void ExecuteCmdlet() ComputeAutomationAutoMapperProfile.Mapper.Map(result, psObject); WriteObject(psObject); } + else if (this.ResiliencyView == true) + { + var result = VirtualMachineScaleSetVMsClient.Get(resourceGroupName, vmScaleSetName, instanceId, ResiliencyViewExpand); + var psObject = new PSVirtualMachineScaleSetVM(); + ComputeAutomationAutoMapperProfile.Mapper.Map(result, psObject); + WriteObject(psObject); + } else if (this.UserData == true) { var result = VirtualMachineScaleSetVMsClient.Get(resourceGroupName, vmScaleSetName, instanceId, UserDataExpand); @@ -173,5 +181,17 @@ public override void ExecuteCmdlet() HelpMessage = "UserData for the Vmss, which will be Base64 encoded. Customer should not pass any secrets in here.", ValueFromPipelineByPropertyName = true)] public SwitchParameter UserData { get; set; } + + [Parameter( + Mandatory = false, + ParameterSetName = DefaultParameterSet, + HelpMessage = "ResiliencyView retrieves the real-time status of VM delete retries for the Resilient Delete feature.", + ValueFromPipelineByPropertyName = true)] + [Parameter( + Mandatory = false, + ParameterSetName = FriendMethodParameterSet, + HelpMessage = "ResiliencyView retrieves the real-time status of VM delete retries for the Resilient Delete feature.", + ValueFromPipelineByPropertyName = true)] + public SwitchParameter ResiliencyView { get; set; } } } diff --git a/src/Compute/Compute/help/Get-AzVmssVM.md b/src/Compute/Compute/help/Get-AzVmssVM.md index ea58620b7c0f..8b2dbfe40d6a 100644 --- a/src/Compute/Compute/help/Get-AzVmssVM.md +++ b/src/Compute/Compute/help/Get-AzVmssVM.md @@ -16,13 +16,13 @@ Gets the properties of a VMSS virtual machine. ### DefaultParameter (Default) ``` Get-AzVmssVM [[-ResourceGroupName] ] [[-VMScaleSetName] ] [[-InstanceId] ] [-UserData] - [-DefaultProfile ] [] + [-ResiliencyView] [-DefaultProfile ] [] ``` ### FriendMethod ``` Get-AzVmssVM [[-ResourceGroupName] ] [[-VMScaleSetName] ] [[-InstanceId] ] - [-InstanceView] [-UserData] [-DefaultProfile ] + [-InstanceView] [-UserData] [-ResiliencyView] [-DefaultProfile ] [] ``` @@ -59,6 +59,14 @@ This command gets the properties of the VMSS virtual machine named VMSS004 that Since the command specifies the *InstanceView* switch parameter, the cmdlet gets the instance view of the virtual machine. The command gets the instance ID stored in the variable $ID for which to get the instance view. +### Example 4: Get the resiliency view of a VMSS virtual machine +```powershell +Get-AzVmssVM -ResiliencyView -ResourceGroupName "myResourceGroup" -VMScaleSetName "myScaleSet" -InstanceId "0" +``` + +This command gets the resiliency view of the VMSS virtual machine with instance ID "0" in the scale set "myScaleSet". +The ResiliencyView parameter retrieves the real-time status of VM delete retries for the Resilient Delete feature, including the ResilientVMDeletionStatus property which indicates whether retries are in progress, failed, or not started. + ## PARAMETERS ### -DefaultProfile @@ -136,6 +144,21 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -ResiliencyView +ResiliencyView retrieves the real-time status of VM delete retries for the Resilient Delete feature. When specified, the response includes the ResilientVMDeletionStatus property indicating whether retries are in progress, failed, or not started. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + ### -VMScaleSetName Species the name of the VMSS.