How to generate a Release Summary with PowerShell and Azure Pipelines

I was recently asked to start sending an email at the end of every sprint, listing the details of our official stable builds. The problem is that I don’t like writing emails, so I wrote a release pipeline PowerShell script instead.

I will show you how to get all the relevant information for the release summary, but will not go into the details of sending the email itself here. I’ll leave that as an exercise for you, perhaps you can try to use SendGrid for that and tell me how it goes.

Our starting point is that I have two products, each of them with an existing build pipeline. For the purpose of this tutorial, I just created two blank builds for two fictional apps. However, I want you to notice the different version number for each app in the screenshot below.

We start from 2 existing pipelines

Those version numbers are the ones we need to publish to our stakeholders at the end of each sprint cycle. Let’s head over to the release pipelines now and click on the ‘new pipeline’ button.

Start with an empty job:

Start with an empty job

Which should produce the following result:

New, empty release pipeline

Now we need to add the two artifacts that are produced by the builds we saw earlier. Click the +Add button:

Choosing the artifact source

Select any one of them, and more configuration options will be shown.

Artifact setup

Most of the time you would want to always use the latest build, but you have various options for selecting an earlier or a specific version. Note that you will be prompted to confirm the build version anyway when you actually run the release pipeline at the end of this tutorial. For the source alias, I chose a simpler name like BlueYonder, since long names and spaces have caused issues for me in the past.

We can now click the Add button, and proceed to do the same procedure for the other app. Once ready, we should end up with two artifacts.

2 artifacts successfully added

Add this point, just save and create a release. I know we are not ready yet, but trust me just go ahead and create it.

Save, create release buttons

We can now see that the release is created.

Status shows that the release is created

Soon it will be queued and run.

Click on the release link as shown above, and then on the next screen, click the Logs button to view the logs. Some mouse-hovering ninja tricks are required to see the Logs button.

Release pipeline result

On the next page, select the job initialisation log:

Choosing to view the job initialisation log

This will show us, amongst other things, all the environment variables that were initialised for this job. Here I can find the variables that are holding the build information that I need. Look, there’s even my name down there. Isn’t that lovely! I can now sign the summary with the name of the person who triggered this release. So make a note of all the variables you need, or just keep it in another tab for further reference.

Find all of the variable values

We are now ready for the next step and add some code. Go back to the release configuration page and click on the link that says ‘1 job, 0 task’. This will open the Tasks configuration window.

Adding a new agent job

Note that here I already changed the stage name, which means I am at peace with my inner self and can proceed to add the agent job with the click of the + button. This will allow me to select the job type from the panel on the right.

PowerShell extension for Azure DevOps pipelines

Type ‘powershell’ to filter the results, and click on the Add button. You actually need to hover on the PowerShell job for the button to magically appear.

Configure the script as an inline script. Then enter the code shown below. Make sure to change <Your_Azure_DevOps_Organisation> and <Your_Azure_DevOps_Project> with your own organisation and project ids accordingly.

Adding the PowerShell inline script

Write-Host "Hi,"
Write-Host "Today we are pleased to announce the latest stable release of our awesome apps!"
Write-Host "WingTip Toys Collectors App v$(Release.Artifacts.Wingtiptoys.BuildNumber):<Your_Azure_DevOps_Organisation>/<Your_Azure_DevOps_Project>/_build/results?buildId=$(Release.Artifacts.Wingtiptoys.BuildId)&view=artifacts&type=publishedArtifacts."
Write-Host "Blue Yonder Flight App v$(Release.Artifacts.BlueYonder.BuildNumber):<Your_Azure_DevOps_Organisation>/<Your_Azure_DevOps_Project>/_build/results?buildId=$(Release.Artifacts.BlueYonder.BuildId)&view=artifacts&type=publishedArtifacts."
Write-Host "Best regards,"
Write-Host "$(Release.RequestedFor)"

Save and create another release, and this time we should see the summary with all the juicy details.

The output form the PowerShell script shows the required information

So here we are. I just showed you how we can obtain all the required information, which means we can go to the next step and send it as an email. However, this post is already quite long, and as I said at the beginning will leave it as an exercise for you.

Header image adapted from GalleryBritto / CC BY-SA (

Buy me a coffee Buy me a coffee


Add your comments