title: Add-AzureAccount : user_realm_discovery_failed: User realm discovery failed: Unable to connect to the remote
body: <p>I have an hero PowerShell script that attempts a connection to Azure:</p>
  
  <pre><code>$username = "asdfasdf"
  $password = "asdfasdf"
  $secstr = New-Object -TypeName System.Security.SecureString
  $password.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)}
  $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $secstr
  Add-AzureAccount -Credential $cred
  Select-AzureSubscription -SubscriptionId asdfasdf
  </code></pre>
  
  <p>But I receive this error:</p>
  
  <pre><code>Add-AzureAccount : user_realm_discovery_failed: User realm discovery failed: Unable to connect to the remote 
  server
  At line:6 char:1
  + Add-AzureAccount -Credential $cred
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : CloseError: (:) [Add-AzureAccount], AadAuthenticationFailedException
      + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Profile.AddAzureAccount
  </code></pre>
  
  <p>My user is definitely a co-administrator for the Azure Directory. Do I have to use a proxy to communicate with Azure?</p>