title: WinRM Access Denied (Azure File Copy Task in Build Definition for Visual Studio Team Services)
body: <p>I have an 'Azure File Copy' task in my Build Definition for Team Services (was Visual Studio Online). Whenever I run this I get an 'Access Denied' error. I've been trying to troubleshoot this for hours with no luck.</p>
  
  <pre><code>Copy started for machine: 'MACHINE NAME'
  Copy status for machine 'MACHINE NAME' : 'Failed'
  Connecting to remote server [IP ADDRESS] failed with the following error message : Access is denied. For more information, see the about_Remote_Troubleshooting Help topic.To fix WinRM connection related issues, select the 'Enable Copy Prerequisites' option in the task. If set already, and the target Virtual Machines are backed by a Load balancer, ensure Inbound NAT rules are configured for target port (5986). Applicable only for ARM VMs. For more info please refer to http://aka.ms/azurefilecopyreadme
  ******************************************************************************
  Finishing task: AzureFileCopy
  ******************************************************************************
  Task AzureFileCopy failed. This caused the job to fail. Look at the logs for the task for more details.
  ******************************************************************************
  Finishing Build
  ******************************************************************************
  </code></pre>
  
  <p>I've tried the following:</p>
  
  <ul>
  <li>'Enable Copy Prerequisites' checkbox on build task</li>
  <li>Assigning the user account directly to Microsoft.Powershell with 'Full Control' permissions using PSSession -ShowSecurityDescriptorUI</li>
  <li>Added Computer to the TrustedHosts List</li>
  <li>Made sure the necessary ports are unblocked (inbound and outbound)</li>
  </ul>
  
  <p>Considering that this is a Microsoft SaaS product, connecting to a standard Azure VM using nothing but Microsoft Azure architecture, I'm surprised this is so difficult. I must be missing something simple!</p>
  
  <p>Thanks in advance for any advice.</p>