---
title: Node.js agent on Microsoft Azure App Services
source: https://docs.newrelic.com/docs/apm/agents/nodejs-agent/hosting-services/nodejs-agent-microsoft-azure
---

## Installation methods

If you're running a web app and deploying as code on Windows, you can easily install the Node agent using our Azure Site Extension. \[]See these instructions](/docs/apm/agents/nodejs-agent/installation-configuration/install-nodejs-azure-site-extension).

If you're deploying a container app, you can follow our [instructions for Docker](https://docs.newrelic.com/docs/apm/agents/nodejs-agent/installation-configuration/install-nodejs-agent-docker).

You need to install the agent manually for Linux-hosted web apps, which we describe below.

## Manual Installation [#manual-installation]

Learn about special considerations for using Microsoft Azure App Services as a hosting service with New Relic's Node.js agent.

## What you need [#compatibility]

In addition to the [Compatibility and requirements for the Node.js agent](https://docs.newrelic.com/docs/agents/nodejs-agent/getting-started/compatibility-requirements-nodejs-agent), this tutorial assumes you have a working installation of Node.js and the Azure SDK for js for your platform:

-   Install the Azure SDK for js.
-   Ensure Git is installed.

> #### ⚠️ IMPORTANT
>
> The Node.js agent cannot deliver telemetry for Azure Functions. Instead, you will need to use the [Azure Functions monitoring integration](https://docs.newrelic.com/docs/infrastructure/microsoft-azure-integrations/azure-integrations-list/azure-functions-monitoring-integration/)

## Installing the Node.js agent [#install_nodejs]

To add the New Relic Node.js agent to your Azure application make sure the `newrelic` module is loaded first, use the Node.js `-r`/`--require` flag to run the following:

```shell
node -r newrelic server.js
```

> #### ⚠️ IMPORTANT
>
> For a Next.js app, load our agent via `NODE_OPTIONS`, such as:
>
> ```shell
> NODE_OPTIONS='-r newrelic' next start
> ```

## Adding app settings in Azure [#azure_settings]

After installation, you must configure your app in Azure App Services:

1.  Sign in to **[portal.azure.com](https://portal.azure.com)**.
2.  Select **App Services > (select a Node.js app) > Configure**.
3.  Add the following to the **app settings**:

    -   `new_relic_app_name`: Your Azure App Services name
    -   `new_relic_license_key`: Your New Relic license key
4.  Save your settings.
5.  Restart your Node.js app.

Generate some traffic to your app and wait a few minutes. After waiting, see your data by going to **[one.newrelic.com > All capabilities](https://one.newrelic.com/all-capabilities) > APM & services > (select your app)**.

## Optional: Adding app settings with the CLI [#app_settings]

Optional: Here is an example of how to add the app settings by using the CLI (Node.js SDK):

```bash
azure account download "YOUR_SUBSCRIPTION_NAME"
azure account import "PATH_TO_PUBLISH_SETTINGS_FILE"
azure site config add "new_relic_app_name=REPLACE_WITH_YOUR_APP_NAME"
azure site config add "new_relic_license_key=REPLACE_WITH_YOUR_LICENSE_KEY"
azure site restart AZURE_APP_SERVICES_NAME
```

## Using environment variables [#variables]

If your agent runs in PaaS environments such as Heroku or Azure App Services, all of the configuration variables in `newrelic.js` have counterparts that can be set as environment variables. You can freely mix and match variables in the configuration file. Environment variables [override your configuration file settings](https://docs.newrelic.com/docs/agents/nodejs-agent/installation-configuration/nodejs-agent-configuration#methods-and-precedence).

For example, as a convenience to Azure users, the agent will use `APP_POOL_ID` as the application name ([`NEW_RELIC_APP_NAME`](https://docs.newrelic.com/docs/nodejs/configuring-nodejs-with-environment-variables#app_name)) if it's set, so you can use the name you chose without setting it twice. For more information, see [Configuring Node.js with environment variables](https://docs.newrelic.com/docs/nodejs/configuring-nodejs-with-environment-variables).
