8

I have been trying to add an environment resource to our pipeline in azure devops but every time i install it with the powershell script they provide it asks me for tags. If i don't want to input tags it errors. If i choose to put in tags it errors. Either way it starts over every time and it will never successfully install. Anyone know if this is something on my end or on their end? I looked through the diagnostic file and the exceptions it is logging look like it's something that i can't fix but i have been having issues with this for over a week and thinking it was something that Microsoft would realize and patch. Now i'm wondering if there is something else i can do?

Powershell snippet

[2020-05-22 13:01:48Z ERR VisualStudioServices] POST request to https://DEVOPS_URL/24cca667-60da-4ba2-a323-4e05c46f3309/_apis/pipelines/environments/3/providers/virtualmachines failed. HTTP Status: InternalServerError, AFD Ref: Ref A: 56C7161B437D41698EBBDE7ACBF4CAA2 Ref B: ATAEDGE0918 Ref C: 2020-05-22T13:01:48Z [2020-05-22 13:01:48Z INFO CommandSettings] Flag 'unattended': 'False' [2020-05-22 13:01:48Z ERR Terminal] WRITE ERROR (exception): [2020-05-22 13:01:48Z ERR Terminal] Microsoft.VisualStudio.Services.WebApi.VssServiceResponseException: TF400898: An Internal Error Occurred. Activity Id: acb8a36a-e602-4988-b3f7-8fbeecd729e0. ---> System.NullReferenceException: TF400898: An Internal Error Occurred. Activity Id: acb8a36a-e602-4988-b3f7-8fbeecd729e0. --- End of inner exception stack trace --- at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.HandleResponseAsync(HttpResponseMessage response, CancellationToken cancellationToken) at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync(HttpRequestMessage message, HttpCompletionOption completionOption, Object userState, CancellationToken cancellationToken) at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync[T](HttpRequestMessage message, Object userState, CancellationToken cancellationToken) at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync[T](HttpMethod method, IEnumerable1 additionalHeaders, Guid locationId, Object routeValues, ApiResourceVersion version, HttpContent content, IEnumerable1 queryParameters, Object userState, CancellationToken cancellationToken) at Microsoft.VisualStudio.Services.Agent.Listener.Configuration.EnvironmentVMResourceConfigProvider.AddAgentAsync(AgentSettings agentSettings, TaskAgent agent, CommandSettings command) at Microsoft.VisualStudio.Services.Agent.Listener.Configuration.ConfigurationManager.ConfigureAsync(CommandSettings command)

Sam North
  • 118
  • 1
  • 5
  • I couldn't reproduce it . But according to your description, this issue exists in the "add tag" step. Maybe you could add the `--unattended ` in the config.cmd command. For example: `.\config.cmd --environment --environmentname "xxx" --agent xx --unattended --runasservice --work '_work' ... ` In this case , the "add tag" step will be skipped. If it still doesn't work, you could try the same steps in other network environment or machines. – Kevin Lu-MSFT May 25 '20 at 06:40
  • 3
    I find [a similar ticket](https://developercommunity.visualstudio.com/content/problem/1048111/addition-of-resource-to-environment-fails-for-user.html) on the Developer Community . It seems that many users have the same issue. This issue has been reported to Product Group. You can follow it and wait for a reply. – Kevin Lu-MSFT May 26 '20 at 08:52

2 Answers2

10

I was experiencing a similar error "Failed to add virtual machine resource. Linked environment pool is null."

Answer from Kevin Ross here: https://developercommunity.visualstudio.com/t/addition-of-resource-to-environment-fails-for-user/1048111

I resolved my error by following the below steps:

  1. Get the deployment pool ID from the environment URL enter image description here
  2. Find the deployment pool settings in the organization settings and navigate to the correct pool based on ID from step 1 enter image description here
  3. From the deployment pool settings, go to security and add the required user to administrator role or whatever role is required enter image description here
ToDevAndBeyond
  • 1,120
  • 16
  • 24
-1

We had the same problem, unfortunately in our case the deployment pool was missing entirely. Deleting the environment and recreating it solved the issue.

Further to this explanation, in another similar situation if you use the rest API to query the status of the resource, it will return an agent status of "0". This eventually was found to mean that the deployment target was not created even though the "resource" was added to the environment - no service was registered on the server. Deleting the resource and rerunning the config resolved that issue.

I'm still having occasional issues and created this question to track how to install the agent remotely which is how I encountered this problem in the first place. It includes a mostly functional script.

Powershell Script to install azure devops agent remotely is unreliable

Justin
  • 1,303
  • 15
  • 30