2 min readMar 27, 2023
–
Press enter or click to view image in full size
Azure Devops + Powershell
In this short article, I will show how we can pull the all the deployment information from Azure DevOps Organization using API calls. This is useful when you wanted to extract data about deployments for reporting purposes. Let’s see how it is done
Pre-requisites
- Personal Access Token
- Powershell/Powershell core
- MS Teams
Configuration
- Generate your PAT Tokens from your Azure DevOps Organization. The configuration steps are mentioned here
- Create MS Teams Incoming webhook connector, as this enables to pass the inform…
2 min readMar 27, 2023
–
Press enter or click to view image in full size
Azure Devops + Powershell
In this short article, I will show how we can pull the all the deployment information from Azure DevOps Organization using API calls. This is useful when you wanted to extract data about deployments for reporting purposes. Let’s see how it is done
Pre-requisites
- Personal Access Token
- Powershell/Powershell core
- MS Teams
Configuration
- Generate your PAT Tokens from your Azure DevOps Organization. The configuration steps are mentioned here
- Create MS Teams Incoming webhook connector, as this enables to pass the information and get it on MS Teams Channel. Steps are explained here
3. The PS is written based on the criteria that you have running pipelines with stages and environment mapped, which looks something like below
Press enter or click to view image in full size
Azure PipelinesEnvironments in Azure DevOps
4. PowerShell’s script is described below. There are 4 parameters we are passing to the script.
Get Renjith Ravindranathan’s stories in your inbox
Join Medium for free to get updates from this writer.
a. PAT Token b. Organization name c. Project name/id d. MS Teams Webhook
When it starts execution, the variables would be assigned and read. In the start, it will fetch the data from build definitions endpoint and list out all the build definitions. Then it starts a loop to go through all the build definitions and looks for latest build instance of the pipelines. Thirdly, it would iterate through the Environments — stages that you defined and do a comparison and extract out the data to CSV
Finally, the output of the script(csv), will be sent to the MS Teams channel. Well, that’s all for now. Thanks for reading.
In case of any queries, please feel free to connect with me via the below social links