Resetting Expired Password in Domain Controller

I had a virtual machine configured to run as Domain Controller (DC). It was turned off for a month when I try to start; I was not able to log in.  While trying to reset the configuration or password using azure portal I received the error “VMAccess Extension does not support Domain Controller.”  The reason that I was not able to log in was my password expired.   You can reset the password using the following steps

Create a ps1 file with the following statements

$Password = ConvertTo-SecureString -String “<YOURPASSWORD>” -AsPlainText -Force

$UserAccount = Get-LocalUser -Name “<YOURACCOUNT>”

$UserAccount | Set-LocalUser -Password $Password

From the Azure Portal, navigate to your VM–>Extension–>Add–>Custom Script Extension–>Select your PowerShell script that was created using the above steps.  Click Ok.

You can click on the CustomScriptExtensio to see if any errors.  Please note when I was running, you can only have one CustomScriptExtension. If you need to run again to fix any errors you need to remove the existing CustomScriptExtension, then Add the same extension again to run your PowerShell script.  After the successful execution, you should be able to log in to the VM.