Update-AzureRmVmss

Updates the state of a VMSS.

Warning

The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.

Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.

Syntax

Update-AzureRmVmss
      [-ResourceGroupName] <String>
      [-VMScaleSetName] <String>
      [[-VirtualMachineScaleSet] <PSVirtualMachineScaleSet>]
      [-ImageReferenceSku <String>]
      [-ManagedDiskStorageAccountType <String>]
      [-PlanPublisher <String>]
      [-ProvisionVMAgent <Boolean>]
      [-BootDiagnosticsEnabled <Boolean>]
      [-Overprovision <Boolean>]
      [-MaxBatchInstancePercent <Int32>]
      [-TimeZone <String>]
      [-BootDiagnosticsStorageUri <String>]
      [-AutomaticOSUpgrade <Boolean>]
      [-DisableAutoRollback <Boolean>]
      [-SinglePlacementGroup <Boolean>]
      [-CustomData <String>]
      [-UpgradePolicyMode <UpgradeMode>]
      [-ImageReferenceId <String>]
      [-DisablePasswordAuthentication <Boolean>]
      [-Tag <Hashtable>]
      [-PlanName <String>]
      [-MaxUnhealthyUpgradedInstancePercent <Int32>]
      [-ImageReferencePublisher <String>]
      [-PlanProduct <String>]
      [-VhdContainer <String[]>]
      [-ImageUri <String>]
      [-SkuTier <String>]
      [-EnableAutomaticUpdate <Boolean>]
      [-LicenseType <String>]
      [-SkuName <String>]
      [-PlanPromotionCode <String>]
      [-MaxUnhealthyInstancePercent <Int32>]
      [-SkuCapacity <Int32>]
      [-OsDiskWriteAccelerator <Boolean>]
      [-ImageReferenceOffer <String>]
      [-PauseTimeBetweenBatches <String>]
      [-OsDiskCaching <CachingTypes>]
      [-ImageReferenceVersion <String>]
      [-UltraSSDEnabled <Boolean>]
      [-AsJob]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Update-AzureRmVmss
      [-ResourceGroupName] <String>
      [-VMScaleSetName] <String>
      [[-VirtualMachineScaleSet] <PSVirtualMachineScaleSet>]
      [-ImageReferenceSku <String>]
      [-IdentityId <String[]>]
      [-ManagedDiskStorageAccountType <String>]
      [-PlanPublisher <String>]
      [-ProvisionVMAgent <Boolean>]
      [-BootDiagnosticsEnabled <Boolean>]
      [-Overprovision <Boolean>]
      [-MaxBatchInstancePercent <Int32>]
      [-TimeZone <String>]
      [-BootDiagnosticsStorageUri <String>]
      [-AutomaticOSUpgrade <Boolean>]
      [-DisableAutoRollback <Boolean>]
      [-SinglePlacementGroup <Boolean>]
      [-CustomData <String>]
      [-UpgradePolicyMode <UpgradeMode>]
      [-ImageReferenceId <String>]
      [-DisablePasswordAuthentication <Boolean>]
      [-Tag <Hashtable>]
      [-PlanName <String>]
      [-MaxUnhealthyUpgradedInstancePercent <Int32>]
      [-ImageReferencePublisher <String>]
      [-PlanProduct <String>]
      [-VhdContainer <String[]>]
      [-ImageUri <String>]
      [-SkuTier <String>]
      [-EnableAutomaticUpdate <Boolean>]
      [-LicenseType <String>]
      -IdentityType <ResourceIdentityType>
      [-SkuName <String>]
      [-PlanPromotionCode <String>]
      [-MaxUnhealthyInstancePercent <Int32>]
      [-SkuCapacity <Int32>]
      [-OsDiskWriteAccelerator <Boolean>]
      [-ImageReferenceOffer <String>]
      [-PauseTimeBetweenBatches <String>]
      [-OsDiskCaching <CachingTypes>]
      [-ImageReferenceVersion <String>]
      [-UltraSSDEnabled <Boolean>]
      [-AsJob]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Update-AzureRmVmss cmdlet updates the state of a Virtual Machine Scale Set (VMSS) to the state of a local VMSS object.

Examples

Example 1: Update the state of a VMSS to the state of a local VMSS object.

PS C:\> Update-AzureRmVmss -ResourceGroupName "Group001" -Name "VMSS001" -VirtualMachineScaleSet $LocalVMSS

This command updates the state of the VMSS named VMSS001 that belongs to the resource group named Group001 to the state of a local VMSS object, $LocalVMSS.

Parameters

-AsJob

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

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

-AutomaticOSUpgrade

Sets whether OS upgrades should automatically be applied to scale set instances in a rolling fashion when a newer version of the image becomes available.

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

-BootDiagnosticsEnabled

Whether boot diagnostics should be enabled on the virtual machine scale set.

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

-BootDiagnosticsStorageUri

URI of the storage account to use for placing the console output and screenshot.

Type:String
Position:Named
Default value:None
Required:False
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
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-CustomData

Specifies a base-64 encoded string of custom data. This is decoded to a binary array that is saved as a file on the virtual machine. The maximum length of the binary array is 65535 bytes.

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

-DefaultProfile

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

Type:IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DisableAutoRollback

Disable Auto Rollback for Auto OS Upgrade Policy

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

-DisablePasswordAuthentication

Indicates that this cmdlet disables password authentication for Linux OS.

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

-EnableAutomaticUpdate

Indicates whether the Windows virtual machines in the VMSS are enabled for automatic updates.

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

-IdentityId

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

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-IdentityType

Specifies the type of identity used for the virtual machine scale set. The type 'SystemAssignedUserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the virtual machine scale set. The acceptable values for this parameter are:

  • SystemAssigned
  • UserAssigned
  • SystemAssignedUserAssigned
  • None
Type:Nullable<T>[ResourceIdentityType]
Accepted values:SystemAssigned, UserAssigned, SystemAssignedUserAssigned, None
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ImageReferenceId

Specifies the image reference ID.

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

-ImageReferenceOffer

Specifies the type of virtual machine image (VMImage) offer. To obtain an image offer, use the Get-AzureRmVMImageOffer cmdlet.

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

-ImageReferencePublisher

Specifies the name of a publisher of a VMImage. To obtain a publisher, use the Get-AzureRmVMImagePublisher cmdlet.

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

-ImageReferenceSku

Specifies the VMImage SKU. To obtain SKUs, use the Get-AzureRmVMImageSku cmdlet.

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

-ImageReferenceVersion

Specifies the version of the VMImage. To use the latest version, specify a value of latest instead of a particular version.

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

-ImageUri

Specifies the blob URI for the user image. VMSS creates an operating system disk in the same container of the user image.

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

-LicenseType

Specify the license type, which is for bringing your own license scenario.

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

-ManagedDiskStorageAccountType

Specifies the storage account type for managed disk. The acceptable values for this parameter are:

  • StandardLRS
  • PremiumLRS
Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-MaxBatchInstancePercent

The maximum percent of total virtual machine instances that will be upgraded simultaneously by the rolling upgrade in one batch. As this is a maximum, unhealthy instances in previous or future batches can cause the percentage of instances in a batch to decrease to ensure higher reliability. If the value is not specified, it is set to 20.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-MaxUnhealthyInstancePercent

The maximum percentage of the total virtual machine instances in the scale set that can be simultaneously unhealthy, either as a result of being upgraded, or by being found in an unhealthy state by the virtual machine health checks before the rolling upgrade aborts. This constraint will be checked prior to starting any batch. If the value is not specified, it is set to 20.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-MaxUnhealthyUpgradedInstancePercent

The maximum percentage of upgraded virtual machine instances that can be found to be in an unhealthy state. This check will happen after each batch is upgraded. If this percentage is ever exceeded, the rolling update aborts. If the value is not specified, it is set to 20.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-OsDiskCaching

Specifies the caching mode of the operating system disk. The acceptable values for this parameter are:

  • None
  • ReadOnly
  • ReadWrite The default value is ReadWrite. If you change the caching value, the cmdlet will restart the virtual machine. This setting affects the consistency and performance of the disk.
Type:CachingTypes
Accepted values:None, ReadOnly, ReadWrite
Position:Named
Default value:None
Required:False
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
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Overprovision

Indicates whether the cmdlet overprovisions the VMSS.

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

-PauseTimeBetweenBatches

The wait time between completing the update for all virtual machines in one batch and starting the next batch. The time duration should be specified in ISO 8601 format. The default value is 0 seconds (PT0S).

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

-PlanName

Specifies the plan name.

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

-PlanProduct

Specifies the plan product.

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

-PlanPromotionCode

Specifies the plan promotion code.

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

-PlanPublisher

Specifies the plan publisher.

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

-ProvisionVMAgent

Indicates whether virtual machine agent should be provisioned on the Windows virtual machines in the VMSS.

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

-ResourceGroupName

Specifies the name of the resource group the VMSS belongs to.

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-SinglePlacementGroup

Specifies the single placement group.

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

-SkuCapacity

Specifies the number of instances in the VMSS.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-SkuName

Specifies the size of all the instances of VMSS.

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

-SkuTier

Specifies the tier of VMSS. The acceptable values for this parameter are:

  • Standard
  • Basic
Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Tag

Key-value pairs in the form of a hash table. For example: @{key0="value0";key1=$null;key2="value2"}

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

-TimeZone

Specifies the time zone for Windows OS.

Type:String
Position:Named
Default value:None
Required:False
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 virtual machine scale set. Managed disks with storage account type UltraSSD_LRS can be added to a VMSS only if this property is enabled.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-UpgradePolicyMode

Specified the mode of an upgrade to virtual machines in the scale set. The acceptable values for this parameter are:

  • Automatic
  • Manual
  • Rolling
Type:UpgradeMode
Accepted values:Automatic, Manual, Rolling
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-VhdContainer

Specifies the container URLs that are used to store operating system disks for the VMSS.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-VirtualMachineScaleSet

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

Type:PSVirtualMachineScaleSet
Position:3
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-VMScaleSetName

Specifies the name of the VMSS that this cmdlet creates.

Type:String
Aliases:Name
Position:2
Default value:None
Required:True
Accept pipeline input:True
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
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

PSVirtualMachineScaleSet

Parameters: VirtualMachineScaleSet (ByValue)

Outputs

PSVirtualMachineScaleSet