Add-AzureAccount -credential doesn't work as I was hoping

4 days ago (Aug 4, 2014), a new version of Azure Powershell was released with a new -Credential parameter in the Add-AzureAccount cmdlet. I am trying to use it, but I am clearly doing something wrong. First, I save my password in a file:

read-host -assecurestring | convertfrom-securestring | out-file C:\temp\securestring.txt

      

Then try using it in Add-AzureAccount

$password = cat C:\temp\securestring.txt | convertto-securestring
$username = "dhdom1\jamiet" #yes, this is the correct username
$mycred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username,$password
Add-AzureAccount -credential $mycred

      

Failed to call Add-AzureAccount:

Add-AzureAccount: user_realm_discovery_failed: user detected failed: The remote server returned an error: (404) Not found.

I know that "dhdom1 \ jamiet" is the correct account. Does anyone know why this might fail? TIA

+3


source to share


2 answers


You must use the account of the organization that you use to sign in to the Azure Portal. So it might look like jamiet@yourorganizationalaccountname.com or something like that.



+8


source


  • open window with azure powershell window
  • enter Add-AzureAccount then enter
  • the login screen will appear, then enter this account forecast
  • these credentials are saved in this PowerShell window and then run all other scripts from that particular window.


0


source







All Articles