If you have ever worked with Azure DevOps and Azure PowerShell, you most likely also banged your head into the wall trying to get the release pipeline to use the latest version. I have run into this a few times myself, and this time around, I choose to stick with it until I found a solution, and I did. Most times, the answer was way more straightforward than I thought, and in this post, I will show you step by step how to do it.

Go to “Pipelines” and click on “Releases,” and then mark the pipeline that needs a specific version of the Az PowerShell module.

On the top right side of the page, click on “Edit”.

In the middle of the page, click on the job link for the stage you need changing.

Insert a PowerShell task, name it something like “Install PowerShell module Az 5.3.0”.

Choose an “inline” script and paste in the code below. Remember to type in the version you need, which is probably newer than when I wrote this article.
“install-module -Name Az -MinimumVersion 5.3.0 -AllowClobber -Force”

Next, select your “Azure PowerShell” task.

In the bottom section of the task, select “Specify other version” and in the text field, type in the desired version, for instance, “5.3.0”.

Save the pipeline, and you are now using the version of the Az PowerShell module you wanted to use.

I hope this will help you in getting your pipeline to fulfill your needs.

/Martin