# Register Grok Bot in Microsoft Entra ID

Register Grok Bot as an app in Microsoft Entra ID so it can sign people in to your Dtwo gateway.

## Overview

Grok Bot needs its own app in Microsoft Entra ID to sign people in to your Dtwo gateway. You only do this once for your organization. Everyone who uses Grok Bot with your gateway signs in through this app.

## Before you start

If you've already registered your Dtwo gateway in Entra, go to **App registrations**, open the gateway app (for example `Dtwo Gateway`), and copy the **Application (client) ID** from its **Overview** page. This is your `<ApplicationId>`.

If you haven't, follow [Configure Microsoft Entra ID](/docs/identity-provider-entra) first, then come back here.

## Register Grok Bot

1. Go to **App registrations → New registration**, name it after the client (for example `Grok Bot`), set **Supported account types** to **Single Tenant Only — Default Directory**, and select **Register**.
2. From **Overview**, copy the **Application (client) ID** — this is the client's `<ClientId>`.
3. Under **Authentication → Add a platform**, select **Web** and add the redirect URI `https://www.cursor.com/agents/mcp/oauth/callback`. Grok Bot signs people in from Cursor's servers, so it uses a web redirect rather than a localhost one.
4. Under **Certificates & secrets → Client secrets**, select **New client secret**, choose an expiry, and select **Add**. Copy the secret's **Value** right away — this is the client's `<ClientSecret>`. Entra only shows it once. When it expires, everyone has to update it in Grok Bot.
5. Under **API permissions → Add a permission**, open the **APIs my organization uses** tab, search for `<ApplicationId>`, select your gateway application, check the `mcp` scope, and select **Add permissions**.

## Next steps

Use the client ID and secret you copied to [roll out Dtwo to your organization in Grok Bot](/docs/connect-client-grok-bot) or to [connect Grok Bot for yourself](/docs/connect-yourself-grok-bot).

---

Having trouble? Email [support@dtwo.ai](mailto:support@dtwo.ai).