Reset VM Password in HA
Overview
In Azure, you can reset the VM password via the Azure Portal, using the Reset Password tool.
In HA, the VM Scale Set has the same Reset Password tool. However, the new password only applies to incoming VMs.
In this article, we will use the Run Command to set the password on existing VMs in the VMSS.
Usage
Here is example syntax of a bash command you can run in the cloud shell:
az vmss run-command invoke \
--resource-group my-resource-group \
--name sftpgw-scale-set \
--command-id RunShellScript \
--instance-id 0 \
--scripts "echo 'azureuser:Password123' | sudo chpasswd"
Make sure you replace the following values with real ones:
my-resource-group
: This is the Resource Group namesftpgw-scale-set
: This is the name of the Scale set0
: This is the Instance ID in the VMSS, which you can find on the Overview pageazureuser
: This is the Linux admin username, such asubuntu
orazureuser
Password123
: Change this to a real password that meets your strength requirements
Note: Since this is a bash command, be careful what characters you include
in your password, since they may be interpolated. For example, you can reset
the password to something that only includes one special character like @
,
and then change the password again once you are logged in.