title: Tag Azure DevOps Agents when deploying to an Environment VM Resource
body: <p>I want to install an azure agent onto my VM and have it appear as an Environment resource as described here: <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/process/environments-virtual-machines?view=azure-devops" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/devops/pipelines/process/environments-virtual-machines?view=azure-devops</a> . </p>
  
  <p>This works if you run the script interactively, however when I use <code>--unattended</code> (as described here: <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/v2-windows?view=azure-devops#unattended-config" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/v2-windows?view=azure-devops#unattended-config</a> ) there is no longer a way to specify tags. The <code>--addDeploymentGroupTags</code> option doesn't work with Environment agents. </p>
  
  <p>How do I automate the adding of a VM as an environment resource with tags?</p>