Update-AzureRmVmssVM

Updates the state of a Vmss VM.

Syntax

Update-AzureRmVmssVM
      [-ResourceGroupName] <String>
      [-VMScaleSetName] <String>
      [-InstanceId] <String>
      [-DataDisk <PSVirtualMachineDataDisk[]>]
      [-AsJob]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Update-AzureRmVmssVM
      [-DataDisk <PSVirtualMachineDataDisk[]>]
      [-ResourceId] <String>
      [-AsJob]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Update-AzureRmVmssVM
      [-DataDisk <PSVirtualMachineDataDisk[]>]
      [-VirtualMachineScaleSetVM] <PSVirtualMachineScaleSetVM>
      [-AsJob]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

Updates the state of a Vmss VM. For now, the only allowed update is adding a managed data disk.

Examples

Example 1: Add a managed data disk to a Vmss VM using New-AzureRmVMDataDisk

PS C:\> $disk = Get-AzureRmDisk -ResourceGroupName $rgname -DiskName $diskname0
PS C:\> $datadisk = New-AzureRmVMDataDisk -Caching 'ReadOnly' -Lun 2 -CreateOption Attach -StorageAccountType Standard_LRS -ManagedDiskId $disk.Id
PS C:\> $VmssVM = Get-AzureRmVmssVM -ResourceGroupName "myrg" -VMScaleSetName "myvmss" -InstanceId 0
PS C:\> Update-AzureRmVmssVM -ResourceGroupName "myrg" -VMScaleSetName "myvmss" -InstanceId 0 -DataDisk $datadisk

The first command gets an existing managed disk. The next command creates a data disk object with the managed disk. The next command gets an existing Vmss VM given by the resource group name, the vmss name and the instance ID. The final command updates the Vmss VM by adding a new data disk.

Example 2: Add a managed data disk to a Vmss VM using Add-AzureRmVMDataDisk

PS C:\> $disk = Get-AzureRmDisk -ResourceGroupName $rgname -DiskName $diskname0
PS C:\> $VmssVM = Get-AzureRmVmssVM -ResourceGroupName "myrg" -VMScaleSetName "myvmss" -InstanceId 0
PS C:\> $VmssVM = Add-AzureRmVMDataDisk -VirtualMachineScaleSetVM $VmssVM -Lun 0 -DiskSizeInGB 10 -CreateOption Attach -StorageAccountType Standard_LRS -ManagedDiskId $disk.Id
PS C:\> Update-AzureRmVmssVM -VirtualMachineScaleSetVM $VmssVM

The first command gets an existing managed disk. The next command gets an existing Vmss VM given by the resource group name, the vmss name and the instance ID. The next command adds the managed disk to the Vmss VM stored locally in $VmssVM. The final command updates the Vmss VM with added data disk.

Parameters

-AsJob

Run cmdlet in the background

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DataDisk
Type:Microsoft.Azure.Commands.Compute.Models.PSVirtualMachineDataDisk[]
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InstanceId

Specifies the instance ID of a VMSS VM.

Type:String
Position:3
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ResourceGroupName

Specifies the name of the Resource Group of the VMSS.

Type:String
Position:1
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ResourceId

The resource id for the virtual machine scale set VM

Type:String
Position:0
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-VMScaleSetName

The name of the virtual machine scale set

Type:String
Aliases:Name
Position:2
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-VirtualMachineScaleSetVM

Local virtual machine scale set VM object

Type:PSVirtualMachineScaleSetVM
Position:0
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

Microsoft.Azure.Commands.Compute.Models.PSVirtualMachineDataDisk[]

Parameters: DataDisk (ByValue)

PSVirtualMachineScaleSetVM

Parameters: VirtualMachineScaleSetVM (ByValue)

Outputs

PSVirtualMachineScaleSetVM