Search code examples
azure-devopsvirtual-machineenvironment

Failed to add virtual machine resource. Linked environment pool is null


We have a new VM and want to add it to our Azure DevOps Environment. https://learn.microsoft.com/en-us/azure/devops/pipelines/process/environments-virtual-machines?view=azure-devops

When we execute the powershell script on the new VM to register it, we get the following error: "Failed to add virtual machine resource. Linked environment pool is null."

more permissions: add user to production environment group


Solution

  • Failed to add virtual machine resource. Linked environment pool is null.

    The issue could be related to the permissions of the Environment.

    You can try to grant the user Administrator Role in the following two security settings.

    1.Navigate to Pipelines -> Environments -> Target Environment -> Click three dots -> Security.

    enter image description here

    2.You can find the environment pool id in the environment URL.

    For example:

    enter image description here

    Then you can navigate to Organization Settings -> Deployment Pools -> Find the pool based on the environment pool id -> Security.

    enter image description here

    Then you can grant the Administrator role to the target user.

    Finally, you can try to re-create the Agent Install script and check if it can work.