Link to home
Start Free TrialLog in
Avatar of Olevo
OlevoFlag for Australia

asked on

Problem with setting the user's UsageLocation attribute in Set-MsolUser cmdlet

The Azure Active Directory Sync tool (aka DirSync) already has been setup here to synchronize on-premises Active Directory users to Office 365.

Assigning license within Office 365 admin center portal for one user is quite is easy. But, I don’t have much luck with doing similar stuff through the PowerShell.

I have Microsoft Online Services Sign-In Assistant and Azure AD Module already install on my Windows 8.1 workstation. I can Connect-MsolService with my Office 365 global admin account without any problem.
 
From my understanding, before I can assign a licence to a user using  Set-MsolUserLicense cmdlet with the -AddLicenses parameter we must set the user's UsageLocation attribute.
 
I’m trying to run this command:

Set-MsolUser -UserPrincipalName user1@mydomain.onmicrosoft.com -UsageLocation US

But, PowerShell is returning an error: Set-MsolUser : Access Denied. You do not have permissions to call this cmdlet.

Any idea why and what needs to be done to fix this error?

Thanks in advance
Avatar of Vasil Michev (MVP)
Vasil Michev (MVP)
Flag of Bulgaria image

Check the credentials you are connecting with. The cmdlet is correct, and there's no way you can prevent an GA from running it afaik.
Avatar of Olevo

ASKER

I have tried different Office 365 global admin account, the same "Access Denied" error?! Don't have any problem login onto Office 365 web portal with that global admin account.
Can you set the Usage location from the portal?
Avatar of Olevo

ASKER

Hmm..., don't have any problems with setting Usage Location when I log as O365Admin@mycompany.onmicrosoft.com but not much luck when I logged as O365Admin@mycompany.com Both accounts are Office 365 global admins. Well, I'm guessing that I have to use "onmicrosoft" from now on when I use PowerShell cmdlet's.
ASKER CERTIFIED SOLUTION
Avatar of Vasil Michev (MVP)
Vasil Michev (MVP)
Flag of Bulgaria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial