Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Non-interactive Azrue PowerShell management
# first save encrypted password to a file that can later be used
read-host -assecurestring | convertfrom-securestring | out-file d:\tmp\securestring.txt
# then use the saved password
$password = cat d:\tmp\securestring.txt | convertto-securestring
# currently (August, the 13nd, 2014) only organizational accounts are supported (also with custom domain).
# Microsoft Accounts (Live ID) are not supported
$username = "user@tenant.onmicrosoft.com" # or user@yourdomain.com if 'yourdomain.com' is registered with AAD
$mycred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username,$password
Add-AzureAccount -credential $mycred
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment