title: How to Add-AzureRmAccount using Microsoft account?
body: <p>I want to use Add-AzureRmAccount with my Microsoft account credentials but I don't know how to do it. I want to create a non-interactive script that is run by the Windows task scheduler. Therefore, I cannot use the interactive log-in. I tried the following.</p>
  
  <pre><code>$User = "foo@bar.com"
  $PWord = ConvertTo-SecureString "password" -AsPlainText -Force
  $Credential = New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $User, $PWord
  
  Add-AzureRmAccount -Credential $Credential
  </code></pre>
  
  <p>However, it fails and I read in the documentation that using just the -Credential parameter is not supported for Microsoft account credentials.</p>
  
  <p>How can I use my Microsoft account credentials with Add-AzureRmAccount?</p>
  
  <p>Thanks in advance.</p>