Q: How can I connect to Azure using Add-AzureAccount without having to interact with the browser window?
A: Normally, Add-AzureAccount works by opening a web window in which you enter your username and password. If you want a headless (no interaction) logon, you can use the following:
$securepassword = ConvertTo-SecureString -string "<your password>" -AsPlainText -Force $cred = new-object System.Management.Automation.PSCredential ("<your logon>", $securepassword) Add-AzureAccount -Credential $cred
Note that this method does store your password in plain text. To solve this problem, see "Save a Password Securely to Use with PowerShell."
0 comments
Hide comments