For users to have full access to Office 365, they need Office 365 licenses assigned. To assign a license to a user, use the Set-MsolUserLicense command with the -AddLicenses parameter and review licensing assigned to a user.
The Set-MsolUserLicense command can be used to adjust the licenses for a user. This can include adding a new license, removing a license, updating the license options, or any combination of these actions.
In this scenario we are adding a license.
You must replace firstname.lastname@example.org with the name of the actual user and replace contso with the name of your Office 365 tenant.
Important: You must set the Usage Location for each user. The Usage Location specifies your country location. For example, in the United States, the usage location is US.
#Assigning Licenses in Office 365 #This first command will import the Azure Active Directory module into your PowerShell session. Import-Module MSOnline #Capture administrative credential for future connections. $credential = get-credential #Establishes Online Services connection to Azure Active Directory Connect-MsolService -Credential $credential #Before you can assign a license to a user, you must set the Usage Location for each user – represented by the two-character ISO code for that region. The Usage Location specifies the country in which the service is to be used, and determines which licensed features are available for that region for example, US is for the United States of America. Set-MsolUser -UserPrincipalName email@example.com -UsageLocation US #To view the list of available licenses, their SKU codes, and the quantity remaining for assignment, run the following command. Get-MsolAccountSku #You can now use the Set-MsolUserLicense cmdlet with the -AddLicenses parameter to assign the license, using the appropriate AccountSkuId returned from the previous step. You must replace firstname.lastname@example.org with the name of the actual user and replace contso with the name of your Office 365 tenant. Set-MsolUserLicense -UserPrincipalName email@example.com -AddLicenses contoso:ENTERPRISEPACK
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.