Skip navigation
clouds with question mark road sign

Using Add-AzureAccount with no Interaction

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."

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish