Connect-AzureRmAccount : Sequence contains no elements

Connect-AzureRmAccount : Sequence contains no elements

I will get the above error message whenever I try to connect to Azure Cloud using [email protected] (Microsoft Live Account), but i can login successfully by using my [email protected] account.

#Import the module into the PowerShell session
Import-Module AzureRM

#Connect to Azure with an interactive dialog for sign-in
$UserName = "[email protected]"
"C:\Users\kwyong\Box Sync\Scripts\kwyong.txt"
$Password = Get-Content "C:\Users\kwyong\Box Sync\Scripts\Cred-AventisTech.txt" | ConvertTo-SecureString

#Specify Credential with password 
$Credential = new-object -typename System.Management.Automation.PSCredential -ArgumentList $UserName,$Password

Connect-AzureRmAccount -Credential $Credential

Thanks to
This is an AD restriction, you cannot login non-interactively to Azure using a Microsoft Live account.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top