> ## Documentation Index
> Fetch the complete documentation index at: https://docs.langchain.com/llms.txt
> Use this file to discover all available pages before exploring further.

# BYOC onboarding on Azure

> Set up a LangSmith BYOC data plane in your Azure subscription, from granting LangSmith access to a resource group to creating, changing, and deleting the data plane.

> [!NOTE]
>
> BYOC on Azure is in **[beta](https://docs.langchain.com/langsmith/release-stages.md)**. To get started, [contact our sales team](https://www.langchain.com/contact-sales).

This page describes how to create a LangSmith BYOC data plane in your Azure subscription. Each data plane runs in its own resource group. A Terraform module gives LangSmith access to that resource group only, and LangChain then creates and operates the data plane in it. For the design, see [BYOC architecture on Azure](https://docs.langchain.com/langsmith/byoc-architecture-azure.md). For AWS, see [BYOC onboarding](https://docs.langchain.com/langsmith/byoc-onboarding-aws.md).

## Before you start

You need the following:

* **A LangSmith organization on Azure**: Use the LangSmith control plane on Azure at [azure.smith.langchain.com](https://azure.smith.langchain.com). Send your organization ID to the LangChain team to enable BYOC.
* **An Azure subscription**: A dedicated subscription is recommended, not required.
* **Azure permissions**: `Owner`, or `Contributor` and `User Access Administrator`, at subscription scope, to apply Terraform. A Microsoft Entra role that can create service principals, for example `Cloud Application Administrator`, once per tenant. Two people can share these, as the Terraform step below shows. If your `User Access Administrator` grant blocks privileged roles, set `byo_iam = true` and create the identities yourself.
* **Terraform**: Terraform 1.11.0 or later.
* **An organization admin in LangSmith**: To create, change, and delete a data plane.
* **vCPU quota**: At least 6 free vCPUs in the region, in both the **Total Regional vCPUs** quota and the Dsv6 family quota, for three `Standard_D2s_v6` system nodes. Application nodes use D, E, and F series v5 or later, so plan quota for those too. See [Node pools](https://docs.langchain.com/langsmith/byoc-architecture-azure.md#compute).
* **A region**: Any Azure region. To enable a new region, contact the LangChain team.

## Create a data plane

**1. Copy the external ID**

In LangSmith, go to **Settings > Data Planes** and click the copy button next to the **Data Planes** header. Do not create your own value. LangSmith uses the external ID to confirm that the role assignments in your subscription belong to your organization.

**2. Grant LangSmith access with Terraform**

Apply the [`langsmith-byoc-access` Terraform module](https://github.com/langchain-ai/terraform/tree/main/modules/byoc/azure/langsmith-byoc-access) in your subscription. You must use this module. It creates:

* **The LangSmith service principal**, once per tenant: the identity of the LangSmith application (client ID `5b0a74cb-9f37-4797-b557-c15d7be80d3b`) in your Entra tenant. The LangSmith control plane runs outside your tenant and signs in as it. It has no Microsoft Graph permissions. The managed identities in the resource group are for the workloads inside the data plane.
* **A resource group** `langsmith-byoc-<key>` for each entry in `data_planes`. Do not put other workloads in it.
* **A Key Vault** in each resource group, with Azure RBAC and no public network access. LangSmith writes the data plane's bootstrap secret to it.
* **Two role assignments** on each resource group: a `langsmith-byoc-<key>-<suffix>` custom role and `User Access Administrator`. Both carry your external ID as their description.

```hcl theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
terraform {
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = ">= 4.42.0, < 5.0.0"
    }
    azuread = {
      source  = "hashicorp/azuread"
      version = "~> 3.0"
    }
  }
}

provider "azurerm" {
  subscription_id = "<subscription-id>"
  features {}

  # The data plane needs these resource providers. LangSmith cannot
  # register them, because its roles stop at the resource group.
  resource_providers_to_register = [
    "Microsoft.Cache",
    "Microsoft.Compute",
    "Microsoft.ContainerRegistry",
    "Microsoft.ContainerService",
    "Microsoft.DBforPostgreSQL",
    "Microsoft.KeyVault",
    "Microsoft.ManagedIdentity",
    "Microsoft.Network",
    "Microsoft.Storage",
  ]
}

provider "azuread" {}

variable "external_id" {
  description = "The external ID from Settings > Data Planes in LangSmith."
  type        = string
}

module "langsmith_byoc_access" {
  source = "github.com/langchain-ai/terraform//modules/byoc/azure/langsmith-byoc-access?ref=main"

  langsmith_app_client_id = "5b0a74cb-9f37-4797-b557-c15d7be80d3b"
  external_id             = var.external_id

  # Set to false if an Entra admin already ran `az ad sp create`.
  # create_service_principal = false

  data_planes = {
    prod = {
      location = "eastus"
    }
  }
}

output "langsmith_byoc_access" {
  value = module.langsmith_byoc_access
}
```

1. Save the configuration as `main.tf` in an empty folder. Replace the subscription ID and the region. The `data_planes` key (`prod`) names the resource group: up to 63 lowercase letters, digits, and hyphens, starting with a letter, ending with a letter or digit, and with no consecutive hyphens.

2. If the person who applies Terraform cannot create service principals, an Entra admin runs `az ad sp create --id 5b0a74cb-9f37-4797-b557-c15d7be80d3b` first. Then you must set `create_service_principal = false`. Terraform then only reads the service principal.

3. Run:

   ```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
   az login
   terraform init
   terraform apply -var 'external_id=<external-id>'
   terraform output -json langsmith_byoc_access
   ```

4. Note `azure_entra_tenant_id`, and the `region` and `resource_group_id` under `data_planes`.

For what each role allows, see [Access and permissions](https://docs.langchain.com/langsmith/byoc-architecture-azure.md#access-and-permissions). For all inputs, see the [module README](https://github.com/langchain-ai/terraform/tree/main/modules/byoc/azure/langsmith-byoc-access).

**3. Create the data plane**

1. In [LangSmith on Azure](https://azure.smith.langchain.com), go to **Settings > Data Planes** and click **+ Data Plane**.

2. Fill in the **Create a data plane** form using the Terraform outputs from the previous step:

   | Field | Description |
   | - | - |
   | **Name** | Up to 24 lowercase letters, digits, and hyphens. Starts and ends with a letter or digit, and does not start with `internal`. For example, `prod`. |
   | **Azure region** | Select the region of the resource group. |
   | **Microsoft Entra tenant ID** | Use the `azure_entra_tenant_id` output, in `8-4-4-4-12` UUID form. |
   | **Azure resource group ID** | Use the `resource_group_id` output, in the form `/subscriptions/<subscription-id>/resourceGroups/<name>`. Each resource group serves one data plane. |
   | **Use existing managed identities** | Select this only if you set `byo_iam = true` for this data plane in the module's `data_planes` input, so that Terraform creates the identities and their role assignments. Set `byo_iam` before you create the data plane, because it cannot change later. See [Bring your own identities](https://github.com/langchain-ai/terraform/tree/main/modules/byoc/azure/langsmith-byoc-access#bring-your-own-identities-optional). Otherwise, leave it cleared. |
   | **VNet CIDR Range** | The address range of the VNet that LangSmith creates for the data plane. Use a private RFC 1918 range from `/16` to `/18` that does not overlap your other networks. |
   | **Load balancer access** | Leave on **Private**, the default, for access from the data plane VNet and connected networks only. Switch to **Public** for an internet-facing endpoint. |

3. Click **Create data plane**. LangSmith confirms with **Data plane requested**.

LangSmith first checks the external ID, its permissions, the Key Vault, the region, and the vCPU quota. If a check fails, the form shows the error. See [Troubleshoot data plane creation](#troubleshoot-data-plane-creation).

**4. Wait for provisioning**

The data plane moves from `requested` to `provisioning` to `active` in **Settings > Data Planes**. If it is not active within 3 hours, it moves to `provisioning_failed`. Then contact the LangChain team.

**5. Connect to the data plane**

The data plane URL has the form `https://<data_plane_id>.azure.langchain-byoc.com`. Find it under **Settings > Data Planes**.

* **Internal load balancer** (`public_load_balancer: false`): Reach the data plane only from its VNet. Connect your network to that VNet, for example with peering or a VPN gateway, and resolve DNS through its private DNS zone. Peering or a VPN alone does not give DNS resolution.
* **Public load balancer** (`public_load_balancer: true`): Users and applications reach the data plane over the internet.

If the LangSmith UI cannot reach your data plane, it prompts you to switch to a workspace on a data plane that is reachable.

**6. Create workspaces**

A workspace named `dp-<data_plane_name>` is created automatically in the new data plane. It is not accessible until the data plane is reachable.

You can create more workspaces in the data plane. Select the target data plane when you create each one: a workspace belongs to exactly one data plane, and a data plane can hold many workspaces.

> [!WARNING]
>
> A workspace cannot be moved to another data plane after creation.

**7. (Optional) Migrate existing data**

If you are moving from LangSmith Cloud or a [self-hosted](https://docs.langchain.com/langsmith/self-hosted.md) instance, contact the LangChain team to arrange a migration. Trace migration is supported on AWS only.

For more information, see [Migrate to BYOC](https://docs.langchain.com/langsmith/byoc-migration.md).

To send traces and API requests to the data plane, see [BYOC usage](https://docs.langchain.com/langsmith/byoc-usage.md).

## Troubleshoot data plane creation

| Code | HTTP status | Cause | Fix |
| - | - | - | - |
| `azure_external_id_mismatch` | 403 | A role assignment of the LangSmith service principal on the resource group does not have your organization's external ID as its description. | Apply the Terraform module with the external ID from **Settings > Data Planes**, then retry. |
| `azure_permissions` | 403 | The LangSmith service principal cannot access the resource group, or lacks a required permission. The remedy lists the missing actions. | Check that the resource group exists and that you applied the Terraform module without `reduced_access`, then retry. |
| `azure_policy_denied` | 403 | An Azure Policy assignment in your subscription denied a request. | Exempt the data plane resource group from the policy, then retry. |
| `azure_resource_group_invalid` | 400 | The resource group does not exist, does not contain exactly one Key Vault, or its vault does not use Azure RBAC. | Fix the resource group, then retry. |
| `azure_region_unavailable` | 400 | Your subscription cannot use the region, or cannot create the AKS system node size or the PostgreSQL size in it. | Choose another region, or ask Azure support to enable the VM size or PostgreSQL for your subscription in the region. |
| `insufficient_azure_quota` | 422 | The region does not have enough free vCPU quota for the AKS system node pool. | Request a quota increase, or choose another region. |
| `azure_resource_group_in_use` | 409 | Another data plane uses the resource group. | Create a new resource group for the data plane. |
| `data_plane_name_taken` | 409 | Your organization already has a data plane with this name. | Choose another name. |
| `azure_throttled` | 429 | Azure is rate limiting requests for your subscription. | Wait a minute, then retry. |
| `azure_unavailable` | 502 or 503 | Azure returned a server error, or did not report the vCPU quota. | Wait a minute, then retry. |

Invalid field values return HTTP 400 with the field name and the rule that the value breaks.

## Reduce access after deployment

Once the data plane is `active`, you can reduce the permissions of its `langsmith-byoc-<key>-<suffix>` custom role. Set `reduced_access = true` for the data plane in the Terraform module and run `terraform apply`:

```hcl theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
data_planes = {
  prod = {
    location       = "eastus"
    reduced_access = true
  }
}
```

Terraform reduces the custom role and deletes the `User Access Administrator` assignment. Azure applies the change in up to 5 minutes. LangChain can still upgrade, scale, and repair the data plane. It cannot delete the data plane, its databases, storage, or network, and cannot create role assignments. Set `reduced_access` back to `false` before you delete or re-create the data plane, and before an upgrade that adds a role assignment.

## Delete a data plane

> [!WARNING]
>
> Do not remove the data plane from the Terraform module before you delete it in LangSmith. LangSmith needs its role assignments to delete the data plane resources.

1. If the data plane has `reduced_access = true`, set it to `false`, run `terraform apply`, and wait 5 minutes for Azure to apply the role change.
2. Delete the data plane in **Settings > Data Planes**, or with the `DELETE /orgs/current/data-planes/<data-plane-id>` API. You can delete an Azure data plane while it is `provisioning`, `active`, or `provisioning_failed`. LangSmith first checks that it can still access your resource group.
3. Wait until the data plane is gone from **Settings > Data Planes**.

LangSmith deletes the AKS cluster, PostgreSQL, Redis, the network, and the private DNS zones. It keeps the following in your resource group:

* The resource group and the Key Vault.
* The Blob storage accounts that hold your trace data and SmithDB data.

Azure keeps the backups of a deleted PostgreSQL server for a limited time, during which you can restore it. See [Restore a dropped Azure Database for PostgreSQL flexible server](https://learn.microsoft.com/azure/postgresql/flexible-server/how-to-restore-dropped-server).

If you create a new data plane with the same name in the same resource group, it reuses the Key Vault and the retained Blob storage accounts.

When you no longer need the data, delete the Blob storage accounts first. Then remove the key from `data_planes` and run `terraform apply` to delete the resource group, the Key Vault, and the role assignments.

## Remove LangSmith access

To stop LangSmith from changing a data plane, remove the role assignments of the LangSmith service principal on its resource group and AKS cluster. Removing the Terraform module removes access to every data plane in the tenant. The resources stay in your subscription, and LangChain can no longer upgrade or repair them. Delete the data plane first if you want LangSmith to clean up.

## Next steps

* [BYOC architecture on Azure](https://docs.langchain.com/langsmith/byoc-architecture-azure.md) covers the resources in your subscription, the network paths, and how LangSmith accesses them.
* [BYOC usage](https://docs.langchain.com/langsmith/byoc-usage.md) covers how to point applications and API clients at the data plane.

***

[Connect these docs](https://docs.langchain.com/use-these-docs.md) to your agent of choice via MCP for real-time answers.

[Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/langsmith/byoc-onboarding-azure.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
