Home > Software engineering >  Provide Application Insights Agent path to Azure Functions when deployed via Azure DevOps
Provide Application Insights Agent path to Azure Functions when deployed via Azure DevOps

Time:06-21

We deploy Azure Function using the docker image. The application insights agent is manually provided as specified here: Java - Azure Application Insights Dynamic Tracing not working with docker images

This works fine when deployed via mvn azure-functions:deploy. But doesn't work when deployed using azure dev-ops. These are the steps:

  1. We create the docker image and publish it to ACR
  2. We then provide the docker image to the below task:

Here is the ADO task

- task: AzureFunctionAppContainer@1
  displayName: 'Azure Function App on Container Deploy: $(orchestratorfunctionappName)'
  inputs:
    azureSubscription: '${{ parameters.environments.serviceConnectionId }}'
    appName: appName
    imageName: 'appImage'

There is no clear documentation to provide the JAVA_OPTS path

CodePudding user response:

Below worked for me:

- task: AzureFunctionAppContainer@1
  displayName: 'Azure Function App on Container Deploy: $(orchestratorfunctionappName)'
  inputs:
    azureSubscription: '${{ parameters.environments.serviceConnectionId }}'
    appName: appName
    imageName: 'appImage'
    appSettings: '-JAVA_OPTS "-javaagent:/home/site/wwwroot/applicationinsights-agent.jar"'

The agent needs to exist at that path on the image. (ref)

  • Related