Continuous monitoring Azure DevOps Release

0 votes

I need to create a setup where I deploy a "Webapp for containers" but I want to build in some checks via Azure Monitor. My idea is to deploy the web app and then have a gate that checks an azure monitor alert set with availability. When the availability check fails then it should rollback.

The documentation states "When the release pipeline detects an Application Insights alert, the pipeline can gate or roll back the deployment until the alert is resolved", but I don't know how to configure this in azure DevOps.

I have an AppService Plan and a web app running. I also created an Application Insights instance and I enabled continuous monitoring through the "Azure App Service manage" task. The alert I created is:

az monitor metrics alert create -n 'Availability' -g ${RG_NAME} --scopes "${APP_INSIGHTS_PROD}" \
--condition 'avg availabilityResults/availabilityPercentage < 90' \
--description "created from Azure DevOps"

As Post Deployment-Condition I enabled the Gates and I configured it to check for the Availability alert, which works. When I adjust something to make the app fail on purpose the Gate works and fails the Stage eventually. I also enabled the auto-redeploy to deploy the last successful deployment but that does not do anything because the actual deployment task was successfully finished.. just the gate failing and failing the stage.

Mar 18, 2022 in Other DevOps Questions by Kichu
• 19,040 points
1,117 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes
I build the Release via the UI, to make it work I had to create the pipeline via YAML. With deployment jobs, I could use environments and in the Azure DevOps UI, you can configure the environment to add a check. Query Azure Monitor Alerts is one of the available checks to add for an environment. The check is done at the beginning of a job so I created a separate deployment job that refers to the environment with the Query Azure Monitor Alert check. After that,  I created another job that has a dependson and condition which will only run if the query alert job failed. And that job will swap slots.
answered Mar 20, 2022 by narikkadan
• 63,600 points

edited Mar 5

Related Questions In Other DevOps Questions

0 votes
0 answers
0 votes
0 answers
0 votes
0 answers

Azure monitoring Data Collection Rules(DCR) through DevOps

A monitoring agent is installed through Powershell ...READ MORE

Apr 17, 2022 in Other DevOps Questions by Kichu
• 19,040 points
536 views
0 votes
2 answers

Which is better azure devops or aws devops?

Azure DevOps, a part of Microsoft's cloud ...READ MORE

answered Jan 8, 2024 in Cloud Computing by anonymous
• 700 points
2,399 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP