Skip to content

Instantly share code, notes, and snippets.

@astaykov
Last active June 5, 2017 22:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save astaykov/02540f3e0d9e19a016ee to your computer and use it in GitHub Desktop.
Save astaykov/02540f3e0d9e19a016ee to your computer and use it in GitHub Desktop.
reset azure VM password
$cred = Get-Credential -UserName "user@domain.com" -Message "Enter your OrgID to manage Azure"
Add-AzureAccount -Credential $cred
Select-AzureSubscription -SubscriptionName "<Put actual subscription name here>"
$adminCredentials = Get-Credential -Message "Enter new Admin credentials"
$VM = Get-AzureVM -Name "<put azure VM name here>" -ServiceName "<put service name (subdomain) here>"
If ($VM.VM.ProvisionGuestAgent) {
Set-AzureVMAccessExtension -VM $VM `
-UserName $adminCredentials.UserName `
-Password $adminCredentials.GetNetworkCredential().Password `
-ReferenceName "VMAccessAgent" |
Update-AzureVM
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment