Add continuous monitoring to your release pipeline
Azure Pipelines integrates with Azure Application Insights to allow continuous monitoring of your DevOps release pipeline throughout the software development lifecycle.
With continuous monitoring, release pipelines can incorporate monitoring data from Application Insights and other Azure resources. When the release pipeline detects an Application Insights alert, the pipeline can gate or roll back the deployment until the alert is resolved. If all checks pass, deployments can proceed automatically from test all the way to production, without the need for manual intervention.
Configure continuous monitoring
In Azure DevOps, select an organization and project.
On the left menu of the project page, select Pipelines > Releases.
Drop down the arrow next to New and select New release pipeline. Or, if you don't have a pipeline yet, select New pipeline on the page that appears.
On the Select a template pane, search for and select Azure App Service deployment with continuous monitoring, and then select Apply.
In the Stage 1 box, select the hyperlink to View stage tasks.
In the Stage 1 configuration pane, complete the following fields:
Parameter Value Stage name Provide a stage name, or leave it at Stage 1. Azure subscription Drop down and select the linked Azure subscription you want to use. App type Drop down and select your app type. App Service name Enter the name of your Azure App Service. Resource Group name for Application Insights Drop down and select the resource group you want to use. Application Insights resource name Drop down and select the Application Insights resource for the resource group you selected.
To save the pipeline with default alert rule settings, select Save at upper right in the Azure DevOps window. Enter a descriptive comment, and then select OK.
Modify alert rules
Out of box, the Azure App Service deployment with continuous monitoring template has four alert rules: Availability, Failed requests, Server response time, and Server exceptions. You can add more rules, or change the rule settings to meet your service level needs.
To modify alert rule settings:
In the left pane of the release pipeline page, select Configure Application Insights Alerts.
In the Azure Monitor Alerts pane, select the ellipsis ... next to Alert rules.
In the Alert rules dialog, select the drop-down symbol next to an alert rule, such as Availability.
Modify the Threshold and other settings to meet your requirements.
Select OK, and then select Save at upper right in the Azure DevOps window. Enter a descriptive comment, and then select OK.
Add deployment conditions
When you add deployment gates to your release pipeline, an alert that exceeds the thresholds you set prevents unwanted release promotion. Once you resolve the alert, the deployment can proceed automatically.
To add deployment gates:
On the main pipeline page, under Stages, select the Pre-deployment conditions or Post-deployment conditions symbol, depending on which stage needs a continuous monitoring gate.
In the Pre-deployment conditions configuration pane, set Gates to Enabled.
Next to Deployment gates, select Add.
Select Query Azure Monitor alerts from the dropdown menu. This option lets you access both Azure Monitor and Application Insights alerts.
Under Evaluation options, enter the values you want for settings like The time between re-evaluation of gates and The timeout after which gates fail.
View release logs
You can see deployment gate behavior and other release steps in the release logs. To open the logs:
Select Releases from the left menu of the pipeline page.
Select any release.
Under Stages, select any stage to view a release summary.
To view logs, select View logs in the release summary, select the Succeeded or Failed hyperlink in any stage, or hover over any stage and select Logs.
For more information about Azure Pipelines, see the Azure Pipelines documentation.