Skip to main content

Microsoft Azure DevOps Server version tags

Tell Coralogix when a new build ships, straight from your Azure DevOps Server pipeline. A service hook on build completion creates a version tag, which is what version benchmark reports compare behavior across.

What you need ​

  • Access to your Azure DevOps Server team project's settings.
  • A personal or team API key with the CICDIntegration preset. Presets pick up new permissions automatically; individual permissions have to be maintained by hand.
  • The Azure DevOps version tags endpoint for your Coralogix domain. Use the domain selector at the top of this page to resolve it: https://api./api/v1/external/tfs?application=YOUR_APPLICATION_NAME&subsystem=YOUR_SUBSYSTEM_NAME&name=YOUR_TAG_NAME
PresetActionsGrants
CICDIntegrationVERSION-BENCHMARK-TAGS:READ
VERSION-BENCHMARKS-REPORTS:READ
VERSION-BENCHMARK-TAGS:UPDATE
View version benchmark tags
View version benchmark reports
Modify version benchmark tags

Create the service hook ​

1.
Open service hooks

Sign in to Azure DevOps Server, select your team project, then Settings, then Service hooks.

2.
Add a web hook

Select Add new service hooks, then Web Hooks.

3.
Trigger on completed builds

Select Build Completed as the trigger, set Build status to Succeeded, and select Next. Add any further filters you want.

4.
Point it at Coralogix

Enter the Azure DevOps version tags endpoint for your domain, with the query parameters below.

ParameterWhat to enter
applicationRequired. Must match your logs application name exactly
subsystemMust match your logs subsystem name. Separate multiple names with commas
5.
Authorize the request

Add a header carrying your API key, then select Finish.

Authorization: Bearer <cx_api_key>

Send deployment events​

Send each deployment to the Coralogix ops events API as well, and it appears as an event marker on your APM charts, so you can line a latency or error-rate change up with the pipeline run that caused it. This uses a step in a YAML pipeline running on a Linux agent.

What you need​

  • A Send Your Data API key with the OpsEvents role preset. The ops events API rejects any other key type or preset, including the CICDIntegration key used for version tags, with 403 Forbidden.
  • The ops events endpoint for your Coralogix domain. Use the domain selector at the top of this page to resolve it: https://api./v1/ops-events
  • The service name and environment exactly as they appear in APM. They must equal the service.name and deployment.environment.name resource attributes your service reports. An event that matches no service is still stored, but appears only under All events.

Add the step to your pipeline​

Store the API key as a secret pipeline variable named CX_OPS_EVENTS_API_KEY. Azure Pipelines does not expose secret variables to scripts automatically, so the step maps it into env. Add the step as the last step of your deployment job; condition: always() makes it run when the deployment fails too, and Agent.JobStatus carries the result.

- bash: |
case "$AGENT_JOBSTATUS" in
Succeeded|SucceededWithIssues) STATUS=PIPELINE_RESULT_STATUS_SUCCESS ;;
Canceled) STATUS=PIPELINE_RESULT_STATUS_CANCELLATION ;;
*) STATUS=PIPELINE_RESULT_STATUS_FAILURE ;;
esac
case "$BUILD_SOURCEBRANCH" in
refs/tags/*) REF_TYPE=VCS_REF_TYPE_TAG ;;
*) REF_TYPE=VCS_REF_TYPE_BRANCH ;;
esac
curl -sS --fail-with-body -X POST 'https://api.eu2.coralogix.com/v1/ops-events' \
-H "Authorization: Bearer $CX_API_KEY" \
-H 'Content-Type: application/json' \
--data-binary @- <<EOF
{
"opsEvent": {
"timestamp": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
"description": "$SERVICE_NAME $BUILD_SOURCEVERSION deployed to $ENVIRONMENT",
"attributes": {
"service": { "name": "$SERVICE_NAME" },
"environment": "$ENVIRONMENT"
},
"cdEvent": {
"system": "CD_SYSTEM_AZURE_DEVOPS",
"pipeline": {
"name": "$BUILD_DEFINITIONNAME",
"run": {
"id": "$BUILD_BUILDID",
"url": "${SYSTEM_COLLECTIONURI}${SYSTEM_TEAMPROJECTID}/_build/results?buildId=$BUILD_BUILDID"
},
"result": { "status": "$STATUS" }
},
"vcs": {
"type": "$REF_TYPE",
"repository": { "name": "$BUILD_REPOSITORY_NAME", "url": "$BUILD_REPOSITORY_URI" },
"ref": { "head": { "name": "$BUILD_SOURCEBRANCHNAME", "revision": "$BUILD_SOURCEVERSION" } }
}
}
}
}
EOF
displayName: Send deployment event to Coralogix
condition: always()
env:
CX_API_KEY: $(CX_OPS_EVENTS_API_KEY)
SERVICE_NAME: <service_name>
ENVIRONMENT: <environment>

Replace <service_name> and <environment> with the values from APM.

A successful request returns the server-generated event id. The marker then appears on the service's APM charts; see Event markers for how to show it and for the full field reference. The API rejects a timestamp more than 24 hours from the time the request is received, so send the event from the pipeline as it runs rather than backfilling.

Last updated on
On this page
Was this page helpful?