Using Add-AzureAccount with no Interaction

Connect to Azure using Add-AzureAccount without manual input.

John Savill

December 25, 2014

1 Min Read
clouds with question mark road sign

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 "" -AsPlainText -Force $cred = new-object System.Management.Automation.PSCredential ("", $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."

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like