---
title: How to Deploy Logto as a Microsoft Entra External ID Alternative
url: https://docs.vultr.com/how-to-deploy-logto-as-a-microsoft-entra-external-id-alternative
description: Deploy Logto on a Linux server using Docker Compose with PostgreSQL and Traefik for HTTPS, as a self-hosted CIAM alternative to Microsoft Entra External ID.
publish_date: 2026-09-04T18:41:49.364000Z
last_updated: 2026-09-09T14:22:14.180256Z
author: Shivang Shandilya
header_image: https://docs.vultr.com/public/doc-assets/2655/f0b5d5f2-e11a-4f78-a6bf-3ec741f0df9b.webp
---

> Index of every Vultr Docs page in markdown: https://docs.vultr.com/llms.txt

[Microsoft Entra External ID](https://learn.microsoft.com/en-gb/entra/external-id/) is Microsoft's cloud-based CIAM service for customer-facing applications. It provides an external tenant customer directory, customizable authentication journeys, social and enterprise identity federation, multi-factor authentication, and integration with the Microsoft identity platform. It removes the need to operate an identity store, but it bills per monthly active user (MAU) above a free allowance of 50,000 MAU on the Basic tier, meters SMS phone verification separately by originating country, charges an additional per-MAU rate for the ID Governance add-on, and ties the directory and its authentication journeys to Microsoft Entra tenants.

[Logto](https://logto.io/) is an open-source Customer Identity and Access Management (CIAM) platform built on the OAuth 2.1 and OpenID Connect (OIDC) standards, and it covers the same ground on self-hosted infrastructure without per-user billing or cloud provider API dependencies. It provides a branded sign-in experience, social and enterprise Single Sign-On (SSO) federation, multi-factor authentication (MFA), role-based access control (RBAC), organizations for multi-tenancy, and webhooks, and it stores every user, application, and role in a PostgreSQL database you control. Because it implements the OIDC specification rather than a proprietary protocol, standard client libraries integrate with it unchanged. A self-hosted deployment also gives you direct control over the token lifetimes, the user schema, the connector set, and the data residency of the identity store.

This article explains how to deploy Logto as an alternative to Microsoft Entra External ID. It covers the Docker Compose deployment with Traefik as the reverse proxy, automatic HTTPS with Let's Encrypt, the admin console, the sign-in experience and brand identity, email and social login connectors, enterprise SSO, MFA, RBAC and API resources, organizations for multi-tenancy, application registration, webhooks, deployment verification, and migration from Microsoft Entra External ID.

## Understanding Logto Architecture

Logto covers most Microsoft Entra External ID components through a self-hosted, OIDC-standard platform. The following table maps each External ID feature to its Logto counterpart and notes where no equivalent exists.

| Microsoft Entra External ID | Logto | Description |
|-------------|-------|-------------|
| External ID Customer Directory (external tenant) | Logto Users | User management and hosted login pages. |
| External ID Identity Providers | Logto Enterprise SSO Connectors (SAML/OIDC) | Federation with external identity providers. |
| External ID Social Identity Providers | Logto Social Connectors | Federated sign-in for guest/external users. |
| External ID MFA | Logto MFA | TOTP, WebAuthn/Passkeys, SMS, Email OTP, and backup codes. |
| Custom Authentication Extensions | Logto Webhooks + Custom JWT scripts | Webhooks for async event notifications; limited support for synchronous token enrichment compared to Entra's Custom Authentication Extensions. |
| App Registrations | Logto Applications | OIDC clients for SPAs, web apps, and M2M services. |
| App Roles | Logto Roles | Role-based access control and multi-tenant management. |
| Bot Protection / Conditional Access | No direct equivalent | Logto offers sign-in protection (CAPTCHA, rate limiting, password policy) but lacks Entra's full Conditional Access engine. |
| Microsoft Authentication Library (MSAL) | Logto SDKs | Official authentication for over 30 modern development frameworks. |

The Logto Core service (`auth.example.com`) exposes the OIDC endpoints, Management API (`/api`), and the user-facing sign-in experience. The Admin Console (`admin.example.com`) is a separate frontend that manages tenant configuration through the Management API.

## Prerequisites

Before you begin:

* Have access to a [Linux-based server](https://docs.vultr.com/products/compute/cloud-compute/provisioning) (with at least 2 CPU cores and 8 GB of RAM) as a [non-root user with sudo privileges](https://docs.vultr.com/how-to-create-a-sudo-user-in-linux).
* [Install Docker and Docker Compose](https://docs.vultr.com/how-to-install-docker-on-ubuntu-24-04#install-docker).
* Create [DNS A records](https://docs.vultr.com/products/network/dns/management/manage-records) pointing to your server's IP address for the following subdomains: `auth.example.com` (Logto Core API and sign-in experience) and `admin.example.com` (Admin Console).

## Deploy Logto with Docker Compose

Logto requires PostgreSQL 14 or later to store users, configuration, and session data. This section deploys Logto for production on a Linux server using Docker Compose, Traefik for automatic HTTPS with Let's Encrypt, and PostgreSQL for durable storage.

1. Create the project directory structure.

    ```console
    $ mkdir -p ~/logto/traefik/letsencrypt
    ```

1. Navigate to the project directory.

    ```console
    $ cd ~/logto
    ```

1. Create the Logto environment file.

    ```console
    $ nano .env
    ```

    Add the following configuration:

    ```ini
    # Domain Configuration
    LOGTO_CORE_DOMAIN=auth.example.com
    LOGTO_ADMIN_DOMAIN=admin.example.com

    # Logto Endpoints
    ENDPOINT=https://auth.example.com
    ADMIN_ENDPOINT=https://admin.example.com

    # SSL Configuration
    LETSENCRYPT_EMAIL=admin@example.com

    # Database
    DB_PASSWORD=DB-PASSWORD

    # Logto image version
    TAG=1.40.1

    # Pins the Docker Engine API version to avoid socket communication errors with newer Traefik releases
    DOCKER_API_VERSION=1.54
    ```

    Save and close the file.

    Replace:

    * `auth.example.com`: Your Logto Core API subdomain.
    * `admin.example.com`: Your Admin Console subdomain.
    * `admin@example.com`: Your email address for Let's Encrypt certificate notifications.
    * `DB-PASSWORD`: A strong password for the PostgreSQL database.
    * `1.40.1`: The Logto release version to deploy. Check the [Logto releases](https://github.com/logto-io/logto/releases) page for the latest stable version when upgrading.

1. Download the Logto Docker Compose file for the pinned release.

    > [!NOTE]
    > Pin the compose file URL to the same release tag as `TAG` in the environment file. The following `docker-compose.yml` file is maintained by Logto.

    ```console
    $ wget https://raw.githubusercontent.com/logto-io/logto/v1.40.1/docker-compose.yml
    ```

1. Update the `docker-compose.yml` file for production use. The official compose file ships with hardcoded database credentials and is labeled for demonstration; replace those defaults before deployment.

    ```console
    $ nano docker-compose.yml
    ```

    Find the `app` service and update the `DB_URL` under the `environment` section as follows:

    ```yaml
    - DB_URL=postgres://postgres:${DB_PASSWORD}@postgres:5432/logto
    ```

    Find the `postgres` service and update the `POSTGRES_PASSWORD` value in the `environment` section:

    ```yaml
    POSTGRES_PASSWORD: ${DB_PASSWORD}
    ```

    Pin the PostgreSQL image to a specific release for reproducible deployments:

    ```yaml
    image: postgres:17.5-alpine
    ```

    Save and close the file.

1. Create the Traefik Docker Compose override file.

    ```console
    $ nano traefik/docker-compose.yml
    ```

    Add the following configuration:

    ```yaml
    services:
      traefik:
        image: traefik:v3.7.0
        command:
          - "--providers.docker=true"
          - "--providers.docker.exposedbydefault=false"
          - "--entrypoints.web.address=:80"
          - "--entrypoints.websecure.address=:443"
          - "--certificatesresolvers.myresolver.acme.httpchallenge=true"
          - "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web"
          - "--certificatesresolvers.myresolver.acme.email=${LETSENCRYPT_EMAIL}"
          - "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
          - "--entrypoints.web.http.redirections.entryPoint.to=websecure"
          - "--entrypoints.web.http.redirections.entryPoint.scheme=https"
        ports:
          - "80:80"
          - "443:443"
        environment:
          - DOCKER_API_VERSION=${DOCKER_API_VERSION}
          - TRUST_PROXY_HEADER=true
        volumes:
          - ./letsencrypt:/letsencrypt
          - /var/run/docker.sock:/var/run/docker.sock:ro
        networks:
          default:
            aliases:
              - ${LOGTO_CORE_DOMAIN}
              - ${LOGTO_ADMIN_DOMAIN}
      app:
        labels:
          - "traefik.enable=true"
          - "traefik.http.routers.logto-core.rule=Host(`${LOGTO_CORE_DOMAIN}`)"
          - "traefik.http.routers.logto-core.entrypoints=websecure"
          - "traefik.http.routers.logto-core.tls.certresolver=myresolver"
          - "traefik.http.routers.logto-core.service=logto-core"
          - "traefik.http.services.logto-core.loadbalancer.server.port=3001"
          - "traefik.http.routers.logto-admin.rule=Host(`${LOGTO_ADMIN_DOMAIN}`)"
          - "traefik.http.routers.logto-admin.entrypoints=websecure"
          - "traefik.http.routers.logto-admin.tls.certresolver=myresolver"
          - "traefik.http.routers.logto-admin.service=logto-admin"
          - "traefik.http.services.logto-admin.loadbalancer.server.port=3002"
    ```

    Save and close the file.

    Traefik routes HTTPS traffic to Logto on subdomain-based host rules. Port 3001 serves the Core API and sign-in experience; port 3002 serves the Admin Console. Let's Encrypt certificates are provisioned automatically once DNS resolves to this server. This stack pins `svhd/logto` to the `TAG` value in `.env`, `traefik` to `v3.7.0`, and PostgreSQL to `17.5-alpine` for reproducible production deployments.

1. Start the Logto stack.

    ```console
    $ docker compose -f docker-compose.yml -f traefik/docker-compose.yml up -d
    ```

1. Verify the containers are running.

    ```console
    $ docker ps
    ```

    The output displays running containers for Traefik, Logto, and PostgreSQL.

1. Verify HTTPS on the Admin Console.

    ```console
    $ curl -sI https://admin.example.com
    ```

    The output returns `HTTP/2 302` with `location: /console/welcome` on first boot.

1. Verify the OIDC discovery endpoint.

    ```console
    $ curl -s https://auth.example.com/oidc/.well-known/openid-configuration | head -c 200
    ```

    The output returns JSON containing `authorization_endpoint` and `issuer` values scoped to your `auth.example.com` domain.

## Access the Admin Console

The Admin Console is the central management interface for configuring the Logto tenant.

1. Open a web browser and navigate to the Logto Admin Console at `https://admin.example.com`.
1. Follow the on-screen instructions to create the initial administrator account.
1. Log in to the dashboard using the new credentials.
1. Review the sidebar to confirm access to Applications, Sign-in & account, Multi-factor auth, Connectors, Enterprise SSO, API resources, Roles, Organizations, Webhooks, and Audit logs.

## Configure Sign-in Experience

The sign-in experience defines the look, feel, and authentication flow for your users. Logto allows you to customize the interface to match your brand identity.

### Set the Brand Identity

1. Navigate to **Sign-in & account** in the left sidebar and select **Branding**.
1. Upload the company logo (for example, `https://example.com/logo.png`) and set the primary brand color (for example, `#6139F6`).
1. Click **Done**.

### Configure the Email Connector

To verify user identities via email and enable password resets, configure an email connector with your SMTP provider credentials.

1. Navigate to **Connectors** and select the **Email and SMS connectors** tab.
1. Click **Set up** under the **Email connector** and select **SMTP**.
1. Obtain the SMTP credentials from your email provider. You need the host, port, username, and password.
1. Return to the Logto Console and enter the following SMTP settings. Replace the placeholder values with your provider's credentials.
    * **host**: `SMTP-HOST`
    * **Port**: `SMTP-PORT`
    * **Auth**:
        * **type**: `login`
        * **user**: `SMTP-USERNAME`
        * **pass**: `SMTP-PASSWORD`
    * **From email**: `SENDER-EMAIL-ADDRESS`
    * **Reply to**: `REPLY-TO-EMAIL-ADDRESS`
1. Toggle **Secure** to **On** if your provider requires TLS.
1. Send a test email to verify the connection.
1. Click **Save and Done**.

### Define Sign-up Identifiers and Sign-in Methods

Select the primary methods users can use to create an account and sign in. Logto supports username, email, and phone-based authentication.

1. Navigate to **Sign-in & account** and select the **Sign-up and sign-in** tab.
1. Select the **Sign-up identifiers**:
    * **Username**: A unique public identifier.
    * **Email address**: Recommended for communication and password recovery.
    * **Phone number**: Enables SMS-based authentication for mobile-first applications.
1. Configure the **Sign-in methods** to allow users to sign in with their chosen identifiers.
1. Click **Save Changes**.

### Enable Passwordless Sign-in

Passwordless authentication reduces friction by allowing users to sign in with one-time codes instead of a password.

1. Remain on the **Sign-up and sign-in** tab.
1. Under **Sign-in methods**, enable **Email verification code** or **SMS verification code** as a sign-in option.
1. Ensure the corresponding email or SMS connector is configured under **Connectors** by selecting the **Email and SMS connectors** tab.
1. Click **Save Changes**.

### Preview the Sign-in UI

1. Click the **Live preview** button on the right side of the **Sign-up and sign-in** page.
1. Test the branded interface and enabled sign-in methods before applying changes to production traffic.

> [!NOTE]
> While this article focuses on email via SMTP, Logto also supports SMS-based registration and sign-in via third-party providers such as Twilio or Vonage. To use phone numbers, configure an SMS connector under **Connectors** by selecting the **Email and SMS connectors** tab. Users access the hosted sign-in UI through a registered application with a valid `client_id` and redirect URI, not by visiting `auth.example.com` directly. Direct navigation without an application context returns an unknown-session page.

## Set Up Social Login Connectors

Social login allows users to authenticate using their existing accounts from third-party identity providers, reducing friction during the registration process.

1. Navigate to **Connectors** in the left sidebar and select the **Social connectors** tab.
1. Click **Add social connector** and select **Google** from the list.
1. Follow the on-screen instructions to create a project in the [Google Cloud Console](https://console.cloud.google.com/):
    1. Create a new project.
    1. Navigate to **APIs & Services**, then select **OAuth consent screen**.
    1. Configure the consent screen and add the domain (for example, `example.com`) as an authorized domain.
    1. Go to **Credentials**, click **Create Credentials**, and select **OAuth client ID**.
    1. Select **Web application** as the application type.
    1. Add the Logto Callback URI (for example, `https://auth.example.com/callback/google`) to the **Authorized redirect URIs**.
1. Copy the **Client ID** and **Client Secret** provided by Google.
1. Paste the credentials into the corresponding fields in the Logto social connector configuration.
1. Configure the **Scope** field in Logto. By default, Logto requests `openid`, `profile`, and `email`. If the application requires additional Google API access (such as Calendar or Drive), append the respective scope URLs separated by spaces.
1. Click **Save and Done**.
1. Repeat the process for **GitHub** and **Apple** by selecting those providers from the **Add social connector** list and following each provider's OAuth configuration instructions.
1. Navigate to **Sign-in & account** and select **Sign-up and sign-in**.
1. Under **Social sign-in**, click **Add social connector** and select the connectors you configured.
1. Click **Save Changes** and use the **Live preview** to test the social sign-in flow.

## Configure Enterprise SSO

Enterprise Single Sign-On (SSO) enables corporate users to authenticate via their own Identity Provider (IdP), such as Okta or Microsoft Entra External ID.

1. Navigate to **Enterprise SSO** in the left sidebar.
1. Click **Add enterprise connector** and select **Okta** (or **SAML** / **OIDC** for a generic enterprise connector).
1. Refer to the **Connection guide** button within the Logto Console for a direct link to the provider-specific setup instructions.
1. Follow the on-screen steps to create an OIDC application in your Okta dashboard:
    1. Register a new OIDC application.
    1. Set the **Login redirect URI** to the value provided in the Logto console.
    1. Obtain the **Client ID**, **Client Secret**, and **Issuer URL**.
1. Enter these details into the Logto connector configuration.
1. Click **Save** to save the connector credentials.
1. For SAML connectors, exchange IdP metadata with Logto by uploading the SAML metadata file or entering the metadata URL provided by your IdP.
1. Navigate to the **SSO Experience** tab in the connector settings.
1. Add the email domains associated with the organization (for example, `example.com`).
    > [!NOTE]
    > Users with matching email domains are automatically routed to the enterprise IdP login page. Other sign-in methods like social login or local passwords are disabled for these domains to enforce corporate security policies.
1. Enable **JIT provisioning** to create users automatically on first SSO sign-in.
1. Click **Save changes**.

## Enable Multi-Factor Authentication

Multi-factor Authentication (MFA) adds an extra layer of security by requiring secondary verification during the sign-in process.

1. Navigate to **Multi-factor auth** in the left sidebar.
1. Toggle the desired MFA methods to **On**:
    * **Authenticator app (TOTP)**: Standard time-based codes from apps like Google Authenticator.
    * **WebAuthn / Passkeys**: High-security biometric (TouchID, FaceID) or hardware key (YubiKey) authentication.
    * **Backup codes**: One-time use recovery codes for account fallback.
    * **SMS** or **Email OTP**: Requires the corresponding connector configured under **Connectors** by selecting the **Email and SMS connectors** tab.
1. Configure the **MFA Policy** to determine when users are prompted (for example, optional MFA or required on every login).
1. Click **Save changes**.

## Configure RBAC and API Resources

Role-Based Access Control (RBAC) securely limits access to specific backend resources and endpoints based on a user's assigned role.

1. Navigate to **API Resources** and click **Create API resource**.
1. Enter an **API Name** and a unique **API Identifier** (for example, `https://api.example.com/orders`).
1. Define **Permissions (Scopes)** such as `read:orders` and `write:orders`.
1. Navigate to **Roles** and click **Create role**.
1. Assign the API permissions to the role and click **Save**.
1. On the **Assign user** screen, select users from the list and click **Assign user**, or click **Skip** to assign them later from the **User management** tab.
1. Navigate to **Custom JWT** in the left sidebar if global roles must appear in access tokens. Configure an access token script to inject role claims into issued JWTs.
1. Navigate back to **API Resources** and open the API resource you created.
1. Click **Check guide** in the top-right corner. The console displays a **Select a tutorial** dialog with framework options such as Express, Python, and Spring Boot.
1. Select the framework that matches your application. The console tutorial displays step-by-step integration code for initializing the Logto SDK, protecting API routes, and validating the access token against your API identifier.

## Set Up Organizations for Multi-Tenancy

Organizations offer multi-tenant isolation, allowing you to build B2B applications where users belong to different corporate entities. An organization template serves as a blueprint, defining a consistent set of roles and permissions available to every organization in your Logto tenant.

1. Navigate to **Organization template** in the left sidebar.
1. Create **Organization permissions**. These are fine-grained, non-API actions that define business logic or UI features within an organization.
    1. Click **Create organization permission**.
    1. Enter a **Permission name** (for example, `read:resource`) and Description.
    1. Repeat the process to create other permissions such as `edit:resource` and `delete:resource`.
1. Create **Organization roles**. These are collections of organization permissions or API resource permissions that you can assign to members.
    1. Click **Create organization role**.
    1. Enter a name (for example, `Admin` or `Member`) and a description.
    1. Map the previously created organization permissions and any relevant API resource permissions to the role.
1. Navigate to **Organizations** and click **Create organization** to provision a new tenant.
1. Select the organization and navigate to the **Members** tab.
1. Click **Add Members** and select users from the list.
1. Assign an organization role to each member from the role dropdown. Logto scopes JWT tokens to include the organization context when organization-scoped tokens are requested.
1. Click **Check guide** in the top-right corner to view integration tutorials for implementing multi-tenant features and org-scoped tokens in your application.

## Register Applications

Register your frontend and backend services as applications within Logto to authenticate users and obtain tokens.

> [!NOTE]
> Specific steps vary depending on the application type, such as **Single-Page App**, **Traditional Web App**, **Native App**, or **Machine-to-Machine**. Use the framework-specific tutorial provided in the console for detailed instructions.

1. Navigate to **Applications** in the left sidebar.
    * **Initial Setup**: If no applications exist, the console displays a grid of supported frameworks and languages (for example, React, Next.js, Node.js). Select your preferred framework to view the integration tutorial and click **Start building** to create the application.
    * **Subsequent Applications**: If you have already registered an application, click **Create application** in the top-right corner to add another.
1. Enter your application name and click **Create application**.
1. Follow the Jumpstart guide to integrate Logto with your application.
1. Configure the **Redirect URIs**, which dictate where Logto sends users after a successful sign-in.
1. Configure the **Post Sign-out Redirect URIs** to determine where users land after logging out.
1. Note the **App ID** and integration endpoint to initialize the Logto SDK in the application code.
1. Click **Save changes**.

Register at least three application types to cover common architectures:

* **Single-Page App (SPA)**: For React, Vue, or Angular frontends.
* **Traditional Web App**: For server-rendered applications with a backend session.
* **Machine-to-Machine (M2M)**: For backend services that call the Management API or protected APIs without user interaction.

Open the application sign-in URL or use the Logto SDK in a test client to confirm the redirect-based sign-in flow completes successfully.

## Configure Webhooks

Webhooks offer real-time notifications for identity events, allowing your backend systems to react asynchronously to changes within Logto without continuous polling.

1. Navigate to **Webhooks** in the left sidebar and click **Create webhook**.
1. Enter the backend **Endpoint URL** and assign a descriptive name.
1. Select the specific **Webhook events** to monitor (for example, `User.Created`, `PostSignIn`, or `User.Data.Updated`).
1. Add optional **Custom headers** if the receiving endpoint requires authentication tokens or other metadata in the request.
1. Click **Create webhook**.
1. Secure the webhook. Logto provides a **Signing Key** in the webhook settings. Use this key to cryptographically verify that incoming payloads originated from the Logto instance and have not been tampered with.
1. Send a test payload to confirm the endpoint receives and processes webhook events.

## Verify the Deployment

After configuration, run the following checks to confirm the deployment is healthy end to end.

1. **Infrastructure**: Confirm all containers are running with `docker ps`. Traefik, Logto, and PostgreSQL should report an `Up` status.
1. **TLS**: Open `https://admin.example.com` and `https://auth.example.com` in a browser. Both should load with valid Let's Encrypt certificates.
1. **OIDC discovery**: Run `curl -s https://auth.example.com/oidc/.well-known/openid-configuration` and confirm the `issuer` matches `https://auth.example.com/oidc`.
1. **Admin Console**: Create the initial admin account and confirm the dashboard loads with all sidebar sections (Applications, Sign-in & account, MFA, Connectors, Enterprise SSO, API resources, Roles, Organizations, Webhooks, Audit logs).
1. **User registration and sign-in**: Register a test user through the application you created in the **Register Applications** section. Confirm password-based sign-in works.
1. **Social login**: If configured, test Google, GitHub, or Apple sign-in through the Live preview or application redirect flow.
1. **MFA**: Enable TOTP for a test user and confirm the second factor is enforced on the next sign-in.
1. **RBAC claims**: Request an access token for an API resource and verify the token contains the expected scopes after role assignment.
1. **Organization-scoped login**: Add a user to an organization, sign in, and confirm organization context appears in the token or session as documented in the organization integration tutorial.
1. **Audit logs**: Navigate to **Audit logs** in the Admin Console and confirm sign-in and configuration events are recorded.

## Migrate from Microsoft Entra External ID to Logto

Migrating from [Microsoft Entra External ID](https://learn.microsoft.com/en-gb/entra/external-id/) to Logto involves mapping external tenant and directory resources to Logto tenants, replacing MSAL or Microsoft Graph SDK calls with Logto SDKs, and reimplementing Entra External ID custom authentication extensions using Logto webhooks, Custom JWT, or external middleware. Because Microsoft Entra External ID does not provide an API to export password hashes, most migrations follow a bulk user import with mandatory re-authentication strategy. The guidance below assumes you completed **Deploy Logto with Docker Compose**, **Access the Admin Console**, and **Register Applications** earlier in this article.

### User Migration

Microsoft Entra External ID stores customer identities in a tenant and manages authentication through user flows or custom policies. Logto separates these responsibilities across users, the sign-in experience, applications, roles, and organizations within a self-hosted tenant.

* **Export**: Export user accounts using the Microsoft Graph API (`GET /users`) or Microsoft Graph PowerShell. Include attributes such as display name, email addresses, identities, and custom extension attributes.
* **Import**: Iterate over the exported data and create users through the [Logto Management API](https://openapi.logto.io/) on the Core endpoint (`POST /api/users` at `https://auth.example.com/api`). Authenticate with an access token from a Logto Machine-to-Machine application.
* **Passwords**: Microsoft Entra External ID does not allow password hashes to be exported. Import users with temporary credentials, send a password reset invitation, or if migrating from an intermediate system that stores password digests—use Logto's `passwordDigest` and `passwordAlgorithm` fields to import hashed passwords directly.
* **MFA enrollments**: Authenticator registrations, passkeys, phone methods, and other MFA enrollments cannot be exported. Users must re-enroll their MFA methods after migration.
* **Identity mapping**: Store the original Microsoft Entra `object ID (id)` in Logto `customData` (for example, `legacy_entra_object_id`) during import to preserve linkages in downstream application databases.

### Application Migration

Application changes depend on how clients currently integrate with Microsoft Entra External ID.

**If applications use Microsoft Authentication Library (MSAL)**, replace MSAL with the appropriate [Logto SDK](https://docs.logto.io/quick-starts/) for your framework:

* **Interactive sign-in**: Redirect-based Universal Login through the Logto hosted sign-in experience.
* **Application (Client) ID**: Logto Application ID (`client_id` in OIDC).
* **Redirect URIs**: Redirect URIs and Post Sign-out Redirect URIs configured in the Logto Console.
* **Token refresh**: Logto SDK session management or standard OIDC refresh token flows.

**If applications integrate directly with Microsoft identity platform endpoints**, replace those integrations with Logto's OIDC endpoints:

* **Authorization endpoint**: Replace Microsoft authorization endpoints with Logto's OIDC authorization endpoint.
* **Token endpoint**: Exchange authorization codes using Logto's token endpoint.
* **User profile**: Replace Microsoft Graph `/me` requests used only for authentication with the OIDC UserInfo endpoint or the Logto Management API where appropriate.
* **Access tokens**: Validate JWTs using the Logto JWKS endpoint (`https://auth.example.com/oidc/jwks`) with issuer `https://auth.example.com/oidc`.

In both cases, update backend middleware to validate Logto-issued JWTs instead of Microsoft Entra-issued tokens. Refer to the [Logto protect-your-api documentation](https://docs.logto.io/authorization/protect-your-api) for framework-specific examples.

### Role and Group Migration

Entra External ID provides Security Groups for directory-level membership and App Roles for application-level RBAC. Logto offers two mapping paths depending on whether these represent global permissions or tenant-scoped membership.

* **Entra External ID App Roles → Logto Roles**: Application role assignments that gate API access or admin capabilities map to global Roles. Create each role (`POST /api/roles`), define API resource scopes, and assign users (`POST /api/users/{userId}/roles`). Granted scopes are automatically included in access tokens when the token is requested for the associated API resource. To emit roles in a custom claim format, configure a Custom JWT access token script in the Admin Console.
* **Entra External ID Security Groups / Tenant boundaries → Logto Organizations**: Directory groups that represent business units, customer tenants, or corporate entities in a multi-tenant app map to Organizations. Create the organization (`POST /api/organizations`), define organization roles and permissions in the Organization Template, and add members with roles (`POST /api/organizations/{id}/users`). For tenant-scoped API access, assign organization-level scopes to organization roles.
* **Authorization Enforcement**: Update backend route guards and policy engines to validate Logto-issued access token scopes (via `scope` claim) and organization membership claims (via `organization_id` in ID tokens) rather than Entra ID's `groups` or `roles` claims.

### Custom Authentication Extension Migration

Entra External ID [custom authentication extensions](https://learn.microsoft.com/en-us/entra/identity-platform/custom-extension-overview) invoke an Azure Function at specific points in the authentication lifecycle (`onTokenIssuanceStart`, `onAttributeCollectionStart`, `onAttributeCollectionSubmit`). Logto does not support synchronous blocking hooks in the same way; each extension type maps to a different replacement with distinct operational characteristics.

* **Post-confirmation / Post-authentication (async)**: Map to Logto Webhooks for events such as `User.Created`, `PostSignIn`, or `User.Data.Updated`. Webhooks deliver HTTP payloads asynchronously after the auth flow completes. Refer to the [Logto webhook documentation](https://docs.logto.io/docs/recipes/webhook/).
* **Pre-token Generation (sync, claims modification)**: Map to **Custom JWT** access token scripts in the Admin Console. Scripts run in a sandbox during token issuance to inject roles, organization memberships, or custom attributes into the JWT.
* **Pre-authentication / Pre-sign-up (sync, blocking)**: Map to application middleware, API gateway rules, or a custom authentication proxy. Logto webhooks cannot block or reject an in-progress sign-in synchronously.
* **Custom Message**: Map to email or SMS connectors configured under **Connectors**, or handle notification logic in a webhook consumer that calls your messaging provider.

Unlike custom authentication extensions, which run synchronously inside the token issuance pipeline, Custom JWT scripts execute on every token issuance and webhook consumers run as always-on services. Account for this operational difference when planning capacity.

### Data Storage Considerations

For environments with existing identity data and active sessions:

* **Session Invalidation**: Entra External ID sessions and refresh tokens become invalid at cutover. Force re-authentication across all client applications and clear local session caches (including MSAL's browser cache).
* **Downstream Identity References**: Applications that store Entra External ID `object IDs` in their own databases rely on the `legacy_entra_object_id` mapping in Logto `customData` until those references are updated.
* **Management API Integration**: Replace calls to Microsoft Graph endpoints (`GET /users/{id}`, `PATCH /users/{id}`, `GET /users`) with the Logto Management API at `https://auth.example.com/api`. Authenticate M2M clients with a Logto Machine-to-Machine application.
* **Federation Metadata**: If Entra External ID federates external IdPs through SAML, WS-Fed, or OIDC (Enterprise Applications), recreate those federation relationships as Logto Enterprise SSO connectors or social connectors rather than attempting to migrate Entra's internal federation configuration directly.

### Things to Take Care During Migration

* **MSAL SDK to Logto SDK**: Interactive flows (popup/redirect) built on MSAL and any direct Graph API calls must move to redirect-based OIDC flows via Logto SDKs. Daemon/service apps using MSAL's client credentials flow map to Logto Machine-to-Machine applications. This is the largest application-code change in most migrations.
* **Custom Authentication Extensions**: Entra External ID supports synchronous, blocking extensions during token issuance. Logto webhooks are asynchronous only; blocking validation requires application middleware or an API gateway.
* **Identity Protection / Conditional Access**: Entra External ID Identity Protection and Conditional Access policies have no direct Logto OSS equivalent. Implement rate limiting, WAF rules, or bot protection at the reverse proxy layer, and re-evaluate any compliance controls that relied on Conditional Access.
* **MFA Re-enrollment**: TOTP secrets and WebAuthn/FIDO2 credentials cannot be extracted from Entra External ID. Users must re-enroll authenticator apps, passkeys, or SMS factors after cutover.
* **Token Format Differences**: Entra External ID access tokens use custom claims such as `roles`, `groups`, `oid`, and `tid`. Logto issues standard OIDC claims (`sub`, `email`, `scope`, `organization_id`). Update API parsers and authorization middleware accordingly.
* **Cost Model Change**: Entra ID pricing is per-user licensing across Free, P1, and P2 tiers, with features like Identity Protection gated behind P2. Logto OSS costs are infrastructure-based. Logto Cloud uses per-tenant or per-MAU pricing. Calculate total cost of ownership before cutover, including any compliance features you'd need to replace.
* **Cutover Sequencing**: Run a phased migration with dual-write or read-replica validation where possible. Import users first, validate token flows in a staging tenant, then redirect production traffic to Logto and disable sign-in through the Entra External ID app registrations. Maintain the Entra External ID tenant in a recoverable state for a defined rollback window. Keep `legacy_entra_object_id` mappings intact until all downstream systems are verified.

## Conclusion

You have deployed Logto behind a Traefik reverse proxy, configured the sign-in experience, social and enterprise SSO, MFA, RBAC, organizations, applications, and webhooks, and verified the deployment end to end. The migration section also covers the key steps and considerations for moving users and applications from Microsoft Entra External ID to Logto. For additional deployment options, advanced configuration, and SDK integrations, refer to the [official Logto documentation](https://docs.logto.io/).
