Update-AzureRmVM

Updates the state of an Azure virtual machine.

Syntax

Update-AzureRmVM
      -VM <PSVirtualMachine>
      [-Tags <Hashtable>]
      [-IdentityType <ResourceIdentityType>]
      [-AssignIdentity]
      [-ResourceGroupName] <String>
      [-AsJob]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Update-AzureRmVM
      -VM <PSVirtualMachine>
      [-Tags <Hashtable>]
      [-IdentityType <ResourceIdentityType>]
      [-AssignIdentity]
      [-Id] <String>
      [-AsJob]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Update-AzureRmVM 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-AzureRmVM -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-AzureRmVM cmdlet.

Required Parameters

-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
-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
-VM

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

Type:Microsoft.Azure.Commands.Compute.Models.PSVirtualMachine
Aliases:VMProfile
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName, ByValue)
Accept wildcard characters:False

Optional Parameters

-AsJob

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

Type:System.Management.Automation.SwitchParameter
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-AssignIdentity

Specify the system assigned identity for the virtual machine.

Type:System.Management.Automation.SwitchParameter
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-Confirm

Prompts you for confirmation before running the cmdlet.

Type:System.Management.Automation.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.IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-IdentityType

The type of identity used for the virtual machine. Currently, the only supported type is 'SystemAssigned', which implicitly creates an identity.

Type:System.Nullable`1[Microsoft.Azure.Management.Compute.Models.ResourceIdentityType]
Parameter Sets:SystemAssigned
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Tags

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
-WhatIf

Shows what would happen if the cmdlet runs.

The cmdlet is not run.

Type:System.Management.Automation.SwitchParameter
Aliases:wi
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False