Microsoft Graph cannot directly create an Exchange Online mailbox. However, you can create a user in Microsoft Entra ID and assign a Microsoft 365 license that includes an Exchange Online service plan. This starts mailbox provisioning.
The examples below use the Microsoft Graph v1.0 REST API. Replace contoso.onmicrosoft.com, the user name, the password, and skuId with values for your environment. Do not store a password in source code or logs.
1. Create a user
First, create a user in Microsoft Entra ID. usageLocation is required for license assignment, so set it when you create the user. This example uses Japan (JP).
1 | POST https://graph.microsoft.com/v1.0/users |
The least-privileged permission for the create user API is User.Create for both delegated and application access. See Create user.
2. Find the skuId
To assign a license, you need the skuId of a subscription purchased by the tenant. The Microsoft Graph subscribedSku resource returns this value as skuId.
1 | GET https://graph.microsoft.com/v1.0/subscribedSkus?$select=skuPartNumber,skuId |
For example, the skuPartNumber for Microsoft 365 E3 is ENTERPRISEPACK. Find the actual skuId in your tenant before assigning the license. The least-privileged permission to list subscriptions is LicenseAssignment.Read.All. See List subscribedSkus.
3. Assign the license
Assign a license that includes an Exchange Online service plan to the new user. Set skuId to the skuId retrieved in step 2.
1 | POST https://graph.microsoft.com/v1.0/users/testUser05@contoso.onmicrosoft.com/assignLicense |
The least-privileged permission for the assign license API is LicenseAssignment.ReadWrite.All. For delegated access, an appropriate Microsoft Entra role such as License Administrator or User Administrator is also required. See Assign license.
The license assignment is now complete. When the Exchange Online service plan is enabled, the service starts mailbox provisioning. The time required depends on the environment, so check the mailbox after waiting for the service to finish provisioning.
You can use Microsoft Graph to check the user and license state. For mailbox-specific settings and status checks, use Exchange Online PowerShell or another Exchange Online administration tool.