Azure Pipelines Agent artifact failed to apply

258 Views Asked by At

I am trying to apply Azure Pipeline Agent artifact while creating an Azure VM from the pipeline using Azure Dev Test Lab Create VM Task. I have provided all the valid values in the ARM Template(organization, pat, agent name, etc) but the specified artifact is failed to apply. here is the exception info Validating parameters Preparing agent installation location Checking for 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.

The artifact failed to apply.

Anyone has any idea on why I am getting this exception? please help me if you have any information

2

There are 2 best solutions below

0
On BEST ANSWER

After configuring WinRM before installing the artifacts, the issue is resolved.

1
On

(401) Unauthorized

This means that your token is not be get and used correctly. Just for test purpose, you can create a PAT with Full access scope to see if this works.

enter image description here

You need to check whether your token is correctly converted to Base64String in the script.

$token = "{PAT}"
$token = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($token)"))

In addition, if you tried the above two points and the problem still exists, you can share your script sample in the question for further investigation.