Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Powershell throws "Unknown User Type"

I'm trying to authenticate Powershell script against the AD Account (as per this guide):

$userName = "[email protected]"
$securePassword = ConvertTo-SecureString -String "myPassword1" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential($userName, $securePassword)
Add-AzureAccount -Credential $cred

However I'm getting error:

Add-AzureAccount : unknown_user_type: Unknown User Type
At line:2 char:1
+ Add-AzureAccount -Credential $cred
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Add-AzureAccount], AadAuthenticationFailedException
    + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Profile.AddAzureAccount

And it does not matter what I type into the username/password, even "adsfasdf" for both username and password give me the same result.

Anybody had and fixed this problem before?

like image 749
trailmax Avatar asked Mar 03 '15 11:03

trailmax


1 Answers

For anyone coming to this question, I am providing my analysis which resolved the similar issue in my environment. I am also considering very helpful comments from the original question in the response below.

  1. Do check if you are able to use these credentials and manually log into the Azure portal
  2. Ensure that the account you are using is an Organizational account. Microsoft has security restriction where you can't log in using your Microsoft Account (earlier known as live id) which you use for various purposes and sites. This organizational account must be separate from Microsoft account.

Read more about the requirement regarding Organization account here on official Microsoft published document: Windows Azure Organizational Accounts FAQ

like image 113
Aman Sharma Avatar answered Oct 18 '22 01:10

Aman Sharma