How to Reset Password for VMSS (Scale Set) Instances
This blog is being migrated to www.solveazure.com and will be decommissioned once the content has been moved. ETA 2/28/2019
Please use www.solveazure.com for updated and continuous content.
Symptom:
Unable to RDP to a Virtual Machine Scale Set Instance (VMSS) due to an incorrect password
Resolution:
If Azure PowerShell is not installed, install it from https://azure.microsoft.com/en-us/downloads/
Open up PowerShell ISE as an Administrator
Paste the following script into the Window modifying each of the red portions accordingly:
Login-AzureRmAccount
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 $trueUpdate-AzureRmVmss -ResourceGroupName $vmssResourceGroup -Name $vmssName -VirtualMachineScaleSet $vmss
Navigate to the Azure Portal and select the VM Scale Set
Select Instances
You should see that all the instances are not updated to the Latest Model
Check all the boxes of the instance you wish you update with the new username and password
Select Upgrade
After a few mins (Depending on the number of instances you updated) you should see the Latest Model change to Yes
You can now login to the Scale Set VMs using the new Username and Password
Comments
- Anonymous
August 21, 2017
It was great help to add local user in VM Set. thank you for sharing the PowerShell.- Anonymous
August 22, 2017
Thanks! Happy to hear it was able to help you out :)
- Anonymous