TeamCity MetaRunner for creating Release Annotations in Azure Application Insights
We're currently working on a project to migrate a customer from AWS to Azure. As always, we like to put a Continuous Delivery pipeline at the heart of the project to ensure there is zero friction pushing out changes across all dev, test and production environments.
Two years ago I wrote about the process we used with a previous customer, who used NewRelic for application monitoring. In our current project the customer is using Azure Application Insights, which has just released support for Release Annotations, which allows you to notify Application Insights that a deployment has occurred.
To make it easy to use, I wrapped the Release Annotations PowerShell Script with a TeamCity MetaRunner which allows you to pass in values from the build server (build number, user who triggered deployment, git hash etc) into the script:
By adding the Release Annotation as a build step, Application Insights is automatically notified every time a deployment occurs. To view the Release Annotation, click the "Metrics Explorer" button and the annotation should be visible as a blue circle with an "i" in the centre. If you click this icon, the Release Annotation blade appears which contains the values passed in by TeamCity.
The data captured in the Release Annotation is just a property bag, and can be easily customised; simply add more fields into the MetaRunner configuration screen and add these to the $releaseProperties array and the values will pushed through to Application Insights.
The source code for the MetaRunner is available on GitHub.