title: WinRM on Azure RM VM
body: <p>I'm trying to connect to an AzureRM VM. I've read through so many tutorials on WinRM but I still cannot get this to work:</p>
  
  <pre><code>    Enter-PSSession -ComputerName "$($HOST).cloudapp.net" -Credential $username
  </code></pre>
  
  <p>When I run this, I get the following error:</p>
  
  <blockquote>
    <p>The user name or password is incorrect. For more information, see the about_Remote_Troubleshooting Help topic</p>
  </blockquote>
  
  <p>When I add the -UseSSL param I get this error:</p>
  
  <blockquote>
    <p>The WinRM client cannot process the request because the server name cannot be resolved. For more information, see the 
    about_Remote_Troubleshooting Help topic.</p>
  </blockquote>
  
  <p>The credentials I'm entering are correct. So I also tried "localhost\$username" and I get a different error:</p>
  
  <blockquote>
    <p>The following error with errorcode 0x80090311 occurred while using Kerberos authentication:</p>
  </blockquote>
  
  <p>So I tried to use -Authentication basic and I get:</p>
  
  <blockquote>
    <p>The WinRM client cannot process the request. Unencrypted traffic is currently disabled in the client configuration</p>
  </blockquote>
  
  <p>But I have already checked and unencrypted traffic is enabled.</p>
  
  <p>Has anyone come across this issue before? Any suggestions as to what to try next?</p>
  
  <pre><code>    credentials = Get-Credential -UserName $username -Message "Enter Azure account credentials"
      $continue=$false
      Do{
  $session = New-PSSession -ComputerName "$($VMName).cloudapp.net" -Credential $credentials 
  if ($session -ne $null)
  {
    $continue=$true
  }
  Write-Output "Unable to create a PowerShell session . . . sleeping and trying again in 30 seconds."
  Start-Sleep -Seconds 30
        }
     Until(
  $continue=$true)
  </code></pre>
  
  <p>EDIT Adding what the settings are now on the Server:</p>
  
  <pre><code>   WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\Client
  
  Type            Name                           SourceOfValue   Value
  ----            ----                           -------------   -----
  System.String   NetworkDelayms                                 5000
  System.String   URLPrefix                                      wsman
  System.String   AllowUnencrypted                               true
  Container       Auth
  Container       DefaultPorts
  System.String   TrustedHosts
  </code></pre>
  
  <p>And the client:</p>
  
  <pre><code>   WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\Client
  
   Type            Name                           SourceOfValue   Value
   ----            ----                           -------------   -----
   System.String   NetworkDelayms                                 5000
   System.String   URLPrefix                                      wsman
   System.String   AllowUnencrypted                               true
   Container       Auth
   Container       DefaultPorts
   System.String   TrustedHosts                                   @{Value = "XX.XX.XX.XX"}
  </code></pre>