Skip to content

Commit ea4b0ab

Browse files
audreytttCopilotCopilot
authored
Add ResiliencyView parameter to Get-AzVmssVM for monitoring Resilient Delete retries (#28927)
Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: audreyttt <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 0b4b996 commit ea4b0ab

File tree

7 files changed

+3232
-3
lines changed

7 files changed

+3232
-3
lines changed

src/Compute/Compute.Test/ScenarioTests/VirtualMachineScaleSetTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,5 +493,12 @@ public void TestVirtualMachineScaleSetGalleryApplicationFlags()
493493
{
494494
TestRunner.RunTestScript("Test-VirtualMachineScaleSetGalleryApplicationFlags");
495495
}
496+
497+
[Fact]
498+
[Trait(Category.AcceptanceType, Category.CheckIn)]
499+
public void TestVirtualMachineScaleSetResiliencyView()
500+
{
501+
TestRunner.RunTestScript("Test-VirtualMachineScaleSetResiliencyView");
502+
}
496503
}
497504
}

src/Compute/Compute.Test/ScenarioTests/VirtualMachineScaleSetTests.ps1

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6143,4 +6143,46 @@ function Test-VirtualMachineScaleSetGalleryApplicationFlags
61436143
{
61446144
Clean-ResourceGroup $rgname
61456145
}
6146+
}
6147+
6148+
<#
6149+
.SYNOPSIS
6150+
Test Virtual Machine Scale Set with ResiliencyView
6151+
#>
6152+
function Test-VirtualMachineScaleSetResiliencyView
6153+
{
6154+
# Setup
6155+
$rgname = Get-ComputeTestResourceName;
6156+
$loc = "eastus2euap";
6157+
6158+
6159+
try
6160+
{
6161+
# Common
6162+
New-AzResourceGroup -Name $rgname -Location $loc -Force;
6163+
6164+
$vmssName = 'vmss' + $rgname;
6165+
$domainNameLabel1 = "d1" + $rgname;
6166+
6167+
$adminUsername = Get-ComputeTestResourceName;
6168+
$password = Get-PasswordForVM;
6169+
$adminPassword = $password | ConvertTo-SecureString -AsPlainText -Force;
6170+
$cred = New-Object System.Management.Automation.PSCredential ($adminUsername, $adminPassword);
6171+
$linuxImage = "Canonical:0001-com-ubuntu-server-jammy:22_04-lts:latest"
6172+
6173+
# Create VMSS for testing ResiliencyView
6174+
$vmss = New-AzVmss -ResourceGroupName $rgname -Location $loc -Credential $cred -VMScaleSetName $vmssName -DomainNameLabel $domainNameLabel1 -Image $linuxImage
6175+
$vmssvm = Get-AzVmssVM -ResourceGroupName $rgname -VMScaleSetName $vmssName
6176+
$id = $vmssvm[0].InstanceId
6177+
6178+
$vmResiliencyView = Get-AzVmssVM -ResourceGroupName $rgname -VMScaleSetName $vmssName -InstanceId $id -ResiliencyView
6179+
6180+
# Verify that ResilientVMDeletionStatus is present
6181+
Assert-AreEqual "Disabled" $vmResiliencyView.ResilientVMDeletionStatus
6182+
}
6183+
finally
6184+
{
6185+
# Cleanup
6186+
Clean-ResourceGroup $rgname;
6187+
}
61466188
}

src/Compute/Compute.Test/SessionRecords/Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineScaleSetTests/TestVirtualMachineScaleSetResiliencyView.json

Lines changed: 3131 additions & 0 deletions
Large diffs are not rendered by default.

src/Compute/Compute/ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
2121
-->
2222
## Upcoming Release
23+
* Added `-ResiliencyView` parameter to `Get-AzVmssVM` cmdlet
24+
- Retrieves the resilient VM deletion status for Virtual Machine Scale Set (VMSS) VMs
25+
- Indicates whether automatic delete retries are in progress, failed, or not started
26+
- Supports monitoring the real-time status of the Resilient Delete feature
2327

2428
## Version 11.0.0
2529
* Improved user experience and consistency. This may introduce breaking changes. Please refer to [here](https://go.microsoft.com/fwlink/?linkid=2340249).

src/Compute/Compute/Generated/Models/PSVirtualMachineScaleSetVM.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public string ResourceGroupName
6666
public string Location { get; set; }
6767
public IDictionary<string, string> Tags { get; set; }
6868
public string UserData { get; set; }
69+
public string ResilientVMDeletionStatus { get; set; }
6970

7071
}
7172
}

src/Compute/Compute/Generated/VirtualMachineScaleSetVM/VirtualMachineScaleSetVMGetMethod.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public partial class GetAzureRmVmssVM : ComputeAutomationBaseCmdlet
3939
protected const string DefaultParameterSet = "DefaultParameter",
4040
FriendMethodParameterSet = "FriendMethod";
4141
private VmssVMInstanceViewTypes UserDataExpand = VmssVMInstanceViewTypes.UserData;
42+
private VmssVMInstanceViewTypes ResiliencyViewExpand = VmssVMInstanceViewTypes.ResiliencyView;
4243

4344
public override void ExecuteCmdlet()
4445
{
@@ -58,6 +59,13 @@ public override void ExecuteCmdlet()
5859
ComputeAutomationAutoMapperProfile.Mapper.Map<VirtualMachineScaleSetVMInstanceView, PSVirtualMachineScaleSetVMInstanceView>(result, psObject);
5960
WriteObject(psObject);
6061
}
62+
else if (this.ResiliencyView.IsPresent)
63+
{
64+
var result = VirtualMachineScaleSetVMsClient.Get(resourceGroupName, vmScaleSetName, instanceId, ResiliencyViewExpand);
65+
var psObject = new PSVirtualMachineScaleSetVM();
66+
ComputeAutomationAutoMapperProfile.Mapper.Map<VirtualMachineScaleSetVM, PSVirtualMachineScaleSetVM>(result, psObject);
67+
WriteObject(psObject);
68+
}
6169
else if (this.UserData == true)
6270
{
6371
var result = VirtualMachineScaleSetVMsClient.Get(resourceGroupName, vmScaleSetName, instanceId, UserDataExpand);
@@ -173,5 +181,17 @@ public override void ExecuteCmdlet()
173181
HelpMessage = "UserData for the Vmss, which will be Base64 encoded. Customer should not pass any secrets in here.",
174182
ValueFromPipelineByPropertyName = true)]
175183
public SwitchParameter UserData { get; set; }
184+
185+
[Parameter(
186+
Mandatory = false,
187+
ParameterSetName = DefaultParameterSet,
188+
HelpMessage = "Gets the resilient VM deletion status for the VM, which indicates whether retries are in progress, failed, or not started.",
189+
ValueFromPipelineByPropertyName = true)]
190+
[Parameter(
191+
Mandatory = false,
192+
ParameterSetName = FriendMethodParameterSet,
193+
HelpMessage = "Gets the resilient VM deletion status for the VM, which indicates whether retries are in progress, failed, or not started.",
194+
ValueFromPipelineByPropertyName = true)]
195+
public SwitchParameter ResiliencyView { get; set; }
176196
}
177197
}

src/Compute/Compute/help/Get-AzVmssVM.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ Gets the properties of a VMSS virtual machine.
1616
### DefaultParameter (Default)
1717
```
1818
Get-AzVmssVM [[-ResourceGroupName] <String>] [[-VMScaleSetName] <String>] [[-InstanceId] <String>] [-UserData]
19-
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
19+
[-ResiliencyView] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
2020
```
2121

2222
### FriendMethod
2323
```
2424
Get-AzVmssVM [[-ResourceGroupName] <String>] [[-VMScaleSetName] <String>] [[-InstanceId] <String>]
25-
[-InstanceView] [-UserData] [-DefaultProfile <IAzureContextContainer>]
25+
[-InstanceView] [-UserData] [-ResiliencyView] [-DefaultProfile <IAzureContextContainer>]
2626
[<CommonParameters>]
2727
```
2828

@@ -59,6 +59,15 @@ This command gets the properties of the VMSS virtual machine named VMSS004 that
5959
Since the command specifies the *InstanceView* switch parameter, the cmdlet gets the instance view of the virtual machine.
6060
The command gets the instance ID stored in the variable $ID for which to get the instance view.
6161

62+
### Example 4: Get the resilient VM deletion status of a VMSS virtual machine
63+
```powershell
64+
Get-AzVmssVM -ResiliencyView -ResourceGroupName "Group001" -VMScaleSetName "VMSS001" -InstanceId "0"
65+
```
66+
67+
This command gets the resilient VM deletion status for the VMSS virtual machine with instance ID 0 in the scale set VMSS001.
68+
The ResiliencyView parameter retrieves the ResilientVMDeletionStatus property, which indicates whether automatic delete retries are in progress, failed, or not started.
69+
This is useful for monitoring the Resilient Delete feature status.
70+
6271
## PARAMETERS
6372

6473
### -DefaultProfile
@@ -136,8 +145,23 @@ Accept pipeline input: True (ByPropertyName)
136145
Accept wildcard characters: False
137146
```
138147
148+
### -ResiliencyView
149+
Gets the resilient VM deletion status for the VM, which indicates whether retries are in progress, failed, or not started. This parameter is only supported when retrieving a specific VM instance (when InstanceId is provided).
150+
151+
```yaml
152+
Type: System.Management.Automation.SwitchParameter
153+
Parameter Sets: (All)
154+
Aliases:
155+
156+
Required: False
157+
Position: Named
158+
Default value: None
159+
Accept pipeline input: True (ByPropertyName)
160+
Accept wildcard characters: False
161+
```
162+
139163
### -VMScaleSetName
140-
Species the name of the VMSS.
164+
Specifies the name of the VMSS.
141165
142166
```yaml
143167
Type: System.String

0 commit comments

Comments
 (0)