{"id":1411,"date":"2016-03-24T16:00:01","date_gmt":"2016-03-24T21:00:01","guid":{"rendered":"http:\/\/osric.com\/chris\/accidental-developer\/?p=1411"},"modified":"2016-03-24T16:00:01","modified_gmt":"2016-03-24T21:00:01","slug":"set-msoluserlicense-a-parameter-cannot-be-found-that-matches-parameter-name-usagelocation","status":"publish","type":"post","link":"https:\/\/osric.com\/chris\/accidental-developer\/2016\/03\/set-msoluserlicense-a-parameter-cannot-be-found-that-matches-parameter-name-usagelocation\/","title":{"rendered":"Set-MsolUserLicense : A parameter cannot be found that matches parameter name &#8216;UsageLocation&#8217;"},"content":{"rendered":"<p>I wanted to apply an Office 365 (O365) license to a user via PowerShell:<\/p>\n<p><strong>PowerShell Command<\/strong><br \/>\n<code>Set-MsolUserLicense -UserPrincipalName \"johndoe@example.com\" -AddLicenses \"exampletenant:EXCHANGESTANDARD_ALUMNI\"<\/code><\/p>\n<p><strong>Error<\/strong><br \/>\n<code>Set-MsolUserLicense : You must provide a required property: Parameter name: UsageLocation<\/code><\/p>\n<p>Fine. What is this <em>UsageLocation<\/em> parameter? See <a href=\"https:\/\/technet.microsoft.com\/en-us\/library\/dn771770.aspx\">Assign licenses to user accounts with Office 365 PowerShell<\/a>:<\/p>\n<blockquote><p>You can assign licenses only to user accounts that have the UsageLocation property set to a valid ISO 3166-1 alpha-2 country code. For example, US for the United States, and FR for France.<\/p><\/blockquote>\n<p>OK, so US for United States.<\/p>\n<p><strong>PowerShell Command<\/strong><br \/>\n<code>Set-MsolUserLicense -UserPrincipalName \"johndoe@example.com\" -AddLicenses \"exampletenant:EXCHANGESTANDARD_ALUMNI\" -UsageLocation US<\/code><\/p>\n<p><strong>Error<\/strong><br \/>\n<code>Set-MsolUserLicense : A parameter cannot be found that matches parameter name 'UsageLocation'.<\/code><\/p>\n<p><em>Really, Microsoft?<\/em> Is it a required parameter or is it not a parameter? Make up your minds!<\/p>\n<p>Turns out, it&#8217;s a parameter of the Set-MsolUser cmdlet:<\/p>\n<p><strong>PowerShell Commands<\/strong><br \/>\n<code>Set-MsolUser -UserPrincipalName \"johndoe@example.com\" -UsageLocation US<br \/>\nSet-MsolUserLicense -UserPrincipalName \"johndoe@example.com\" -AddLicenses \"exampletenant:EXCHANGESTANDARD_ALUMNI\"<\/code><\/p>\n<p>The license was applied successfully.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I wanted to apply an Office 365 (O365) license to a user via PowerShell: PowerShell Command Set-MsolUserLicense -UserPrincipalName &#8220;johndoe@example.com&#8221; -AddLicenses &#8220;exampletenant:EXCHANGESTANDARD_ALUMNI&#8221; Error Set-MsolUserLicense : You must provide a required property: Parameter name: UsageLocation Fine. What is this UsageLocation parameter? See Assign licenses to user accounts with Office 365 PowerShell: You can assign licenses only to &hellip; <a href=\"https:\/\/osric.com\/chris\/accidental-developer\/2016\/03\/set-msoluserlicense-a-parameter-cannot-be-found-that-matches-parameter-name-usagelocation\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Set-MsolUserLicense : A parameter cannot be found that matches parameter name &#8216;UsageLocation&#8217;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[393],"tags":[376,375,228],"class_list":["post-1411","post","type-post","status-publish","format-standard","hentry","category-powershell","tag-o365","tag-office-365","tag-powershell"],"_links":{"self":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts\/1411","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/comments?post=1411"}],"version-history":[{"count":5,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts\/1411\/revisions"}],"predecessor-version":[{"id":1423,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts\/1411\/revisions\/1423"}],"wp:attachment":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/media?parent=1411"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/categories?post=1411"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/tags?post=1411"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}