--- title: "Create an Entra ID User, Assign an E5 License, and Grant Global Administrator Role" slug: "dex-wf-create-user-e5-license-global-admin" updated: 2026-11-30T16:16:32Z published: 2026-11-30T16:16:32Z canonical: "documentation.sysaid.com/dex-wf-create-user-e5-license-global-admin" --- > ## 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. # Create an Entra ID User, Assign an E5 License, and Grant Global Administrator Role Provision a new Microsoft 365 user with mailbox, E5 licensing, and tenant-wide admin privileges. **Complexity:** Intermediate. **Impact:** privileged-access + user-provisioning + licensing + identity. ## Why use this workflow New-hire provisioning for privileged accounts is one of the most common and most sensitive IT administration workflows. When a new administrator, executive, or power user joins the organization, IT must create their Entra ID identity, provision an Exchange Online mailbox, assign the appropriate Microsoft 365 license (E5 for full security and compliance tooling), and grant the required directory role. This workflow walks through the end-to-end creation of a fully provisioned Entra ID user with a Microsoft 365 E5 license and the **Global Administrator** role. Because Global Administrator is the most powerful role in the tenant, reserve this workflow for break-glass accounts, founding IT staff, or identity team members, and ideally pair it with Privileged Identity Management (PIM) for just-in-time activation. Run this workflow when you onboard a new IT administrator, create a dedicated break-glass account, or provision a senior technical user who legitimately requires tenant-wide admin rights and full E5 capabilities. ## Expected outcomes - A new Entra ID user account with `displayName`, `givenName`, `surname`, `mailNickname`, and `userPrincipalName` populated - A secure, randomly generated initial password with `forceChangePasswordNextSignIn` enabled - A Microsoft 365 E5 license assigned (which provisions the Exchange Online mailbox and the other services included in the license) - Global Administrator directory role membership - `usageLocation` set (required for license assignment) - Verification output that confirms the account, license, mailbox, and role assignment are all in place ## Risks and considerations ### Privileged role warnings - **Global Administrator is the highest-privilege role in Microsoft 365.** Keep the number of permanent Global Administrators small. Consider assigning a lower-privilege role (User Administrator, Exchange Administrator, and so on) if the user does not need full tenant control. - **Enforce MFA immediately** on any newly created Global Administrator. A Conditional Access policy that requires MFA for admin roles is strongly recommended before the first sign-in. - **Use PIM for just-in-time activation** when possible. Assign the role as *eligible* rather than *active* so the user must justify and activate the role for each session. ### Licensing gotchas - `usageLocation` must be set on the user **before** license assignment, or the Graph call fails with a 400 error. - Confirm prepaid E5 units are available (`prepaidUnits.enabled - consumedUnits > 0`) before assignment. - Mailbox provisioning is asynchronous. The mailbox may take some time to become fully usable after license assignment. ### Password handling - **Deliver the initial password out-of-band** (for example, through a verified phone call or in person), never in the same channel as the UPN. - Always set `forceChangePasswordNextSignIn: true` so the user sets their own password on first sign-in. ## Required permissions | Permission | Why it's needed | | --- | --- | | User.ReadWrite.All | Create the user account and update profile fields | | Directory.ReadWrite.All | Assign licenses and directory role memberships | | RoleManagement.ReadWrite.Directory | Add the user to the Global Administrator directory role | | Organization.Read.All | Enumerate subscribed SKUs to confirm E5 license availability | | Domain.Read.All | Resolve the tenant's verified default domain for the UPN suffix | ## Ask Dex Paste the prompt into a Dex conversation. ### Prompt for IT admins ``` Create a new Entra ID user for {first_name} {last_name} with UPN {mail_nickname}@{domain}. Assign a Microsoft 365 E5 license, grant the Global Administrator role, ensure a mailbox is provisioned, set core profile fields, and return the initial password. ``` ## Manual steps (admin center) 1. Sign in to the [Microsoft 365 admin center](https://admin.microsoft.com) as a Global Administrator or User Administrator. 2. Go to **Users** > **Active users** > **Add a user**. 3. Fill in the **Basics** tab: - First name: `{first_name}` - Last name: `{last_name}` - Display name: `{display_name}` - Username: `{mail_nickname}` @ select your verified domain 4. Choose **Automatically create a password** (or set one manually) and select **Require this user to change their password when they first sign in**. 5. Select **Send the password in email upon completion** only if your security policy permits it. Otherwise, deliver the password out-of-band. 6. Select **Next**. ### Assign the E5 license 1. On the **Product licenses** tab, set the **Location** to the user's country (for example, United States). 2. Turn on **Microsoft 365 E5** (or **Microsoft 365 E5 Developer**). 3. Review the included apps and services. Leave the defaults unless you need to carve out specific service plans. 4. Select **Next**. ### Grant the Global Administrator role 1. On the **Optional settings** tab, expand **Roles**. 2. Select **Admin center access**, then select **Global administrator**. 3. Enter an **alternate email address** for password recovery (required for admin roles). 4. Select **Next**, review the summary, and select **Finish adding**. ### Verify provisioning 1. Go to **Users** > **Active users** > {display_name} and confirm the license shows as assigned and the mailbox status shows as provisioned. 2. In the [Microsoft Entra admin center](https://entra.microsoft.com), go to **Roles & admins** > **Global Administrator** and confirm the user appears as an active assignment. 3. **Immediately** enable Security Defaults or apply a Conditional Access policy that requires MFA for this user. ## Microsoft Graph API This workflow requires sequential calls: resolve the domain, enumerate SKUs, resolve the role, create the user, assign the license, and add the role member. All calls target `https://graph.microsoft.com`. ### Step 1: Resolve the default verified domain ``` GET /v1.0/domains?$select=id,isDefault,isVerified ``` Find the entry where `isDefault: true` and `isVerified: true`. Use its `id` as the UPN suffix. ### Step 2: Enumerate subscribed SKUs ``` GET /v1.0/subscribedSkus?$select=skuId,skuPartNumber,capabilityStatus,consumedUnits,prepaidUnits ``` Locate the SKU with a `skuPartNumber` of `SPE_E5` (production) or `DEVELOPERPACK_E5` (developer tenant). Confirm `prepaidUnits.enabled - consumedUnits > 0`. Record the `skuId`. ### Step 3: Resolve the Global Administrator role ID ``` GET /v1.0/directoryRoles?$filter=displayName eq 'Global Administrator' ``` If the role is not returned, it has not been activated in the tenant yet. Activate it with `POST /v1.0/directoryRoles` using the template ID `62e90394-69f5-4237-9190-012177145e10`. ### Step 4: Create the user ``` POST /v1.0/users Content-Type: application/json {  "accountEnabled": true,  "displayName": "{display_name}",  "givenName": "{first_name}",  "surname": "{last_name}",  "mailNickname": "{mail_nickname}",  "userPrincipalName": "{mail_nickname}@{verified_domain}",  "usageLocation": "US",  "passwordProfile": {    "forceChangePasswordNextSignIn": true,    "password": "{generated_password}"  } } ``` The `201 Created` response returns the new user's `id` (GUID). Capture it for subsequent calls. ### Step 5: Assign the E5 license ``` POST /v1.0/users/{user_id}/assignLicense Content-Type: application/json {  "addLicenses": [{ "skuId": "{e5_sku_id}" }],  "removeLicenses": [] } ``` Response `200 OK`. The Exchange Online mailbox begins provisioning, and the `mail` property populates after provisioning completes. ### Step 6: Add the user to the Global Administrator role ``` POST /v1.0/directoryRoles/{role_id}/members/$ref Content-Type: application/json {  "@odata.id": "https://graph.microsoft.com/v1.0/directoryObjects/{user_id}" } ``` Response `204 No Content`. ### Step 7: Verification ``` GET /v1.0/users/{user_id}?$select=id,displayName,userPrincipalName,mail,accountEnabled,usageLocation GET /v1.0/users/{user_id}/licenseDetails GET /v1.0/directoryRoles/{role_id}/members?$select=id,displayName,userPrincipalName ``` ## PowerShell Use the `Microsoft.Graph` PowerShell SDK to perform the full provisioning flow, generate a secure password, and return a structured result object. The flow must set `usageLocation` before license assignment, and must activate the Global Administrator role template if the role is not yet instantiated. ### Prerequisites - PowerShell 7 or later is recommended - Microsoft Graph PowerShell SDK: `Install-Module Microsoft.Graph -Scope CurrentUser` - Sign in with an account that holds **User Administrator** and **Privileged Role Administrator** (or Global Administrator) ### Approach 1. **Connect** to Graph with the minimum required scopes. 2. **Resolve** the default verified domain for the UPN suffix. 3. **Validate** that the target SKU exists and has available units. 4. **Check** for existing users that match the UPN (fail fast on duplicates). 5. **Generate** a cryptographically random password. 6. **Create** the user with `usageLocation` set. 7. **Assign** the E5 license. 8. **Activate** the Global Administrator role template if needed, then add the user as a member. 9. **Verify** and return a summary object.