简体   繁体   中英

Azure DevOps (VSTS) - using Azure Az PowerShell on a Hosted Agent

We use Azure DevOps with a hosted VS2017 build agent. We would like to use the the new Az PowerShell module . However, the VS2017 hosted build agent has AzureRM installed on it. The documentation states You should not install Az side-by-side with AzureRM. Remove all AzureRM modules before installing Az. and this indeed is necessary because the two conflict. There is also no Az PowerShell build task.

So the question is, how do I use the Azure Az PowerShell module from an Azure DevOps hosted VS2017 build agent?

I suppose the answer is - you dont (for the time being). Because you wont have permissions to remove the azure powershell module . Ok, apparently you can do that.

Another way to make it work, use a docker container as a build agent (inside hosted agent). That can have Az module, obviously.

They cannot be installed side by side, however one can be installed in PowerShell (non core), and the other in PowerShell Core.

From the comments in the docs you specified:

Question: The document says not to install the modules side-by-side but is there any reason that we cannot run AzureRM in PowerShell 5.1 and AZ in PowerShell Core on the same machine?

Answer: No, no reason at all. In fact we are thinking of suggesting this as an advanced scenario for those with a substantial investment in AzureRM scripts

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM