How to Reset Password for VMSS (Scale Set) Instances


Unable to RDP to a Virtual Machine Scale Set Instance (VMSS) due to an incorrect password


  1. If Azure PowerShell is not installed, install it from
  2. Open up PowerShell ISE as an Administrator
  3. Paste the following script into the Window modifying each of the red portions accordingly:


    Get-AzureRmSubscription -SubscriptionId 'SUBSCRIPTIONID' | Select-AzureRmSubscription

    $vmssName = 'SCALESETNAME'
    $vmssResourceGroup = 'SCALESETRESOURCEGROUP'
    $publicConfig = @{'UserName' = 'USERNAME'}
    $privateConfig = @{'Password' = 'NEWPASSWORD'}
    $extName = 'VMAccessAgent'
    $publisher = 'Microsoft.Compute'
    $vmss = Get-AzureRmVmss -ResourceGroupName $vmssResourceGroup -VMScaleSetName $vmssName
    $vmss = Add-AzureRmVmssExtension -VirtualMachineScaleSet $vmss -Name $extName -Publisher $publisher -Setting $publicConfig -ProtectedSetting $privateConfig -Type $extName -TypeHandlerVersion '2.0' -AutoUpgradeMinorVersion $true

    Update-AzureRmVmss -ResourceGroupName $vmssResourceGroup -Name $vmssName -VirtualMachineScaleSet $vmss

  4. Navigate to the Azure Portal and select the VM Scale Set
  5. Select Instances
  6. You should see that all the instances are not updated to the Latest Model
  7. Check all the boxes of the instance you wish you update with the new username and password
  8. Select Upgrade
  9. After a few mins (Depending on the number of instances you updated) you should see the Latest Model change to Yes
  10. You can now login to the Scale Set VMs using the new Username and Password

Comments (2)

  1. D. S. Dodiya says:

    It was great help to add local user in VM Set. thank you for sharing the PowerShell.

    1. Thanks! Happy to hear it was able to help you out :)

Skip to main content