1
votes

I noticed that release annotations are now added for a couple of our Application Insights instances when we execute our release pipelines. We have not done any of the things mentioned in the article. Where are those annotations coming from?

It seems to happen only on our application release pipelines, not infrastructure. Most of our applications run on App Service, but not all have release annotations.

1

1 Answers

1
votes

The Azure App Service Deploy Task automatically creates release annotations.

The only prerequisite is that the App Service has a valid APPINSIGHTS_INSTRUMENTATIONKEY in its AppSettings.

AppService Deploy Logs

This is the relevant code block:

https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/Common/AzureRmDeploy-common/operations/ReleaseAnnotationUtility.ts

export async function addReleaseAnnotation(endpoint: AzureEndpoint, azureAppService: AzureAppService, isDeploymentSuccess: boolean): Promise<void> {
    try {
        var appSettings = await azureAppService.getApplicationSettings();
        var instrumentationKey = appSettings && appSettings.properties && appSettings.properties.APPINSIGHTS_INSTRUMENTATIONKEY;
        if(instrumentationKey) {
            let appinsightsResources: ApplicationInsightsResources = new ApplicationInsightsResources(endpoint);
            var appInsightsResources = await appinsightsResources.list(null, [`$filter=InstrumentationKey eq '${instrumentationKey}'`]);
            if(appInsightsResources.length > 0) {
                var appInsights: AzureApplicationInsights = new AzureApplicationInsights(endpoint, appInsightsResources[0].id.split('/')[4], appInsightsResources[0].name);
                var releaseAnnotationData = getReleaseAnnotation(isDeploymentSuccess);
                await appInsights.addReleaseAnnotation(releaseAnnotationData);
                console.log(tl.loc("SuccessfullyAddedReleaseAnnotation", appInsightsResources[0].name));
            }