How to Automatically Create a Bug from an Azure Alert
Collaboration between the operations and the development team is critical to any organization. In this post, I will show a sample implementation of an Azure Alert that automatically creates a bug in Azure DevOps.
Sample Scenario
I have a simple API deployed in an Azure App Service. If the response time exceeds 1 second, then something is very wrong and I would live the dev team to investigate and optimize the code. In this case, a bug should be created in Azure Boards and assigned to the bug triage lead.
Sample Implementation
The Logic App
The first thing to do is to create a logic app which the alert will call. To start, simply choose the Azure Monitor – Metrics Alert Handler from the templates section.
Then add a DevOps Create Work Item action to the logic app. The final logic app will look like this.
This is a very simple implementation to prove the point. In a real-world scenario, additional conditions may be added to the logic app to determine if the bug work item creation is necessary.
The Azure Alert
To monitor the response time, create an alert that triggers when the app has an average response time (metric signal) of >1 second over the last 5 minutes. Modify the parameters according to your scenario.
Finally, create an action group with Action Type = Logic App. Click Edit details to select the logic app that you just created.
Test
To test this, I injected sleep/wait commands to my API so that it will respond in >1 seconds. After deployment, I see that alerts are getting fired.
And finally, I see that a bug is created in my kanban board
Conclusion
That’s it! You just learned how to create a quick and easy but very impactful way to automate and improve operations and developer collaboration through Azure Alerts and Logic Apps.