Reset Azure VM password using Powershell

You try to reset password for your Azure VM via the Azure portal – Reset Password method and you get the error message – “VMAccss extension does not work with domain controller”. How do we reset the password now?

Good News! We can reset the password by deploying a custom script extension (powershell script) to the VM. Below are the steps

1. Create a ps1 file in your local PC and name as ‘resetpw.ps1’. The script should have the below contents.  
net user username newpassword

Note: username above is the VM username and newpassword should be the password you want it to be.

2. Select your VM and under settings choose Extensions – Add New.
3. Create Custom Script Extension

4. Install the new custom script extension and upload the above created .ps1 file to Azure via Azure portal:

5. Now you should see a Provisioning Succeeded message.

6. That’s it, you can now login using the new password.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s