Last active
June 5, 2017 22:06
-
-
Save astaykov/02540f3e0d9e19a016ee to your computer and use it in GitHub Desktop.
reset azure VM password
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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