Azure Deployment Manager (ADM) allows you to manage a staged roll-out for safely deploying complex applications.
Use Datadog to create a health check for the Azure Deployment Manager, and to stop your deployment if issues are detected.
To use Datadog as a health check for ADM, you need an active Datadog account and an active instance of Azure Deployment Manager.
<API_KEY>
and <APP_KEY>
with your Datadog API and application keys. Create a section in resources
for each monitor (or composite monitor) you just created and replace <MONITOR_ID>
with the monitor IDs. It is possible to add multiple checks within a health check step, but Datadog recommends you create one check per health check step, and then create additional health check steps for each composite monitor. If you are setting the check with something besides a composite monitor, be sure to update the regex
accordingly.The following is the part of the Azure Deployment Manager rollout template that is considered the health check.
{
"healthChecks": [
{
"name": "datadogCompositeMonitor1",
"request": {
"method": "GET",
"uri": "https://api.datadoghq.com/api/v1/monitor/<MONITOR_ID>?application_key=<APP_KEY>",
"authentication": {
"type": "ApiKey",
"name": "apikey",
"in": "Query",
"value": "<API_KEY>"
}
},
"response": {
"successStatusCodes": ["200"],
"regex": {
"matches": ["\"overall_state\"\\s*:\\s*\"OK\""],
"matchQuantifier": "All"
}
}
}
]
}
The following is the part of the Azure Deployment Manager rollout template that is considered the health check step.
{
"apiVersion": "2018-09-01-preview",
"type": "Microsoft.DeploymentManager/steps",
"name": "datadogHealthCheckStep1",
"location": "Central US",
"tags": {},
"properties": {
"stepType": "healthCheck",
"attributes": {
"waitDuration": "PT5M",
"maxElasticDuration": "PT10M",
"healthyStateDuration": "PT10M",
"type": "REST",
"properties": {
"healthChecks": [
{
"name": "datadogCompositeMonitor1",
"request": {
"method": "GET",
"uri": "https://api.datadoghq.com/api/v1/monitor/<MONITOR_ID>?application_key=<APP_KEY>",
"authentication": {
"type": "ApiKey",
"name": "apikey",
"in": "Query",
"value": "<API_KEY>"
}
},
"response": {
"successStatusCodes": ["200"],
"regex": {
"matches": ["\"overall_state\"\\s*:\\s*\"OK\""],
"matchQuantifier": "All"
}
}
}
]
}
}
}
}
The following is a full template for an Azure Deployment Manager rollout step.
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"variables": {},
"resources": [
{
"apiVersion": "2018-09-01-preview",
"type": "Microsoft.DeploymentManager/steps",
"name": "datadogHealthCheckStep1",
"location": "Central US",
"tags": {},
"properties": {
"stepType": "healthCheck",
"attributes": {
"waitDuration": "PT5M",
"maxElasticDuration": "PT10M",
"healthyStateDuration": "PT10M",
"type": "REST",
"properties": {
"healthChecks": [
{
"name": "datadogCompositeMonitor1",
"request": {
"method": "GET",
"uri": "https://api.datadoghq.com/api/v1/monitor/<MONITOR_ID>?application_key=<APP_KEY>",
"authentication": {
"type": "ApiKey",
"name": "apikey",
"in": "Query",
"value": "<API_KEY>"
}
},
"response": {
"successStatusCodes": ["200"],
"regex": {
"matches": [
"\"overall_state\"\\s*:\\s*\"OK\""
],
"matchQuantifier": "All"
}
}
}
]
}
}
}
}
]
}
When performing the health check step for a phase of the rollout, Azure Deployment Manager queries the Datadog Monitor API for the status of the composite monitor identified in the health check step for that phase of the deployment.
Azure Deployment Manager parses the response using the regex provided in the template to identify if it contains the phrase overall_status: OK
.
If overall_status: OK
is found, the check is considered healthy. If the status is Warn
, No Data
, or Alert
, then the check is considered unhealthy, and Azure Deployment Manager stops the deployment.
The Azure Deployment Manager does not report any metrics.
The Azure Deployment Manager does not include any events.
The Azure Deployment Manager does not include any service checks.
Need help? Contact Datadog support.