You must verify that the Azure Virtual Machine username and password are correct.
Now the following code is used to verify the name and password of the virtual machine.
$SecureVmPassword = ConvertTo-SecureString -string $VmPassword -AsPlainText -Force $VmCredential = New-Object -typename System.Management.Automation.PSCredential -argumentlist $Fqdn"\"$VmUsername, $SecureVmPassword Invoke-Command -ConnectionUri $RemoteConnectionUri.ToString() -Credential $VmCredential -ScriptBlock{ }
But you cannot verify the credentials of the virtual machine while the virtual machines are in a shutdown state.
Is there a way to verify the credentials of a virtual machine even when the virtual machines are in a shutdown state?
source share