In office 365, with a license, all the Microsoft Apps and services associated within that licensing plan are enabled for the user by default. At organisation level, there is always a requirement to restrict the end-user from accessing certain app and services.
By the end of this discussion, we will understand how to disable specific services included with-in the license.
Below are the steps that we will discuss on how we can create and assign the custom licenses to users in Office 365 by disabling the unwanted services from the licensing plan –
- Finding SKU IDs of the licenses available in tenant
- Checking Services Specific to a license
- Creating Custom Licensing Options (Disabling selected Services/Apps within a license)
- Assigning the created licensing option to a specific user
- Assigning the licensing Option to bulk users
All the above tasks will be achieved through Powershell. There are two ways to implement – either through the MSOL service or Azure graph method in Powershell. I personally prefer working on MSOL, have included the implementation through the same.
Before moving further, please ensure that you have connected to Azure AD msol services as an Admin. Below is the command to achieve this –
Connect-MsolService
It will ask for the Admin credentials.
Table of Contents
Step 1: Finding SKU IDs of the licenses available in tenant
Below is the PowerShell command to get all the SKU IDs of available licenses in the tenant
Get-MsolAccountSku
Below is the expected result, showing from my test tenant –
PS C:\WINDOWS\system32> Get-MsolAccountSku AccountSkuId ActiveUnits WarningUnits ConsumedUnits ------------ ----------- ------------ ------------- incognitome:EMSPREMIUM 250 0 4 incognitome:M365_INSIDER_RISK_MANAGEMENT 25 0 3 incognitome:ENTERPRISEPACK 25 0 8 incognitome:AAD_PREMIUM_P2 100 0 4 incognitome:ENTERPRISEPREMIUM_NOPSTNCONF 25 0 5 incognitome:SMB_APPS 500 0 0 incognitome:SPE_E3 25 0 3
These SKU IDs are very important if you wish to implement changes in the licensing option through Powershell. To understand this, for example, in Powershell’s language, the “Azure Premium P2 license” for your tenant is “incognitome:AAD_PREMIUM_P2”. The common license name moving forward will be replaced by these SKU IDs in Powershell cmdlets. It is very important to note down the SKU ID of the license that you want to make changes to from this step.
Before moving
further, please refer to the below Microsoft Article to check the SKU
IDs against the common name of licenses and services.
Product
names and service plan identifiers for licensing
I would advise the readers to keep this article open while implementing further steps, this will be very helpful, and you might not be able to identify most of the services without referring to this article.
Step 2: Checking Services Specific to a license
For checking the available services to a specific license, execute the below command –
Syntax:
Get-MsolAccountSku | where {$_.AccountSkuId -eq “<AccountSkuId>”}).ServiceStatus
In my case, I will demonstrate the available services within the “Office 365 E3” license. The SKU ID for this license from my test tenant is “incognitome:ENTERPRISEPACK”
(Get-MsolAccountSku | where {$_.AccountSkuId -eq “incognitome:ENTERPRISEPACK ”}).ServiceStatus
Below is how it should look in PowerShell –
PS C:\WINDOWS\system32> (Get-MsolAccountSku | where {$_.AccountSkuId -eq “incognitome:ENTERPRISEPACK”}).ServiceStatus ServicePlan ProvisioningStatus ----------- ------------------ DYN365_CDS_O365_P2 Success MICROSOFTBOOKINGS Success KAIZALA_O365_P3 Success MICROSOFT_SEARCH Success WHITEBOARD_PLAN2 Success MIP_S_CLP1 Success MYANALYTICS_P2 Success BPOS_S_TODO_2 Success FORMS_PLAN_E3 Success STREAM_O365_E3 Success Deskless Success FLOW_O365_P2 Success POWERAPPS_O365_P2 Success TEAMS1 Success PROJECTWORKMANAGEMENT Success SWAY Success YAMMER_ENTERPRISE Success RMS_S_ENTERPRISE Success OFFICESUBSCRIPTION Success MCOSTANDARD Success SHAREPOINTWAC Success SHAREPOINTENTERPRISE Success EXCHANGE_S_ENTERPRISE Success
Step 3: Creating Custom Licensing Options (Disabling selected Services/Apps within a license)
Here we will create a custom licensing option depending upon the organization’s requirement. In my tenant, I need to disable the below 04 services within an E3 license –
- Yammer
- Microsoft Bookings
- PowerApps
- Microsoft Forms
Here is how we can create the licensing option for E3 license with above four services disabled –
We will create a licensing option and store that into a variable. I am defining the variable named “E3LicensingOptions1”
$E3LicensingOptions1 = New-MsolLicenseOptions -AccountSkuId incognitome:ENTERPRISEPACK -DisabledPlans YAMMER_ENTERPRISE,MICROSOFTBOOKINGS,POWERAPPS_O365_P2,FORMS_PLAN_E3
The custom E3 license option is now created as per our requirement mentioned previously and stored in the variable “$E3LicensingOptions1”
Below is how it should look in PowerShell –
PS C:\WINDOWS\system32> $E3LicensingOptions1 = New-MsolLicenseOptions -AccountSkuId incognitome:ENTERPRISEPACK -DisabledPlans YAMMER_ENTERPRISE,MICROSOFTBOOKINGS,POWERAPPS_O365_P2,FORMS_PLAN_E3 PS C:\WINDOWS\system32>
Step 4: Assigning the created licensing option to a specific user
Once the licensing option is created, it can be assigned to a specific user, multiple users, or all the users in tenant depending on the requirement. Below is the example in which I have assigned the licensing option to a single user for testing –
Before assigning the new licensing option –
Assigning the licensing Option to the user –
Set-MsolUserLicense -UserPrincipalName [email protected] -LicenseOptions $E3LicensingOptions1
Here is how it should look in PowerShell
PS C:\WINDOWS\system32> $E3LicensingOptions1 = New-MsolLicenseOptions -AccountSkuId incognitome:ENTERPRISEPACK -DisabledPlans YAMMER_ENTERPRISE,MICROSOFTBOOKINGS,POWERAPPS_O365_P2,FORMS_PLAN_E3 PS C:\WINDOWS\system32> Set-MsolUserLicense -UserPrincipalName [email protected] -LicenseOptions $E3LicensingOptions1 PS C:\WINDOWS\system32>
After executing the above command –
As we can see the 04 selected apps/services are unchecked and count reduced from 23 to 19.
Step 5: Assigning the licensing Option to bulk users
There can be multiple ways to assign the license to bulk users in any environment through Powershell. From what I had come across till now, creating a .csv file listing the UPN of required users and executing the below script with the licensing option created is the most feasible way.
I have created and saved a file in Desktop named “LicenseOptionsTest.csv” with few users under column “UPN”. Executed the below script and its working in my test tenant.
$users = import-csv "C:Users\amolj\Desktop\Microsoft\LicenseOptionsTest.csv" -delimiter ","
foreach ($user in $users)
{
Set-MsolUserLicense -UserPrincipalName $user.UPN -LicenseOptions $E3LicensingOptions1
}
I have simply imported the CSV file to a variable and ran the Set-MsolUserLicense command in a loop for all the users with the licensing option that we created before. The execution time of this command in my test tenant for 10 users is instant. I refreshed the Admin center and was able to see the changes there. Might take a few minutes if users are more than 100.
Below is the snapshot of my CSV file for reference –
Please feel free to drop your suggestions in the comment section if you need any additional information related to the content/methods followed in this article. I would appreciate your feedback and comments for any changes as this is a complicated implementation and I tried my best to simplify it.
If you are new to Microsoft Bookings, please do go though my other post to get few basics including How to block Microsoft Bookings Access in Tenant
Happy Learning!!!