--- title: "Onboard your first tenant (MSP)" slug: "dex-onboard-first-tenant-msp" updated: 2026-11-30T13:03:24Z published: 2026-11-30T13:03:24Z canonical: "documentation.sysaid.com/dex-onboard-first-tenant-msp" --- > ## Documentation Index > Fetch the complete documentation index at: https://documentation.sysaid.com/llms.txt > Use this file to discover all available pages before exploring further. # Onboard your first tenant (MSP) MICROSOFT 365 · MSP ONBOARDING ~10–20 min 2 phases · 4 steps (Automated path) / 2 phases · 6 steps (Manual path) YOU'LL USE Dex Entra ## Before you begin Global Administrator rights in the customer's Microsoft 365 tenant. ## Phase 1: Set up your Dex environment Sign in, convert to multi-tenant, and start adding a client tenant. ### Step 1. Log in and convert to multi-tenant 4 min In Dex Open Dex, sign in, then turn your environment into a multi-tenant setup so you can manage multiple client tenants under one roof. Your region sets where data is stored: eu.dex365.ai keeps it in Europe, dex365.ai in the US. Pick before you sign in; it can't be changed later. 1. In the "Get Started with Dex" modal, sign in with Microsoft, Google, or Email. 2. Open Settings, scroll to the bottom of the General tab, and click Convert to multi-tenant. 3. Read the confirmation, then click Convert environment. **Converting is irreversible** Your current tenant becomes the first sub-tenant under a new global layer; billing and per-tenant budgets move to the global admin; discovery and data stay isolated per tenant. **Signing in as Global Admin?** If your Microsoft SSO account is a Global Administrator on the tenant, Dex can run discovery automatically. MSPs usually don't use Global Admin per client, hence the manual Entra app registration below. ### Step 2. Add your next tenant 2 min In Dex You're now on the global Overview, which shows all connected tenants and their status. The domain you logged in with is automatically added as your first tenant. Start registering the client tenant you want to onboard. 1. Click Add Tenant (top right). 2. Enter the Organization name (e.g. "Sunny Accounting Solutions"). 3. Under Select the tenant type, choose Microsoft 365, or Google Workspace to match the client's directory. 4. Selecting Microsoft 365 reveals three credential fields: Directory (tenant) ID, Application (client) ID, and Client secret. 5. Leave this dialog open. You'll fill these in from Entra in the next steps. **Connecting a Google Workspace tenant instead?** This guide covers the Microsoft 365 branch. If the client runs on Google Workspace, follow the Google Workspace tenant guide. ## Phase 2: Connect via Microsoft 365 Register Dex in the customer's tenant (with one PowerShell script or manually in Entra), then finish the connection in Dex. HOW DO YOU WANT TO REGISTER DEX IN THE CUSTOMER'S TENANT? - Automated, PowerShell script (Recommended · ~3 min): One script creates the app, secret, and all permissions, grants admin consent, and prints the three values. - Manual, Entra portal (~10 min): Click through the Entra admin center yourself: register the app, create a secret, and grant each permission. The steps below change based on your choice. Both paths end at the same place. ## Variant: Automated script ### Step 3. Run the automated setup script ~3 min Now in Microsoft Entra One PowerShell script registers Dex in the customer's tenant: it creates the app registration, creates the client secret, adds all 27 Microsoft Graph permissions, grants admin consent, and prints the three values Dex needs. Run it as a Global Administrator of the customer's tenant. WHERE DO YOU WANT TO RUN THE SCRIPT? - Azure Cloud Shell: Runs in the browser: nothing to install (recommended) - Local PowerShell: Windows, macOS, or Linux: modules auto-install ### Sub-variant: Azure Cloud Shell 1. Open a private/incognito browser window (so you don't mix up tenants) and go to shell.azure.com. 2. Sign in with a Global Administrator account of the customer's tenant. If prompted, choose PowerShell (not Bash) and "No storage account required" if offered. 3. Paste the command below into Cloud Shell and press Enter. 4. Sign in again when prompted (same Global Admin account) and accept the requested permissions: Application.ReadWrite.All and AppRoleAssignment.ReadWrite.All. This consent is for running the script, not for Dex itself. 5. When the script finishes, copy the three printed values: Directory (tenant) ID, Application (client) ID, and Client secret value. DOWNLOAD AND RUN (PASTE INTO CLOUD SHELL) ``` Invoke-WebRequest -Uri "https://download.dex365.ai/windows/Setup-DexTenant.ps1" -OutFile Setup-DexTenant.ps1; ./Setup-DexTenant.ps1 ``` ### Sub-variant: Local PowerShell 1. Download Setup-DexTenant.ps1 (link above) and save it to a folder, e.g. C:\Dex. 2. Open PowerShell (PowerShell 7+ recommended, Windows PowerShell 5.1 also works). No admin rights are needed on the computer, only on the tenant. 3. Allow scripts for this session, then run the script (commands below). It auto-installs the Microsoft.Graph modules to your user profile if missing. 4. Sign in with a Global Administrator of the customer's tenant when the browser prompt appears, and accept the requested permissions (Application.ReadWrite.All, AppRoleAssignment.ReadWrite.All). 5. When the script finishes, copy the three printed values: Directory (tenant) ID, Application (client) ID, and Client secret value. ALLOW SCRIPTS FOR THIS SESSION ``` Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass ``` RUN THE SCRIPT ``` ./Setup-DexTenant.ps1 ``` **Managing multiple tenants from one machine?** Force the right tenant explicitly: ./Setup-DexTenant.ps1 -TenantId "customer-tenant-id-or-domain.onmicrosoft.com". Optional parameters: -AppName (default "Dex") and -SecretMonths (secret lifetime, default 24). ### Notes for both sub-variants **Copy the client secret now** It's shown only once and can't be retrieved later. If you lose it, re-run the script or create a new secret in Entra. **That's it for Entra** The script registered the app, created the secret, and granted all 27 permissions. Continue to "Add the tenant in Dex" below and paste the three values. ### Step 4. Add the tenant in Dex See "Shared: Add the tenant in Dex" below (identical content; numbered Step 4 in this variant, Step 6 in the Manual variant). ## Variant: Manual Entra portal ### Step 3. Register a new app in Entra 3 min Now in Microsoft Entra Switch to the customer's Microsoft Entra admin center and create the app registration Dex will use to connect to this tenant. You'll need a Global Administrator account in the customer's tenant. 1. In the Entra admin center, under Entra ID, click App registrations. 2. Click + New registration. 3. Name: Dex (any name works: it's only shown to admins inside Entra). 4. Supported account types: Single tenant only. 5. Redirect URI: leave blank. 6. Click Register. You'll see "Successfully created application Dex." ### Step 4. Create a client secret 3 min In Microsoft Entra Generate the secret Dex uses to authenticate to the tenant. You'll paste its Value into Dex at the end. 1. In the app's left menu, click Certificates & secrets. 2. On the Client secrets tab, click + New client secret. 3. Description: Dex integration. 4. Expires: the longest option your security policy allows (24 months recommended). You'll need to rotate the secret before it expires. 5. Click Add. 6. Immediately copy the Value column (not the Secret ID). It's shown only once. **Copy the Value, not the Secret ID** The Value is a long string (e.g. starting lvl8Q~…) and is what works. The Secret ID is a GUID and will not work. If you navigate away before copying the Value, delete the secret and create a new one. ### Step 5. Grant the Microsoft Graph API permissions 5–7 min In Microsoft Entra This is the most important step. Dex needs a specific set of Microsoft Graph application permissions. If any are missing, the Add tenant validation fails and tells you exactly which roles still need consent. 1. In the app's left menu, click API permissions. 2. Click + Add a permission, then choose Microsoft Graph. 3. Choose Application permissions, not Delegated. 4. Search for and add each permission below: tick the checkboxes, click Add permissions, then repeat in batches. 5. Back on the API permissions page, click Grant admin consent for and confirm. 6. Every row's Status should turn into a green check (Granted for ). You should have 27 granted permissions. 27 permissions Microsoft Graph · Application CORE IDENTITY & DIRECTORY - User.ReadWrite.All: Create, update, disable, and delete users; reset passwords; manage licenses. - Directory.ReadWrite.All: Read and write directory objects (users, groups, devices) for org-wide operations. - Group.ReadWrite.All: Create and manage Microsoft 365 groups, security groups, and distribution lists. - GroupMember.ReadWrite.All: Add and remove members from groups. - UserAuthenticationMethod.ReadWrite.All: Manage MFA methods; register and reset authentication methods. AUDIT & SECURITY - AuditLog.Read.All: Read sign-in and audit logs for incident investigation. - Application.Read.All: Read app registrations and service principals during discovery. - RoleManagement.Read.Directory: Read directory role assignments to evaluate privilege. - BitlockerKey.Read.All: Retrieve BitLocker recovery keys for device recovery workflows. INTUNE / DEVICE MANAGEMENT - DeviceManagementApps.ReadWrite.All: Manage Intune app deployments. - DeviceManagementConfiguration.Read.All: Read Intune configuration and compliance policies. - DeviceManagementManagedDevices.PrivilegedOperations.All: Wipe, retire, remote lock, and reset managed devices. - DeviceManagementManagedDevices.ReadWrite.All: Read and update managed device records. EXCHANGE / MAIL - Mail.Send: Send notification and remediation emails from user mailboxes. - Mail.ReadWrite: Read and modify mailbox contents during investigation and cleanup. - Calendars.ReadWrite: Manage calendar events during onboarding / offboarding. - MailboxSettings.ReadWrite: Configure mailbox settings (forwarding, OOO, delegates). SHAREPOINT / FILES - Sites.Read.All: Read SharePoint site metadata for discovery. - Sites.ReadWrite.All: Manage SharePoint sites and lists. - Sites.FullControl.All: Required for site provisioning and permission management. - Files.Read.All: Read OneDrive / SharePoint files for investigation. - Files.ReadWrite.All: Manage files during offboarding and content cleanup. REPORTS & ORGANIZATION - Organization.Read.All: Read tenant info (display name, verified domains, licenses). - Reports.Read.All: Pull usage and activity reports for posture analysis. - ReportSettings.ReadWrite.All: Enable de-anonymized reports so user-level usage data is available. TEAMS - TeamsAppInstallation.ReadWriteForUser.All: Install the Dex Teams app for end users. - AppCatalog.ReadWrite.All: Upload and update the Dex Teams app in the tenant app catalog. All permissions are Application type on the Microsoft Graph API. Dex's validator checks for every one. If any are missing you'll get a MISSING_PERMISSIONS error listing exactly which roles still need consent. **Application permissions, not Delegated** Dex runs as a background service with no signed-in user, so every permission must be the Application type. Delegated permissions won't work, and remember to Grant admin consent, or the permissions stay inactive. ## Shared: Add the tenant in Dex (Step 4 in the Automated variant; Step 6 in the Manual variant.) 2 min Now in Dex Return to the Dex Add tenant dialog and enter the values you collected. The Organization name is just the label shown in your MSP dashboard. It doesn't need to match the M365 tenant name. 1. Return to the Dex Add tenant dialog. 2. Enter an Organization name (the label shown in your MSP dashboard). 3. Select Microsoft 365. 4. Paste the Directory (tenant) ID and Application (client) ID, from the script output, or the app's Overview page in Entra. 5. Paste the Client secret Value you copied earlier. 6. Click Add Tenant. The tenant appears in the Overview with status Onboarding. **Use the Directory (tenant) ID, not the Object ID** On the app's Overview page these sit close together and look similar. The Object ID here is 0f9a7661…; the Directory (tenant) ID is f28a4e02…. Dex needs the Directory (tenant) ID in the first field. **What Dex does when you click Add Tenant** Dex acquires an app-only token to verify the credentials, calls /organization on Microsoft Graph to confirm the tenant matches, looks up the service principal and its granted app roles, and compares them against the required list, reporting any that are missing. If everything checks out, the tenant appears as Onboarding and Dex automatically starts a discovery scan. ## Tenant added and active Dex has the tenant's credentials, finished onboarding, and the tenant now shows status Active in your Overview. Next, run discovery so Dex can map the tenant's users, groups, devices, and resources, then review and go live.