AUTOMATE AZURE DEVOPS WORK ITEM UPDATES WITH AZURE FUNCTIONS AND THE AZURE DEVOPS API
OBJECTIVE.. I use Azure DevOps Boards for agile project management, allowing me to plan, track, and discuss automation and DevOps tasks. I also create reporting dashboards from the data within the work items. One such metric I report on is how much time we save when implementing a new automation. To do this, I have a field called “Estimated Manual Time (min)” and “Annual Occurrences“. The first field is how long it takes someone to do the task manual right now, and the second field is how many times per year this certain task is done. The last field is “Time Saved Annually (hours),” which takes the first field, multiply it by the second field, and then divides that number by 60.
In this article, I will show you how I automated the “Time Saved Annually (hours)” value whenever a new work item is created or the first or second field’s value changes.
GET A PERSONAL ACCESS TOKEN FROM AZURE DEVOPS
1) First, we must get a personal access token (PAT) from Azure DevOps (AzDo) to use it to interact with the API.
2) From there, click “Personal Access Tokens.”.
3) Give your PAT a name, which organization it will have access to, and an expiration. For permissions, give it Read & Write for work items.
4) Take note of the PAT and copy it for later.
SETTING UP WORK ITEM FIELDS
In my example, I created two custom fields:
1. Estimated Manual Time (min)
2. Annual Occurrences
Task Details
The automation will retrieve both field values, multiply them, and divide by 60 to get how much time is saved annually in hours. To do this, I need to get the field name. The field name (don’t confuse the field name and the label name) will most likely be “custom.[fieldnamenospace]”
If I go to my Project Properties > Settings > Processes, I can view the name of each field. The example below shows the Estimated Manual Time (min) field name:
The latest LTS Node version is already installed on the agent and is managed by Microsoft. If you are using a specific version of Node in your project then use this task to specify the exact version you want to use.
Contact
Etecnest as your trusted IT and Cloud Service Provider. We are dedicated to delivering innovative solutions that propel your business into the digital future. Whether you are seeking robust IT services, comprehensive cloud solutions, or a tailored combination of both, we are here to meet your unique needs.