Lutando
Lutando

Reputation: 5010

Installing Az 2.8.0 Powershell Module on Azure Dev Ops agent

I am using Azure Dev Ops build agents to do all my CI/CD. I am having trouble installing Az Powershell Module version 2.8.0 on the build agent. I need that particular version because a lot of new APIs have been released on that version when compared to 2.6.0. Installing 2.8.0 on the build agent before running my build process results in failure. As you can see here 2.8.0 is not yet installed on the base images for these agents. If anyone has some tips on how I can consume this specific module that would be really helpful. In the mean time I have opened an issue to add the version

Upvotes: 2

Views: 1811

Answers (1)

Mengdi Liang
Mengdi Liang

Reputation: 18958

Use below script in Powershell task to install Az 2.8.0 into Hosted linux agent:

Install-Module -Name Az -RequiredVersion 2.8.0 -Force -AllowClobber 

Get-InstalledModule #Just print out the details to confirm whether `Az 2.8.0` has been installed successfully

enter image description here

You can see Az 2.8.0 has been installed into hosted agent successfully.

Just one thing you should pay attention to, after the pipeline finished, our server will recycle the image of the currently used host agent. And the system will obtain a brand new agent image when you re-run the pipeline. So, this powershell task must be executed in every pipeline to let the environment satisfied your requirements.

Upvotes: 2

Related Questions