Forum Discussion

Sahin Boluk's avatar
Sahin Boluk
Copper Contributor
Apr 24, 2020
Solved

Powershell to add apps to a licensed user

Hi, we are rolling out MS Teams to our users.  In doing so we are only enabling users with a E3 license and ONLY MS Teams.  We got that going with scripts and Powershell.  Now we want to add Streams ...
  • Ryan Steele's avatar
    Ryan Steele
    Apr 24, 2020

    Sahin Boluk Here is the PowerShell I used to re-enable all the features for the users with Office 365 E3 licenses in our tenant:

    Connect-AzureAD
    $license = New-Object -TypeName Microsoft.Open.AzureAD.Model.AssignedLicense
    $licenses = New-Object -TypeName Microsoft.Open.AzureAD.Model.AssignedLicenses
    $license.SkuId = (Get-AzureADSubscribedSku | Where-Object -Property SkuPartNumber -Value "ENTERPRISEPACK" -EQ).SkuID
    $licenses.AddLicenses = $license
    
    Get-AzureAdUser -All $true | foreach {if (($_.AssignedLicenses).SkuID -contains $license.SkuID) {Set-AzureAdUserLicense -ObjectID $_.UserPrincipalName -AssignedLicenses $licenses}}

    You could modify it to only enable a selection of features by setting the DisabledPlans property of the $license object as shown here: https://docs.microsoft.com/en-us/powershell/azure/active-directory/enabling-licenses-sample?view=azureadps-2.0

Resources