
kanakos.23654 (Customer) asked a question.
Question Regarding Office 365 License Assignment and Usage Location
Dear Okta Community Team,
We are currently integrating Office 365 with Okta.
After assigning an Office 365 license in Okta, we encountered the following error:
"errorMessage="License assignment cannot be done for user with invalid usage location."
Based on our investigation, we understand that this error occurs when the Usage Location attribute in Microsoft Entra ID is either not configured or contains an invalid value.
Currently, we have not configured a mapping to automatically populate Usage Location from the Okta user profile to Microsoft Office 365. Therefore, the Usage Location field is blank for these users.
However, after the error occurred, we attempted to assign the Office 365 license again manually through Okta, and the license was assigned successfully without any error.
Could you please clarify why the license can be assigned successfully on the second attempt even though the Usage Location has not been configured?
Additionally, we have noticed that some users can be assigned an Office 365 license without encountering this error. Could you please explain why license assignment succeeds for some users even when Usage Location is not mapped from Okta to Office 365?
Thank you in advance for your assistance.

Hello @kanakos.23654 (Customer) Thank you for posting on our Community page!
You are asking why the Office 365 license assignment in Okta succeeded on a second attempt without a Usage Location configured, and why some users are assigned licenses without this error when Usage Location is not mapped from Okta to Office 365.
Summary: The error occurs only when the user object in Microsoft Entra ID has no valid Usage Location at the moment the license is requested, so the outcome depends on each user's Entra ID state at the time of assignment.
Root Cause: Microsoft Entra ID requires a valid two-letter country code in the usageLocation
property before it can assign a license to a user. Okta does not populate this property unless an attribute mapping is configured. A license request that runs while usageLocation is empty fails with the "invalid usage location" error. The same request succeeds once a valid value exists on the user object. Any change to that user object in Entra ID between the two attempts explains the difference. Possible sources include a default Usage Location applied by a Microsoft 365 administrator, a value set by PowerShell or Microsoft Graph, or a value written by another provisioning or sync process.
Users who succeed without the error most likely already have a valid usageLocation
in Entra ID. This value may have been set manually, through an earlier process, or when the account was created in the Microsoft 365 admin center. Users with a blank value fail until the value is set.
Solution: Populate Usage Location from Okta so that every provisioned user has a valid value before the license is requested.
Manage all license assignments for this integration from the Okta side only. Licenses also changed directly in Microsoft 365 can be overwritten by later Okta pushes, which can make assignment results appear inconsistent between users.
Thank you for reaching out to our Community and have a great day!
--
Help others in the community by liking or hitting Select as Best if this response helped you.