Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -493,5 +493,12 @@ public void TestVirtualMachineScaleSetGalleryApplicationFlags()
{
TestRunner.RunTestScript("Test-VirtualMachineScaleSetGalleryApplicationFlags");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestVirtualMachineScaleSetResiliencyView()
{
TestRunner.RunTestScript("Test-VirtualMachineScaleSetResiliencyView");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6143,4 +6143,46 @@ function Test-VirtualMachineScaleSetGalleryApplicationFlags
{
Clean-ResourceGroup $rgname
}
}

<#
.SYNOPSIS
Test Virtual Machine Scale Set with ResiliencyView
#>
function Test-VirtualMachineScaleSetResiliencyView
{
# Setup
$rgname = Get-ComputeTestResourceName;
$loc = "eastus2euap";


try
{
# Common
New-AzResourceGroup -Name $rgname -Location $loc -Force;

$vmssName = 'vmss' + $rgname;
$domainNameLabel1 = "d1" + $rgname;

$adminUsername = Get-ComputeTestResourceName;
$password = Get-PasswordForVM;
$adminPassword = $password | ConvertTo-SecureString -AsPlainText -Force;
$cred = New-Object System.Management.Automation.PSCredential ($adminUsername, $adminPassword);
$linuxImage = "Canonical:0001-com-ubuntu-server-jammy:22_04-lts:latest"

# Create VMSS for testing ResiliencyView
$vmss = New-AzVmss -ResourceGroupName $rgname -Location $loc -Credential $cred -VMScaleSetName $vmssName -DomainNameLabel $domainNameLabel1 -Image $linuxImage
$vmssvm = Get-AzVmssVM -ResourceGroupName $rgname -VMScaleSetName $vmssName
$id = $vmssvm[0].InstanceId

$vmResiliencyView = Get-AzVmssVM -ResourceGroupName $rgname -VMScaleSetName $vmssName -InstanceId $id -ResiliencyView

# Verify that ResilientVMDeletionStatus is present
Assert-AreEqual "Disabled" $vmResiliencyView.ResilientVMDeletionStatus
}
finally
{
# Cleanup
Clean-ResourceGroup $rgname;
}
}

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/Compute/Compute/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

-->
## Upcoming Release
* Added `-ResiliencyView` parameter to `Get-AzVmssVM` cmdlet
- Retrieves the resilient VM deletion status for Virtual Machine Scale Set (VMSS) VMs
- Indicates whether automatic delete retries are in progress, failed, or not started
- Supports monitoring the real-time status of the Resilient Delete feature

## Version 11.0.0
* Improved user experience and consistency. This may introduce breaking changes. Please refer to [here](https://go.microsoft.com/fwlink/?linkid=2340249).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public string ResourceGroupName
public string Location { get; set; }
public IDictionary<string, string> Tags { get; set; }
public string UserData { get; set; }
public string ResilientVMDeletionStatus { get; set; }

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand All @@ -58,6 +59,13 @@ public override void ExecuteCmdlet()
ComputeAutomationAutoMapperProfile.Mapper.Map<VirtualMachineScaleSetVMInstanceView, PSVirtualMachineScaleSetVMInstanceView>(result, psObject);
WriteObject(psObject);
}
else if (this.ResiliencyView.IsPresent)
{
var result = VirtualMachineScaleSetVMsClient.Get(resourceGroupName, vmScaleSetName, instanceId, ResiliencyViewExpand);
var psObject = new PSVirtualMachineScaleSetVM();
ComputeAutomationAutoMapperProfile.Mapper.Map<VirtualMachineScaleSetVM, PSVirtualMachineScaleSetVM>(result, psObject);
WriteObject(psObject);
}
else if (this.UserData == true)
{
var result = VirtualMachineScaleSetVMsClient.Get(resourceGroupName, vmScaleSetName, instanceId, UserDataExpand);
Expand Down Expand Up @@ -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 = "Gets the resilient VM deletion status for the VM, which indicates whether retries are in progress, failed, or not started.",
ValueFromPipelineByPropertyName = true)]
[Parameter(
Mandatory = false,
ParameterSetName = FriendMethodParameterSet,
HelpMessage = "Gets the resilient VM deletion status for the VM, which indicates whether retries are in progress, failed, or not started.",
ValueFromPipelineByPropertyName = true)]
public SwitchParameter ResiliencyView { get; set; }
}
}
30 changes: 27 additions & 3 deletions src/Compute/Compute/help/Get-AzVmssVM.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ Gets the properties of a VMSS virtual machine.
### DefaultParameter (Default)
```
Get-AzVmssVM [[-ResourceGroupName] <String>] [[-VMScaleSetName] <String>] [[-InstanceId] <String>] [-UserData]
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
[-ResiliencyView] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
```

### FriendMethod
```
Get-AzVmssVM [[-ResourceGroupName] <String>] [[-VMScaleSetName] <String>] [[-InstanceId] <String>]
[-InstanceView] [-UserData] [-DefaultProfile <IAzureContextContainer>]
[-InstanceView] [-UserData] [-ResiliencyView] [-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
```

Expand Down Expand Up @@ -59,6 +59,15 @@ 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 resilient VM deletion status of a VMSS virtual machine
```powershell
Get-AzVmssVM -ResiliencyView -ResourceGroupName "Group001" -VMScaleSetName "VMSS001" -InstanceId "0"
```

This command gets the resilient VM deletion status for the VMSS virtual machine with instance ID 0 in the scale set VMSS001.
The ResiliencyView parameter retrieves the ResilientVMDeletionStatus property, which indicates whether automatic delete retries are in progress, failed, or not started.
This is useful for monitoring the Resilient Delete feature status.

## PARAMETERS

### -DefaultProfile
Expand Down Expand Up @@ -136,8 +145,23 @@ Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -ResiliencyView
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).

```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.
Specifies the name of the VMSS.

```yaml
Type: System.String
Expand Down