---
title: Windows instrumentation
source: https://docs.newrelic.com/docs/serverless-function-monitoring/azure-function-monitoring/windows
---

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 [#begin]

-   Ensure your Azure Function meets our [compatibility and requirements](https://docs.newrelic.com/docs/serverless-function-monitoring/azure-function-monitoring/compatibility-requirement-azure-monitoring).
-   Link your Azure account to New Relic. For more information, refer to [Azure integration](https://docs.newrelic.com/docs/infrastructure/microsoft-azure-integrations/azure-integrations-list/azure-functions-monitoring-integration/#polling).

## Configure Azure Functions monitoring

You can configure Azure Functions monitoring for different environments and various combinations of runtimes and deployment methods:

### Node.js

1.  In the root directory of your Node.js Azure Function App project, install the New Relic agent as a project dependency by running:

    ```bash
    npm i newrelic
    ```
2.  To ensure that the New Relic agent is installed with your project dependencies during the Azure deployment process, set the `SCM_DO_BUILD_DURING_DEPLOYMENT` to `true` in your application settings by running:

    ```bash
    az functionapp config appsettings set --name NAME_OF_YOUR_AZURE_FUNCTION_APP --settings SCM_DO_BUILD_DURING_DEPLOYMENT=true
    ```
3.  Publish 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:

    ```bash
    func azure functionapp publish NAME_OF_YOUR_AZURE_FUNCTION_APP 
    ```

    OR

    ```bash
    az functionapp app up
    ```

    OR

    ```bash
    az functionapp deploy
    ```

    > #### ⚠️ IMPORTANT
    >
    > 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 for [`func azure functionapp publish`](https://learn.microsoft.com/en-us/azure/azure-functions/functions-core-tools-reference?tabs=v2#func-azure-functionapp-publish), [`az functionapp up`](https://learn.microsoft.com/en-us/cli/azure/functionapp/app?view=azure-cli-latest#az-functionapp-app-up), and [`az functionapp deploy`](https://learn.microsoft.com/en-us/cli/azure/functionapp?view=azure-cli-latest#az-functionapp-deploy) methods.

### .NET

You can instrument your Azure Function with the New Relic .NET agent on Windows in the following ways:

**Use the New Relic Azure Websites Extension**

The New Relic Azure Websites Extension (v1.6.0 and later) automatically installs the latest version of the .NET agent and configures instrumentation for your Windows Azure Function. To install the New Relic Azure Websites Extension, follow these steps:

1.  In the Azure portal, navigate to your function app.
2.  Click the **Development tools** section, and select **Extensions**.
3.  Click **+ Add**.
4.  Select **Search for an extension to install** and enter `New Relic .NET Agent` in the **Filter items** box.
5.  Select the **New Relic .NET Agent(vx.x.x) - New Relic** extension and click **Add**.
6.  When installation is complete, the extension appears in the list of installed extensions. To verify correct installation, click the link under the **Browse** column to view the installation log.
    The Azure Websites Extension configures all required environment variables except your license key (see the next step for details). The .NET agent is installed to `C:\home\NewRelicAgent` and log files are written to `C:\home\LogFiles\NewRelic`.

**Add the New Relic agent  NuGet package to your project**

1.  Add the latest version of the `NewRelic.Agent` NuGet package to your application project.
2.  Use your preferred publishing mechanism to deploy your updated application to Azure.
    When you deploy your application, the .NET agent is installed in the `C:\home\site\wwwroot\newrelic` folder. You need to configure required environment variables in the next step.

## Configure environment variables

After you've instrumented your Azure Function with the New Relic, [configure environment variables](https://docs.newrelic.com/docs/serverless-function-monitoring/azure-function-monitoring/env-variables-azure):

1.  Navigate to your Azure Function in the Azure portal.
2.  Under **Settings**, click **Environment variables**, and then click **Advanced edit**.
3.  Based on your deployment environment, paste the following values:

> #### ⚠️ IMPORTANT
>
> Ensure that you add a comma at the end of the last existing line and update your license key in the following configurations.

### Node.js

```json
{
  "NODE_OPTIONS": "-r newrelic",
  "NEW_RELIC_LICENSE_KEY": "YOUR_NEW_RELIC_LICENSE_KEY",
  "NEW_RELIC_APP_NAME": "NAME_OF_YOUR_AZURE_FUNCTION_APP"
}
```

### .NET

#### New Relic Azure Websites Extension:

```json
{
  "name": "NEW_RELIC_LICENSE_KEY",
  "value": "YOUR_NEW_RELIC_LICENSE_KEY",
  "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:

```json
{
  "name": "NEW_RELIC_AGENT_VERSION_OVERRIDE",
  "value": "AGENT_VERSION",
  "slotSetting": false
}
```

#### NewRelic.Agent Nuget package:

```json
{
  "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_LICENSE_KEY",
  "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 [#find-data]

After you have configured your Azure Function, you can find and use the data in the New Relic UI.

1.  Go to <https://one.newrelic.com> > **APM & Services**.
2.  In the search banner, set the search criteria as `isAzureFunction = true`:
    ![A screenshot showing the Azure Function search](https://docs.newrelic.com/images/azure_filters.webp "Azure Function Search")
3.  From the displayed list, select your Azure Function to view the data.

## Related articles [#related-docs]

[Compatibility and requirements](https://docs.newrelic.com/docs/serverless-function-monitoring/azure-function-monitoring/compatibility-requirement-azure-monitoring)

Requirements for your Azure Functions

[Linux instrumentation](https://docs.newrelic.com/docs/serverless-function-monitoring/azure-function-monitoring/linux)

Learn how to set up your Azure Functions for Linux to monitor them in New Relic.

[Container instrumentation](https://docs.newrelic.com/docs/serverless-function-monitoring/azure-function-monitoring/container)

Learn how to set up your Azure Functions for Containers to monitor them in New Relic.
