Dex

MSP Documentation

How to configure Microsoft 365

Create a Microsoft 365 app registration that Dex can use to manage a customer tenant. Takes about 5–10 minutes and requires Global Administrator on the customer's tenant.

Overview

This guide walks you through creating a Microsoft 365 app registration that Dex can use to manage a customer tenant. At the end you will have three values to paste into the Add tenant dialog:

  1. Directory (tenant) ID
  2. Application (client) ID
  3. Client secret value

The process takes about 5–10 minutes and must be performed by someone with Global Administrator (or Privileged Role Administrator + Cloud Application Administrator) on the customer's Microsoft 365 tenant.

App-only integration

Dex uses an application (app-only) integration — not a delegated user login. This means Dex can act on the tenant even when no user is signed in, which is required for autonomous remediation and scheduled discovery.

Before You Start

You will need:

  • A user account with Global Administrator rights in the customer's Microsoft 365 tenant.
  • Access to the Microsoft Entra admin center (or the Azure portal).
  • About 10 minutes.
1

Create the app registration

  1. Sign in to https://entra.microsoft.com as a Global Administrator of the customer tenant.
  2. In the left menu, go to Identity → Applications → App registrations.
  3. Click + New registration.
  4. Fill in:
    • Name: Dex (or any name — only shown to admins inside Entra).
    • Supported account types: Accounts in this organizational directory only (Single tenant).
    • Redirect URI: leave blank.
  5. Click Register.

You are now on the app's Overview page. Keep this tab open — you will copy two values from it shortly.

2

Copy the Tenant ID and Client ID

On the app's Overview page, copy these two values:

Field in EntraPaste into Dex as
Directory (tenant) IDTenant ID (first field)
Application (client) IDClient ID (second field)
3

Create a client secret

  1. In the left menu of the app, click Certificates & secrets.
  2. Under the Client secrets tab, click + New client secret.
  3. Fill in:
    • Description: Dex integration
    • Expires: choose the longest option your security policy allows (24 months recommended). You will need to rotate the secret before it expires.
  4. Click Add.
  5. Immediately copy the Value column (not the Secret ID). This is shown only once — if you navigate away you will need to create a new secret.

Paste this value into the Client secret field (third field) in the Dex Add tenant dialog.

Important

Copy the Value, not the Secret ID. The Value is a long string that starts with characters like 6CR8Q~…. The Secret ID is a GUID and will not work.

4

Grant API permissions

This is the most important step. Dex needs a specific set of Microsoft Graph application permissions. If any are missing, the Add tenant validation will fail and tell you exactly which roles still need consent.

4a. Add the permissions

  1. In the left menu of the app, click API permissions.
  2. Click + Add a permission.
  3. Choose Microsoft Graph.
  4. Choose Application permissions (not Delegated).
  5. Search for and add each permission listed below. You can add them in batches — search, tick the checkboxes, and click Add permissions, then repeat.

4b. Grant admin consent

After all permissions are added:

  1. Back on the API permissions page, click Grant admin consent for <tenant name>.
  2. Confirm. The Status column should turn into a green check (Granted for <tenant>) for every row.

Required Microsoft Graph application permissions

All permissions below are Application type, on the Microsoft Graph API. Dex's validator checks for every one of these — if any are missing, you will get a MISSING_PERMISSIONS error listing exactly which roles still need consent.

Core identity & directory

PermissionWhy Dex needs it
User.ReadWrite.AllCreate, update, disable, and delete users; reset passwords; manage licenses.
Directory.ReadWrite.AllRead and write directory objects (users, groups, devices) for org-wide operations.
Group.ReadWrite.AllCreate and manage Microsoft 365 groups, security groups, and distribution lists.
GroupMember.ReadWrite.AllAdd and remove members from groups.
UserAuthenticationMethod.ReadWrite.AllManage MFA methods, register/reset authentication methods.

Audit & security

PermissionWhy Dex needs it
AuditLog.Read.AllRead sign-in and audit logs for incident investigation.
Application.Read.AllRead app registrations and service principals during discovery.
RoleManagement.Read.DirectoryRead directory role assignments to evaluate privilege.
BitlockerKey.Read.AllRetrieve BitLocker recovery keys for device recovery workflows.

Intune / device management

PermissionWhy Dex needs it
DeviceManagementApps.ReadWrite.AllManage Intune app deployments.
DeviceManagementConfiguration.Read.AllRead Intune configuration and compliance policies.
DeviceManagementManagedDevices.PrivilegedOperations.AllWipe, retire, remote lock, and reset managed devices.
DeviceManagementManagedDevices.ReadWrite.AllRead and update managed device records.

Exchange / mail

PermissionWhy Dex needs it
Mail.SendSend notification and remediation emails from user mailboxes.
Mail.ReadWriteRead and modify mailbox contents during investigation and cleanup.
Calendars.ReadWriteManage calendar events during onboarding/offboarding.
MailboxSettings.ReadWriteConfigure mailbox settings (forwarding, OOO, delegates).

SharePoint / files

PermissionWhy Dex needs it
Sites.Read.AllRead SharePoint site metadata for discovery.
Sites.ReadWrite.AllManage SharePoint sites and lists.
Sites.FullControl.AllRequired for site provisioning and permission management.
Files.Read.AllRead OneDrive / SharePoint files for investigation.
Files.ReadWrite.AllManage files during offboarding and content cleanup.

Reports & organization

PermissionWhy Dex needs it
Organization.Read.AllRead tenant info (display name, verified domains, licenses).
Reports.Read.AllPull usage and activity reports for posture analysis.
ReportSettings.ReadWrite.AllEnable de-anonymized reports so user-level usage data is available.

Teams

PermissionWhy Dex needs it
TeamsAppInstallation.ReadWriteForUser.AllInstall the Dex Teams app for end users.
AppCatalog.ReadWrite.AllUpload and update the Dex Teams app in the tenant app catalog.
5

Add the tenant in Dex

  1. Return to the Dex Add tenant dialog.
  2. Enter an Organization name (this is the label that will show in your MSP dashboard — it does not need to match the M365 tenant name).
  3. Select Microsoft 365.
  4. Paste the three values you collected:
    • Tenant ID → from the app's Overview page
    • Client ID → from the app's Overview page
    • Client Secret → the Value you copied in Step 3
  5. Click Add Tenant.

Dex will:

1

Acquire an app-only token to verify the credentials are valid.

2

Call /organization on Microsoft Graph to confirm the tenant matches.

3

Look up the service principal and list its granted app roles.

4

Compare granted roles against the required list above and report any missing ones.

If everything succeeds, the tenant appears in your MSP dashboard and Dex automatically starts a discovery scan.

Troubleshooting

INVALID_CREDENTIALS

  • Double-check you pasted the Tenant ID (not the tenant domain like contoso.onmicrosoft.com).
  • Confirm the Client Secret is the Value, not the Secret ID.
  • Confirm the secret has not expired. Go to Certificates & secrets in Entra and check the Expires column.

MISSING_PERMISSIONS

  • The error response includes the exact list of missing permissions. Go back to API permissions in the app registration, add the missing ones, and click Grant admin consent again. Then retry Add Tenant.

SERVICE_PRINCIPAL_NOT_FOUND

  • The app registration exists but no service principal (Enterprise Application) has been created in the tenant yet. This usually means admin consent has never been granted. Click Grant admin consent for <tenant> under API permissions — that step creates the service principal as a side effect.

TENANT_ALREADY_BOUND

  • This M365 tenant is already linked to another Dex organization. Contact your Dex administrator.

Rotating the secret later

Client secrets expire. To rotate without downtime:

  1. In the app's Certificates & secrets page, create a new client secret.
  2. In the Dex MSP dashboard, open the tenant and update its credentials with the new secret Value.
  3. Once Dex confirms the new secret works, delete the old secret in Entra.

Summary checklist

  • Registered a new app in Entra → App registrations (Single tenant).
  • Copied Directory (tenant) ID and Application (client) ID.
  • Created a Client secret and copied its Value.
  • Added all required Microsoft Graph application permissions listed above.
  • Clicked Grant admin consent for the tenant — every row shows a green check.
  • Pasted the three values into Dex Add tenant and clicked Add Tenant.