Skip to main content
Graduate Track

Setting a User's Usage Location in Microsoft 365 So Licence Assignment Stops Failing

Licence assignment failing in Microsoft 365? Find users with no usage location, set it with Update-MgUser or Entra, then assign and check the licence state.

KBY Technologies13 min readFoundation11 min
Setting a User's Usage Location in Microsoft 365 So Licence Assignment Stops Failing

Before you begin

  • The User Administrator role, and License Administrator or User Administrator to assign licences.
  • The Microsoft Graph PowerShell SDK.
  • A test member account with no licence and no usage location.

If Microsoft 365 refuses to license a user, check their usage location first. Every licensed account needs a usage location: a two-letter ISO 3166-1 country code such as GB, US or JP stored on the user object as usageLocation. Microsoft only assigns a licence directly to an account that has one, because some services are not offered in every country. Set it with Update-MgUser -UserId <user> -UsageLocation GB, or on the user’s properties in the Microsoft Entra admin center, then assign the licence again.

The catch is that the gap does not always show up where you expect. Accounts synchronised from on-premises Active Directory have no usage location by default. Group-based licensing quietly fills the gap with the tenant’s own location, so a user can be licensed through a group for years and only fail when someone assigns a licence directly. And the usage location is not the same field as the country in the user’s contact details, so a profile that shows the right country can still have no usage location at all. This guide explains how the setting works, how to find every account without one, and how to set it and prove the licence then applies.

#What you will learn

  • Why Microsoft ties licensing to a country, and what the usage location actually records.
  • How the usage location differs from the user’s contact country.
  • Why direct and group-based licensing behave differently when the location is missing.
  • How to list every member account without a usage location using Microsoft Graph PowerShell.
  • How to set the location, assign a licence and read the result back.

#Before you begin

  • The User Administrator role, which can edit user properties, plus License Administrator or User Administrator to assign licences.
  • The Microsoft Graph PowerShell SDK on your workstation.
  • A test account with no licence and no usage location, agreed with whoever owns the tenant. A cloud-only test user is simplest.
  • One spare licence of any product you are allowed to assign to that test account.
  • The country the account really belongs in. The usage location is a legal and commercial setting, not a guess.

#Why a licence needs a country

A Microsoft 365 licence is a right to use a set of services, and not every service is offered in every country or region. Before Microsoft switches a service on for someone, it checks where that person will use it. The answer comes from usageLocation, which Microsoft’s Graph documentation describes as a two-letter country code that is required for users who are assigned licences, because of legal requirements to check service availability in countries and regions. Its examples are US, JP and GB. The value is not returned unless you ask for it, which is why a quick look at a user in PowerShell often shows nothing there.

It helps to think of the usage location as an input to licensing, not as part of the user’s profile. When a new user is created in the Microsoft 365 admin center, choosing a location is a required step, so cloud-created accounts normally have one. Accounts that arrive by directory synchronisation from on-premises Active Directory do not get one by default. That creates a predictable failure: if a batch of new starters syncs overnight and the service desk tries to license them directly in the morning, every assignment fails.

#
Usage location is not the contact country

Microsoft Graph stores two separate properties. country is part of the contact details: the country or region where the user is located, up to 128 characters, such as US or UK. usageLocation is the strict two-letter code that licensing reads. Filling in one does not fill in the other. The Microsoft Entra admin center shows the split if you look for it: its bulk edit, which can change up to 60 users at once, lists Country or region and Usage location as two separate entries. That bulk edit is also the quickest supported way to fix a handful of accounts without PowerShell. On a single user, Microsoft’s article puts location under the Settings category of the properties, alongside whether the user can sign in, rather than under contact information.

There is one more detail for synchronised users. Microsoft says that for accounts whose source of authority is Windows Server Active Directory, identity, contact and job details must be changed on-premises and wait for the next sync. Usage location is an exception, because it is a Microsoft Entra ID attribute: you can set it directly in the Entra admin center even for a synchronised user.

Person typing on a laptop displaying ChatGPT logo with a green vibrant setting.
Photo by UMA media on Pexels

#
Direct and group licensing handle a missing location differently

This is the part that confuses people most. With direct assignment, an account without a usage location cannot be licensed, and the attempt fails straight away. With group-based licensing, Microsoft does not fail: any member without a usage location inherits the tenant’s location. That is convenient when everyone works in the country the tenant was set up in. It is wrong for a user who works elsewhere, and it hides the missing value, so the first direct assignment later on is the one that breaks. For how licences flow through groups in the first place, see the KBY guide to group-based licensing in Microsoft Entra ID.

A location can also be present but unsupported. Microsoft lists “usage location isn’t allowed” as a group licensing problem: the location is missing or set to a country where one of the product’s services is not available. In the user’s licenseAssignmentStates, the error value for this is ProhibitedInUsageLocationViolation. The fixes Microsoft gives are to set the correct usage location, take users in unsupported locations out of the licensed group, and make sure the location is filled in when users are created.

Rendering diagram...

Read the flow from the top. The first question is how the licence arrives, because that decides what a missing value does. Both routes then meet the same second check, whether the product’s services are offered in the country, and that check is the one that produces ProhibitedInUsageLocationViolation.

#Finding accounts without a usage location

Everything in this section only reads. Connect with the scopes Microsoft documents for licence work, then list member accounts whose usage location is empty. Include -All: without it, Get-MgUser returns only the first 100 accounts, and a tenant-wide check that silently stops at 100 is worse than no check.

1Connect-MgGraph -Scopes User.ReadWrite.All, Organization.Read.All
2
3Get-MgUser -All -Select Id,DisplayName,Mail,UserPrincipalName,UsageLocation,UserType |
4  where { $_.UsageLocation -eq $null -and $_.UserType -eq 'Member' }

The output is one row per member account with no usage location. The filter keeps member accounts only, as Microsoft’s own version of this query does; guests are a separate decision. Save the list. It is your record of what was empty before you changed anything, and it is the list you will work through.

To see whether these accounts are a problem today or only a future one, cross-check them against unlicensed accounts. Microsoft’s documented query for accounts with no licences at all is:

Get-MgUser -Filter 'assignedLicenses/$count eq 0' -ConsistencyLevel eventual -CountVariable unlicensedUserCount -All

An account on both lists is waiting for a licence that will fail. An account with no usage location that does have licences is probably getting them through a group and running on the tenant’s location; check that the tenant’s country is right for that person before you leave it alone.

#A worked example

Take one synchronised account, new.starter@contoso.com, that needs a licence. First, read the two location fields and the sync flag side by side:

1$upn = 'new.starter@contoso.com'
2
3Get-MgUser -UserId $upn -Property DisplayName, UsageLocation, Country, OnPremisesSyncEnabled |
4  Select DisplayName, UsageLocation, Country, OnPremisesSyncEnabled

For a freshly synced account you would expect UsageLocation to be empty and OnPremisesSyncEnabled to be True, while Country may already hold a value. That combination tells the story. The profile can look complete because the contact country is there, but licensing reads a field that nothing has filled in. A direct Set-MgUserLicense for this account fails, and Microsoft’s admin center lists an invalid usage location among the common reasons for licence errors.

Set the usage location to the country the person actually works in. This is a state change, but a narrow one: it touches one attribute on one account, and because usage location is an Entra ID attribute it does not need to go back through on-premises Active Directory.

Update-MgUser -UserId $upn -UsageLocation GB

Read it back before you do anything else. Get-MgUser -UserId $upn -Property UsageLocation | Select UsageLocation should now show GB. Only then assign the licence, using the product’s part number from your own tenant:

1$sku = Get-MgSubscribedSku -All | Where SkuPartNumber -eq '<part number>'
2Set-MgUserLicense -UserId $upn -AddLicenses @{SkuId = $sku.SkuId} -RemoveLicenses @()
3
4(Get-MgUser -UserId $upn -Property DisplayName, Id, LicenseAssignmentStates).LicenseAssignmentStates

The last line is the proof. You want one entry for the new licence with State Active, an empty Error, and AssignedByGroup empty because you assigned it directly. If Error shows ProhibitedInUsageLocationViolation, the location is now present but the product includes a service that is not offered there; stop and take it to whoever owns licensing.

#Try it on a test account

Objective: see a licence assignment fail for want of a usage location, fix it, and leave the account as you found it apart from the location.

Setup: a test member account with no licence and no usage location, one spare licence, and the roles listed above. Do not use a real person’s account.

  1. Read the account with Get-MgUser -UserId $upn -Property DisplayName, UsageLocation, Country, OnPremisesSyncEnabled and note each value. UsageLocation should be empty.
  2. Try the licence: Set-MgUserLicense -UserId $upn -AddLicenses @{SkuId = $sku.SkuId} -RemoveLicenses @(). Copy the exact error text into your notes.
  3. Confirm nothing was assigned with Get-MgUserLicenseDetail -UserId $upn, which should return no licences.
  4. Set the location with Update-MgUser -UserId $upn -UsageLocation GB, using the right code for the account, and read it back.
  5. Run the same Set-MgUserLicense command again, then read LicenseAssignmentStates.
  6. Clean up: remove the licence with Set-MgUserLicense -UserId $upn -AddLicenses @() -RemoveLicenses @($sku.SkuId) and confirm Get-MgUserLicenseDetail is empty again.

Expected evidence: an error at step 2, no licences at step 3, GB (or your code) at step 4, and an Active assignment with no error at step 5. Pass condition: the only difference between the account at the start and after step 6 is the usage location. Stop condition: stop if step 2 succeeds, because then the account already had a location or the licence came another way and the exercise is not testing what you think, or if step 5 returns any error. The usage location stays on the account after clean-up. Microsoft Graph describes usageLocation as not nullable, so treat it as a lasting attribute and only ever set a code you are sure of.

Hands typing on a blue keyboard with a branded cup on a table.
Photo by Christina Morillo on Pexels

#How to check the fix held

Run the tenant-wide query from earlier again; the account should no longer appear. For a group-licensed user, the check is different because the group never failed in the first place. Open the user’s LicenseAssignmentStates and confirm the group’s licence is Active with no error, then look at the product in the Microsoft 365 admin center under Billing > Licenses and its Errors & issues tab. If the user was listed there with a location problem, select them and choose Reprocess once the location is fixed, so the licence is applied again with the current value. In the Entra admin center, the user’s properties should show the usage location under Settings, separate from the country under contact information.

#Where it goes wrong

  • Fixing the contact country instead of the usage location. They are different properties, and only one of them affects licensing.
  • Waiting for directory sync to fix it. Synchronised accounts have no usage location by default, so set it in Entra ID rather than waiting for another sync cycle.
  • Running the audit without -All and concluding the tenant is clean after the first 100 accounts.
  • Trusting group licensing to cover the gap. It uses the tenant location, which is wrong for anyone working in another country and hides the missing value until a direct assignment fails.
  • Setting every account to the tenant’s country in one pass to make the errors go away. The value is meant to reflect where each person uses the service.
  • Treating ProhibitedInUsageLocationViolation as a missing value. It can also mean the location is set but the product includes a service not offered there.

#Making it stick in production

The lasting fix is upstream. Microsoft’s advice is to populate the location when users are created, so build it into the joiner process: the cloud user creation form already requires it, and for synchronised accounts someone has to set it as part of onboarding, before the licence request. A scheduled read-only run of the audit query, reviewed by a person, catches the accounts that slip through. Changing the location of an account that is already licensed deserves more care than setting an empty one, because the services available can depend on the country; take those changes to the licensing owner rather than making them in a cleanup pass.

Keep the permissions narrow. Setting usage location needs a role that can edit users, and assigning licences needs License Administrator or User Administrator; neither needs Global Administrator. If you later automate the audit or the fix with an app registration rather than your own sign-in, give the app only the Graph permissions the job needs; the KBY article on scoping Microsoft Graph mail access with Exchange Online RBAC for applications shows the same least-privilege approach applied to mailbox access. Escalate when the right country is unclear, for example a user who works across borders, because that is a decision for licensing and legal owners rather than the service desk.

#Worth remembering

  • Direct licence assignment needs a usage location: a two-letter ISO 3166-1 code on the user object.
  • Synchronised accounts have none by default, and usage location can be set in Entra ID even for them.
  • Usage location and contact country are separate properties.
  • Group-based licensing falls back to the tenant location, which can hide the gap.
  • Audit with -All, set the location, read it back, then assign and read the licence state.

About this page

Credited to

Dates

Published

Sources

This page lists no external sources.

Corrections

No corrections are listed for this page. Some review sweeps corrected pages without naming each one; those are in the corrections log.

Reader Interaction

Comments

Add a thoughtful note on Setting a User's Usage Location in Microsoft 365 So Licence Assignment Stops Failing. Comments are checked for spam and held for moderation before appearing.

Loading comments...

Build practical engineering skills.

Receive new lessons, learning paths, practical exercises and early-career guidance.