Update-AzVM

Updates the state of an Azure virtual machine.

Syntax

Update-AzVM
      [-ResourceGroupName] <String>
      -VM <PSVirtualMachine>
      [-Tag <Hashtable>]
      [-OsDiskWriteAccelerator <Boolean>]
      [-UltraSSDEnabled <Boolean>]
      [-MaxPrice <Double>]
      [-ProximityPlacementGroupId <String>]
      [-HostId <String>]
      [-AsJob]
      [-NoWait]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Update-AzVM
      [-ResourceGroupName] <String>
      -VM <PSVirtualMachine>
      [-Tag <Hashtable>]
      -IdentityType <ResourceIdentityType>
      [-IdentityId <String[]>]
      [-OsDiskWriteAccelerator <Boolean>]
      [-UltraSSDEnabled <Boolean>]
      [-MaxPrice <Double>]
      [-ProximityPlacementGroupId <String>]
      [-HostId <String>]
      [-AsJob]
      [-NoWait]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Update-AzVM
      [-Id] <String>
      -VM <PSVirtualMachine>
      [-Tag <Hashtable>]
      [-OsDiskWriteAccelerator <Boolean>]
      [-UltraSSDEnabled <Boolean>]
      [-MaxPrice <Double>]
      [-ProximityPlacementGroupId <String>]
      [-HostId <String>]
      [-AsJob]
      [-NoWait]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Update-AzVM cmdlet updates the state of an Azure virtual machine to the state of a virtual machine object.

Examples

Example 1: Update a virtual machine

PS C:\> Update-AzVM -ResourceGroupName "ResourceGroup11" -VM $VirtualMachine

This command updates the virtual machine, $VirtualMachine, in ResourceGroup11. The command updates it by using the virtual machine object stored in the $VirtualMachine variable. To obtain a virtual machine object, use the Get-AzVM cmdlet.

Parameters

-AsJob

Run cmdlet in the background and return a Job to track progress.

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:False
Accept pipeline input:False
Accept wildcard characters:False
-DefaultProfile

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

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

The Id of Host

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

Specifies the resource ID of the virtual machine.

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

Specifies the list of user identities associated with the virtual machine. The user identity references will be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/identities/{identityName}'

Type:System.String[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-IdentityType

The type of identity used for the virtual machine. Valid values are SystemAssigned, UserAssigned, SystemAssignedUserAssigned, and None.

Type:System.Nullable`1[Microsoft.Azure.Management.Compute.Models.ResourceIdentityType]
Accepted values:SystemAssigned, UserAssigned, SystemAssignedUserAssigned, None
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-MaxPrice

Specifies the maximum price you are willing to pay for a low priority VM/VMSS. This price is in US Dollars. This price will be compared with the current low priority price for the VM size. Also, the prices are compared at the time of create/update of low priority VM/VMSS and the operation will only succeed if the maxPrice is greater than the current low priority price. The maxPrice will also be used for evicting a low priority VM/VMSS if the current low priority price goes beyond the maxPrice after creation of VM/VMSS. Possible values are: any decimal value greater than zero. Example: 0.01538. -1 indicates that the low priority VM/VMSS should not be evicted for price reasons. Also, the default max price is -1 if it is not provided by you.

Type:Double
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-NoWait

Starts the operation and returns immediately, before the operation is completed. In order to determine if the operation has successfully been completed, use some other mechanism.

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

Specifies whether WriteAccelerator should be enabled or disabled on the OS disk.

Type:Boolean
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ProximityPlacementGroupId

The resource id of the Proximity Placement Group to use with this virtual machine.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ResourceGroupName

Specifies the name of the resource group of the virtual machine.

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

Specifies the resources and resource groups can be tagged with a set of name-value pairs. Adding tags to resources enables you to group resources together across resource groups and to create your own views. Each resource or resource group can have a maximum of 15 tags.

Type:Hashtable
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-UltraSSDEnabled

The flag that enables or disables a capability to have one or more managed data disks with UltraSSD_LRS storage account type on the VM. Managed disks with storage account type UltraSSD_LRS can be added to a virtual machine only if this property is enabled.

Type:Boolean
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-VM

Specifies a local virtual machine object. To obtain a virtual machine object, use the Get-AzVM cmdlet. This virtual machine object contains the updated state for the virtual machine.

Type:PSVirtualMachine
Aliases:VMProfile
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName, 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:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

PSVirtualMachine

Boolean

Outputs

PSAzureOperationResponse