Created
August 13, 2014 15:57
-
-
Save astaykov/4805e070a3ad47a883da to your computer and use it in GitHub Desktop.
Non-interactive Azrue PowerShell management
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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