You can configure Azure Functions monitoring for Windows by instrumenting your Azure Function with the New Relic .NET agent, Python agent, or Node.js agent. This allows you to monitor the performance and health of your Azure Functions in real-time.
Prerequisites
- Ensure your Azure Function meets our compatibility and requirements.
- Link your Azure account to New Relic. For more information, refer to Azure integration.
Configure Azure Functions monitoring
You can configure Azure Functions monitoring for different environments and various combinations of runtimes and deployment methods:
In the root directory of your Node.js Azure Function App project, install the New Relic agent as a project dependency by running:
npm i newrelicTo ensure that the New Relic agent is installed with your project dependencies during the Azure deployment process, set the
SCM_DO_BUILD_DURING_DEPLOYMENT
totrue
in your application settings by running:az functionapp config appsettings set --name <your-function-app-name> --settings SCM_DO_BUILD_DURING_DEPLOYMENT=truePublish your Azure Function App using the Azure CLI or your preferred publishing method. You can use one of the following command to publish your Azure Function App:
func azure functionapp publish {NAME_OF_YOUR_AZURE_FUNCTION_APP}OR
az functionapp app upOR
az functionapp deployImportante
The commands given here are examples and may require additional parameters based on your specific Azure configuration and deployment strategy such as
OS
,Node.js version
,Azure resource group
,Azure subscription
,Azure storage account
,Azure region
, and so on. Refer to Azure documentation to know more about these parameters forfunc azure functionapp publish
,az functionapp up
, andaz functionapp deploy
methods.
You can instrument your Azure Function with the New Relic .NET agent on Windows in the following ways:
Configure environment variables
After you've instrumented your Azure Function with the New Relic, configure environment variables:
- Navigate to your Azure Function in the Azure portal.
- Under Settings, click Environment variables, and then click Advanced edit.
- Based on your deployment environment, paste the following values:
Importante
Ensure that you add a comma at the end of the last existing line and update your license key in the following configurations.
{ "NODE_OPTIONS": "-r newrelic", "NEW_RELIC_LICENSE_KEY": "YOUR-NEW-RELIC-INGEST-LICENSE-KEY", "NEW_RELIC_APP_NAME": "NAME-OF-THE-FUNCTION-APP"}
New Relic Azure Websites Extension:
{ "name": "NEW_RELIC_LICENSE_KEY", "value": "<your New Relic ingest license key here>", "slotSetting": false}
The Azure websites extension automatically configures all other required environment variables.
Optionally, you can specify the version of the .NET agent you want to install by adding the following environment variable:
{ "name": "NEW_RELIC_AGENT_VERSION_OVERRIDE", "value": "10.38.0", "slotSetting": false}
NewRelic.Agent Nuget package:
({ "name": "CORECLR_ENABLE_PROFILING", "value": "1", "slotSetting": false},{ "name": "CORECLR_NEW_RELIC_HOME", "value": "C:\\home\\site\\wwwroot\\newrelic", "slotSetting": false},{ "name": "CORECLR_PROFILER", "value": "{36032161-FFC0-4B61-B559-F6C5D41BAE5A}", "slotSetting": false},{ "name": "CORECLR_PROFILER_PATH_32", "value": "C:\\home\\site\\wwwroot\\newrelic\\x86\\NewRelic.Profiler.dll", "slotSetting": false},{ "name": "CORECLR_PROFILER_PATH_64", "value": "C:\\home\\site\\wwwroot\\newrelic\\NewRelic.Profiler.dll", "slotSetting": false},{ "name": "COR_ENABLE_PROFILING", "value": "1", "slotSetting": false},{ "name": "NEW_RELIC_HOME", "value": "C:\\home\\site\\wwwroot\\newrelic", "slotSetting": false},{ "name": "COR_PROFILER", "value": "{71DA0A04-7777-4EC6-9643-7D28B46A8A41}", "slotSetting": false},{ "name": "COR_PROFILER_PATH_32", "value": "C:\\home\\site\\wwwroot\\newrelic\\x86\\NewRelic.Profiler.dll", "slotSetting": false},{ "name": "COR_PROFILER_PATH_64", "value": "C:\\home\\site\\wwwroot\\newrelic\\NewRelic.Profiler.dll", "slotSetting": false},{ "name": "NEW_RELIC_LOG_DIRECTORY", "value": "C:\\home\\LogFiles\\NewRelic", "slotSetting": false},{ "name": "NEW_RELIC_LICENSE_KEY", "value": "<your New Relic ingest license key here>", "slotSetting": false})
Restart your Azure Function
After you've added the environment variables, restart your Azure Function to apply the changes.
Find and use data
After you have configured your Azure Function, you can find and use the data in the New Relic UI.
- Go to https://one.newrelic.com > APM & Services.
- In the search banner, set the search criteria as
isAzureFunction = true
: - From the displayed list, select your Azure Function to view the data.