3

Trying to setup a simple AzureVMFileCopy task from the VSTS Release. I have already done the following steps:

  1. Execucted Enable-PSRemoting
  2. Setup the WinRM listener with self signed certificate and opened the Port 5986 over HTTPS for WInRM
  3. Configured the Inbound firewall rule to allow traffic on port 5986 and 5985 as well.
  4. In the VSTS task, tried giving the username using different conventions - Domain/username, .\username, username
  5. In VSTS task, enabled copy prerequisites.
  6. Configured the VSTS Agent on the VM to run in "interactive mode" and used the administrator user account. Have tried to configure using Service Account as well with the same administrator account.
  7. Interesting thing is that the files are copied in the VSTS Agent _work folder but the final copy to target folder gives "Access is Denied".
  8. Have tried verifying the connection using Enter-PSSession but that also gives the same error. enter image description here

Here is the exception I get:

System.Management.Automation.Remoting.PSRemotingTransportException: Connecting to remote server devocxdbvm.westeurope.cloudapp.azure.com failed with the following error message : Access is denied

Any basic element I may be missing ?

Screenshot of the Azure File Copy Task enter image description here

Vikram
  • 6,865
  • 9
  • 50
  • 61
  • Can you share the detail logs by setting `system.debug` variable as `true`? And besides, what's the agent did you use? Can you also procide the screen shot for how you config the Azure File Copy task? – Marina Liu Apr 16 '18 at 06:02
  • @MarinaLiu-MSFT screenshot added in the question. The agent used is for windows server downloaded from Agent link on VSTS. the release log with debug flag is here - https://www.dropbox.com/s/79s66m1gcgipm6r/3_AzureVMs%20File%20Copy.log?dl=0 – Vikram Apr 16 '18 at 06:42
  • In your agent machine, it seems the location `C:\Program Files\WindowsPowerShell\Modules` for `PSModulePath` is invalid, please remove the location from `PSModulePath` and deploy again. – Marina Liu Apr 16 '18 at 07:17
  • The path is very much valid. here is the screenshot https://www.dropbox.com/s/1zjenjcz26iulk7/PSModulePath.PNG?dl=0 – Vikram Apr 16 '18 at 07:51
  • While in the log, there have "Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\...'. Cannot verify the Microsoft .NET Framework version 4.5.2 because it is not included in the list of permitted versions". – Marina Liu Apr 16 '18 at 08:02
  • is there an explicit way to include in the list of permitted versions ? or could there be a permission issue somewhere ? – Vikram Apr 16 '18 at 08:04
  • Azure Powershell version is 5.1.2. How would Hosted Agent copy the files to my Azure VM ? – Vikram Apr 16 '18 at 08:18
  • Please take a look at this question https://stackoverflow.com/questions/47468342/deploy-test-agent-failing-in-vsts-due-to-winrm-issue. OP included the build log and exception System.Management.Automation.Remoting.PSRemotingTransportException is the same – Alex S Apr 16 '18 at 10:38
  • @AlexS that worked !!!! how on earth did you figure this out ? Can you pls post the same answer here so that i can accept that as the correct answer ! – Vikram Apr 16 '18 at 11:38
  • Glad that's the fix. It drove me crazy for days! Many hours of googling and trying untold suggestions got the right one in the end. – Alex S Apr 16 '18 at 11:59
  • been struggling with it for last 4-5 days and have gone crazy looking for a solution... am glad that finally got one :-) thanks a zillion... – Vikram Apr 16 '18 at 12:00

1 Answers1

3

I experienced this same issue setting up a build machine for VSTS, fix for me was Method 2 here: https://support.microsoft.com/en-us/help/896861/you-receive-error-401-1-when-you-browse-a-web-site-that-uses-integrate

which is to add the following registry key:
In Registry Editor, locate and then click the following registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
Right-click Lsa, point to New, and then click DWORD Value.
Type DisableLoopbackCheck, and then press ENTER.
Right-click DisableLoopbackCheck, and then click Modify.
In the Value data box, type 1, and then click OK.

Restart the VM

I believe (can't find where I read this now) that this was introduced by a security update to windows so may change again in future.

Alex S
  • 1,576
  • 3
  • 18
  • 21