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?
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.
Read more about the requirement regarding Organization account here on official Microsoft published document: Windows Azure Organizational Accounts FAQ