Edit

Share via


Update-AzVmssVM

Updates the state of a Vmss VM.

Syntax

DefaultParameter (Default)

Update-AzVmssVM
    [-ResourceGroupName] <String>
    [-VMScaleSetName] <String>
    [-InstanceId] <String>
    [-DataDisk <PSVirtualMachineDataDisk[]>]
    [-ProtectFromScaleIn <Boolean>]
    [-ProtectFromScaleSetAction <Boolean>]
    [-AsJob]
    [-UserData <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ResourceIdParameter

Update-AzVmssVM
    [-ResourceId] <String>
    [-DataDisk <PSVirtualMachineDataDisk[]>]
    [-ProtectFromScaleIn <Boolean>]
    [-ProtectFromScaleSetAction <Boolean>]
    [-AsJob]
    [-UserData <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ObjectParameter

Update-AzVmssVM
    [-VirtualMachineScaleSetVM] <PSVirtualMachineScaleSetVM>
    [-DataDisk <PSVirtualMachineDataDisk[]>]
    [-ProtectFromScaleIn <Boolean>]
    [-ProtectFromScaleSetAction <Boolean>]
    [-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-AzVMDataDisk

$disk = Get-AzDisk -ResourceGroupName $rgname -DiskName $diskname0
$datadisk = New-AzVMDataDisk -Caching 'ReadOnly' -Lun 2 -CreateOption Attach -StorageAccountType Standard_LRS -ManagedDiskId $disk.Id
$VmssVM = Get-AzVmssVM -ResourceGroupName "myrg" -VMScaleSetName "myvmss" -InstanceId 0
Update-AzVmssVM -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-AzVMDataDisk

$disk = Get-AzDisk -ResourceGroupName $rgname -DiskName $diskname0
$VmssVM = Get-AzVmssVM -ResourceGroupName "myrg" -VMScaleSetName "myvmss" -InstanceId 0
$VmssVM = Add-AzVMDataDisk -VM $VmssVM -Lun 0 -DiskSizeInGB 10 -CreateOption Attach -StorageAccountType Standard_LRS -ManagedDiskId $disk.Id
Update-AzVmssVM -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.

Example 3

Updates the state of a Vmss VM. (autogenerated)

Update-AzVmssVM -InstanceId 0 -ProtectFromScaleIn $false -ProtectFromScaleSetAction $false -ResourceGroupName 'myrg' -VMScaleSetName 'myvmss'

Parameters

-AsJob

Run cmdlet in the background

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DataDisk

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

Parameter properties

Type:

PSVirtualMachineDataDisk[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-DefaultProfile

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

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InstanceId

Specifies the instance ID of a VMSS VM.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

DefaultParameter
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ProtectFromScaleIn

Indicates that the virtual machine scale set VM shouldn't be considered for deletion during a scale-in operation.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ProtectFromScaleSetAction

Indicates that model updates or actions (including scale-in) initiated on the VMSS should not be applied to the VMSS VM.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ResourceGroupName

Specifies the name of the Resource Group of the VMSS.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

DefaultParameter
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ResourceId

The resource id for the virtual machine scale set VM

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ResourceIdParameter
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-UserData

UserData for the Vmss Vm, which will be base-64 encoded. Customer should not pass any secrets in here.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

DefaultParameter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
ResourceIdParameter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-VirtualMachineScaleSetVM

Local virtual machine scale set VM object

Parameter properties

Type:PSVirtualMachineScaleSetVM
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ObjectParameter
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-VMScaleSetName

The name of the virtual machine scale set

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Name

Parameter sets

DefaultParameter
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-WhatIf

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

String

PSVirtualMachineDataDisk

PSVirtualMachineScaleSetVM

Outputs

PSVirtualMachineScaleSetVM