Azure / azure-devtestlab

Azure DevTestLab artifacts, scripts and samples
MIT License
458 stars 602 forks source link

Pipelines Agent artfact fails with ERROR: Connecting to remote server localhost failed #757

Closed nikydobrev closed 3 years ago

nikydobrev commented 3 years ago

I'm trying to use the Pipelines Agent artifact (windows-vsts-build-agent) to set up a new agent.

The artifact installation fails with the following error message:

Validating parameters Preparing agent installation location Checking for a previously configured agent Downloading agent package Extracting agent package contents Getting agent installer path Installing agent ERROR: Connecting to remote server localhost failed with the following error message: The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig". For more information, see the about_Remote_Troubleshooting Help topic.

Steps to reproduce:

Steps to reproduce:

1) Create a new DevTest Lab 2) Create a VM using the template: "Visual Studio 2019 Community (latest release) on Windows Server 2019 (x64)" Size = Standard_DS2_v2 3) Add the Pipelines Agent artifact and supply the required parameters.

Thanks, --Nikolay

PS: Screenshot: 112982047-ab33fc00-9164-11eb-8ea7-df138b85a0e0

leovms commented 3 years ago

@nikydobrev, I executed it without problems when I specify the following. BTW, I tried it without specifying an Agent Name as well and it also worked.

image image image

Now, I do see the undefined at the very end. I'm not sure where that is coming from, but I don't think it has a negative impact on the execution of the artifact.

Can you provide sample parameters you used to repro the case?

nikydobrev commented 3 years ago

Hi, @leovms,

Thanks for looking into the case. If you set the "Enable Autologon" to True it will fail.

Web capture_5-5-2021_92025_portal azure com

Web capture_5-5-2021_9437_portal azure com

Regards, Nikolay

leovms commented 3 years ago

@nikydobrev, thank you for the additional info. To make it work in that context, you need to configure WinRM. Apply the Configure WinRM. image

nikydobrev commented 3 years ago

Thanks, @leovms. I just have some questions related to that artifact, Since we create our VM in a private network in the DevTest Lab it does not have a public IP address, and we cannot provide it through the "Configure WinRM" artifact. Also, how can we get the FQDN of the machine prior to it is being provisioned? Can you provide the parameters that you passed to the artifacts in your example screenshot above?

Web capture_5-5-2021_223753_portal azure com

Thanks, Nikolay

leovms commented 3 years ago

@nikydobrev, yes I used the value from IP address or FQDN. The problem I see is that you're using a private IP address. Configure WinRM will not work with a Private IP Address because by default the command will configure it as Public. So, the firewall rule will not work. Additionally, even if you ignore that issue, running the agent install will not work because we then get error Access Denied. Having said that, you may be able to copy these 2 artifacts to your own private repo and modify them to fit your scenario.

nikydobrev commented 3 years ago

Thanks, @leovms for provided the information. I managed to successfully install the artifact once the 'Configure WinRM' artifacts is installed before that.

Just on a side note, do you manage to know why using a 'Visual Studio 2019 with Windows 10 latest' image does not require to install a 'WinRM' artifact, and the "Pipeline agent" artifact is installed successfully even when the "Enable Autologon" is set to True.

Thanks once again for all the help.

Regards, Nikolay

leovms commented 3 years ago

I don't know. It is possible that it is configured by default. But that's just speculation.