# Microsoft Entra ID Setup (/docs/cloud/console-administration/azure-ad-sso-setup)













<Callout type="info">
  Entra ID SSO is available on all paid NetBox Cloud tiers (not Free) and with NetBox Enterprise. [Group mapping](/cloud/console-administration/azure-group-mapping/) requires the Professional or Premium tier.
</Callout>

NetBox Cloud supports single sign-on (SSO) with Microsoft Entra ID (formerly Azure Active Directory), so users can log in with their existing Microsoft credentials instead of separate NetBox account credentials.

This centralizes access control and simplifies user management, letting administrators grant or revoke NetBox Cloud access directly from Entra ID.

For more information, see [What is single sign-on in Microsoft Entra ID?](https://learn.microsoft.com/en-us/entra/identity/enterprise-apps/what-is-single-sign-on).

## Entra ID configuration [#entra-id-configuration]

<Callout type="info">
  We recommend that you first [create a new Entra ID user](https://learn.microsoft.com/en-us/entra/fundamentals/how-to-create-delete-users) for testing.

  You can skip this step if you already have a suitable account created.
</Callout>

### Register an app [#register-an-app]

Begin by registering an app for NetBox. For more information, see [Register an application in Microsoft Entra ID](https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-register-app).

1. Open the [Microsoft Entra admin center](https://entra.microsoft.com/#home) and select **Entra ID > App registrations** in the left menu.

2. Click **New registration**.

3. Complete the following fields:

   * **Name**: Enter a name for the registration (e.g. "NetBox Cloud").

   * **Account type**: Select the single-tenant option.

     <Callout type="info">
       **Multitenant authentication**

       NetBox Cloud also supports sign-in from several Entra ID tenants. Only the account type changes. See [Multitenant authentication](#multitenant-authentication) below.
     </Callout>

     <Callout type="warn">
       The account type you select here is what restricts sign-in to your tenant. If you select a multi-tenant account type, restrict it to the tenants you need. See [Multitenant authentication](#multitenant-authentication).
     </Callout>

   * **Redirect URI**: Select **Web** and enter the path to your NetBox Cloud installation, ending with /oauth/complete/azuread-oauth2/.

     For example: `https://\{your-domain\}.cloud.netboxapp.com/oauth/complete/azuread-oauth2/`

   <img alt="Add an app registration" src="__img0" />

4. Note the application (client) ID. You will need it when sending your configuration details to NetBox support.

   <img alt="Completed app registration" src="__img1" />

### Create a secret [#create-a-secret]

1. From the page for your new NetBox Cloud app registration, select **Certificates & secrets** in the menu on the left.
2. Under **Client secrets**, click **New client secret**.
3. Provide a description and optionally select an expiration period.
4. After creating the secret, note its value. You will need this when configuring NetBox Cloud.

   <img alt="Client secret parameters" src="__img2" />

<Callout type="info">
  This value is only displayed once; copy it immediately.
</Callout>

## NetBox Cloud configuration [#netbox-cloud-configuration]

Contact [NetBox Labs Support](mailto:support@netboxlabs.com), who will arrange a secure method for you to supply the following parameters. Do not send your client secret by email.

* `APPLICATION_ID` is the &#x2A;*Application (client ID)** you copied from the **Overview** page for your NetBox Cloud app registration.
* `SECRET_VALUE` is the **Value** you copied from the **Certificates & secrets** page for your NetBox Cloud app registration.

```
SOCIAL_AUTH_AZUREAD_OAUTH2_KEY = '\{APPLICATION_ID\}'
SOCIAL_AUTH_AZUREAD_OAUTH2_SECRET = '\{SECRET_VALUE\}'
```

The support team will add these parameters to your NetBox Cloud instance.

If more than one Entra ID tenant needs to sign in, tell support when you contact them. See [Multitenant authentication](#multitenant-authentication).

## Multitenant authentication [#multitenant-authentication]

One NetBox Cloud instance can accept users from several Entra ID tenants, and [group mapping](/cloud/console-administration/azure-group-mapping/) works across all of them. The configuration above does not change.

To accept users from several tenants:

1. When you register the app, select **Multiple Entra ID tenants** for the account type, and add each tenant that needs access to the app's allowed tenants list (**Manage allowed tenants**). Users from tenants not on the list are refused with `AADSTS7000119`.

2. An administrator in each additional tenant consents to the application before users in that tenant can sign in. They can do this by opening the following URL, substituting their own tenant ID and your application ID:

   `https://login.microsoftonline.com/<tenant-id>/adminconsent?client_id=<application-id>`

3. If you use group mapping, collect the group object IDs from every tenant. See [Multitenant deployments](/cloud/console-administration/azure-group-mapping/#multitenant-deployments).

<Callout type="warn">
  Without an allowed tenants list, a multi-tenant app registration accepts a user from **any** Entra ID tenant that consents to the application. Users from that tenant get a NetBox Cloud account on first sign-in, with no permissions unless a mapped group grants them. Always restrict the app to the tenants you need. The allowed tenants setting is currently in preview in Microsoft Entra ID.
</Callout>

## Testing [#testing]

After the support team has confirmed that your Cloud instance has been configured, you can test it.

Log out of NetBox Cloud and click the "Log In" button at top right. You should see the normal login form as well as an option to authenticate using Entra ID.

Click the option to log in with Microsoft Entra ID.

<img alt="NetBox Entra ID login form" src="__img3" />

You will be redirected to Microsoft's authentication portal where you can log in with your test user's Microsoft credentials.

<div style="max-width: 511px">

<img alt="Microsoft authentication portal" src="__img4" />

</div>

If successful, you will be redirected back to the NetBox Cloud UI, and will be logged in as the Entra ID user. You can verify this by clicking your login ID in the upper right and selecting **Profile**.

This user account is now replicated within NetBox Cloud, and can be assigned groups and permissions within the NetBox Cloud admin UI.

::: note
By default, new users have no permissions.
:::

## Troubleshooting [#troubleshooting]

### Redirect URI does not match [#redirect-uri-does-not-match]

Entra ID requires that the authenticating client request a redirect URI that matches what you configured when registering the app.

This URI must begin with `https://` and must match **exactly** what you configured in Entra ID (including the trailing slash).

The redirect URI is where Entra ID sends users after authentication. NetBox uses the following pattern:

```text
https://<your-netbox-domain>/oauth/complete/azuread-oauth2/
```

### Not logged in after authenticating [#not-logged-in-after-authenticating]

If you are redirected to the NetBox Cloud UI after authenticating successfully, but are not logged in, contact [NetBox Labs Support](mailto:support@netboxlabs.com) to check your instance's SSO configuration against your Entra ID app registration.

### User from another tenant cannot sign in [#user-from-another-tenant-cannot-sign-in]

If a user from another tenant cannot sign in, check the error code:

* `AADSTS700016` or `AADSTS50020`: the app registration's account type is still single-tenant. Change it to **Multiple Entra ID tenants**.
* `AADSTS7000119`: the user's tenant is not on the app's allowed tenants list. Add it.
* **Need admin approval**: an administrator in the user's tenant has not yet consented to the application.

See [Multitenant authentication](#multitenant-authentication).

### Expired client secret [#expired-client-secret]

If authentication fails and you see an error such as "invalid\_client" or "secret expired", this means your client secret has expired.

Generate a new client secret in Entra ID and contact [NetBox Labs Support](mailto:support@netboxlabs.com), who will arrange a secure method for you to supply it.

To prevent this, we recommend setting a calendar reminder to rotate and update your secret.
