简体   繁体   中英

How to validate Azure Virtual machine username and password?

Need to validate the Azure Virtual machine username and password.

Now used the following code to validate the Virtual machine username and password.

$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 cannot able to validate the Virtual machine credentials while Virtual machines are in shutdown state.

Is there any way to validate Virtual machine credentials even when the Virtual machines are in shutdown state?

There's none. You are trying to check credentials over an inactive remote object (a powered off VM). You will either need access to its local drive and SAM database (if it's a non-DC) or NTDS database (if DC), then parse that one in your active computing resources to check the supplied credentials. This is kind of ripping one's intestines out just to check if your food would digest in there. So, if the target VM is shut down, you need to skip credentials validation, or use domain credentials that are sure to be valid for that particular VM, but are able to be verified on some other resource (the domain's DC).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM