Azure DevOps(VSTS)-在托管代理上使用Azure Az PowerShell

时间:2019-02-15 09:49:06

标签: azure powershell azure-devops azure-cli az

我们将Azure DevOps与托管的VS2017构建代理一起使用。我们想使用新的Az PowerShell module。但是,VS2017 hosted build agent上已安装AzureRM。文档指出You should not install Az side-by-side with AzureRM. Remove all AzureRM modules before installing Az.,这确实是必要的,因为两者存在冲突。也没有Az PowerShell构建任务。

问题是,如何使用Azure DevOps托管的VS2017构建代理中的Azure Az PowerShell模块?

2 个答案:

答案 0 :(得分:1)

我想答案是-您暂时不知道。 因为您无权删除天蓝色的powershell模块。好的,显然您可以做到。

使其工作的另一种方法是使用Docker容器作为构建代理(在托管代理内部)。显然可以有Az模块。

答案 1 :(得分:0)

它们不能并排安装,但是一个可以安装在PowerShell(非核心)中,另一个可以安装在PowerShell Core中。

在您指定的文档中的comments中:

  

问题:文档中说不要并排安装模块,但是是否有任何原因导致我们无法在同一台计算机上的PowerShell 5.1中运行AzureRM和在PowerShell Core中运行AZ?

     

答案:不,完全没有理由。实际上,我们正在考虑将其建议为对AzureRM脚本进行大量投资的高级方案