We can update Microsoft 365/Azure AD user account properties (including usage location) with PowerShell using the cmdlets below:
For Single User Account:
Set-AzureADUser -ObjectID user1@abc.org -UsageLocation "FR"
Note: The cmdlets above will change the usage location for the single user account with the UPN user1@abc.org to France
For all the User Accounts:
To change properties for all users, you can use a combination of the Get-MgUser and Update-MgUser cmdlets. The following example changes the usage location for all users to France:
Get-MgUser | ForEach-Object { Update-MgUser -UserId $_.Id -UsageLocation "FR" }
This command instructs PowerShell to:
-
Get all of the information on the user accounts (Get-MgUser) and send it to the next command (|).
-
Set the user location to France (Update-MgUser -UsageLocation FR).
It is highly recommended to test the PowerShell cmdlets on a single or few users before applying it to all
the users.
Find more info:
Set-AzureADUser (AzureAD) | Microsoft Docs
Note: We can update UsageLocation user setting via Azure AD admin portal as well by going to Users --> All users --> Selecting the desired user --> Profile --> click Edit --> under Settings, select desired Usage location as shown in the image below
Comments
0 comments
Please sign in to leave a comment.