从配置脚本向环境中的虚拟机资源添加标签
Add Tags to Virtual Machine Resource in an Environment from Config Script
有没有办法在使用配置脚本向环境添加虚拟机资源时添加标签?我知道您可以通过 运行 手动脚本时的交互式提示来完成,但我想自动执行配置过程。我基本上是在寻找与配置部署组时可用的功能类似的功能,您可以在其中将标签指定为脚本的参数。
official doc不提此相关信息:
You can add tags to the VM as part of the interactive PS registration
script. You can also add or remove tags from the resource view by
clicking on ... at the end of each VM resource on the Resources tab.
但是,因为它类似于在 Azure DevOps 中配置构建代理。当您检查配置脚本的代码时。
它也只是使用.\config.cmd
命令
.\config.cmd --environment --environmentname "TEST" --agent $env:COMPUTERNAME --runasservice --work '_work' --url 'https://xxx.visualstudio.com/' --projectname 'MyFirstProject' --auth PAT --token 6ct2r2pb7cd3cafuxi4lp5tfpkug7j6gg2yk------qgkqeaa; Remove-Item $agentZip;
所以我们可以简单地运行 .\config.cmd --help
在powershell中查看这个命令的帮助信息。
查看详细信息后,它只提到如何通过选项添加部署组标签。没有任何与环境中虚拟机资源标签相关的信息。
恐怕无法在配置脚本中自动添加标签。
有没有办法在使用配置脚本向环境添加虚拟机资源时添加标签?我知道您可以通过 运行 手动脚本时的交互式提示来完成,但我想自动执行配置过程。我基本上是在寻找与配置部署组时可用的功能类似的功能,您可以在其中将标签指定为脚本的参数。
official doc不提此相关信息:
You can add tags to the VM as part of the interactive PS registration script. You can also add or remove tags from the resource view by clicking on ... at the end of each VM resource on the Resources tab.
但是,因为它类似于在 Azure DevOps 中配置构建代理。当您检查配置脚本的代码时。
它也只是使用.\config.cmd
命令
.\config.cmd --environment --environmentname "TEST" --agent $env:COMPUTERNAME --runasservice --work '_work' --url 'https://xxx.visualstudio.com/' --projectname 'MyFirstProject' --auth PAT --token 6ct2r2pb7cd3cafuxi4lp5tfpkug7j6gg2yk------qgkqeaa; Remove-Item $agentZip;
所以我们可以简单地运行 .\config.cmd --help
在powershell中查看这个命令的帮助信息。
查看详细信息后,它只提到如何通过选项添加部署组标签。没有任何与环境中虚拟机资源标签相关的信息。
恐怕无法在配置脚本中自动添加标签。