• Server News
  • Virtualization

Logo

How to Check Office 365 License Usage & History

Nirmal Sharma

ServerWatch content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More .

The Get-MsolUser PowerShell cmdlet plays an important role when managing Office 365 Windows Azure Active Directory. Get-MsolUser can be very handy in daily operational tasks related to Office 365 WAAD.

Windows Server Tutorials

This information helps organizations plan for IT budgets, save money by removing licenses from users that no longer use Office 365, and control the assignment of Office 365 licenses and services.

This article highlights some valuable Office 365 PowerShell commands and scripts that can help you easily obtain the license information for all Office 365 users and view those reports in either the PowerShell window or a .CSV file.

If you have installed Microsoft Online Sign-In Assistant for IT Professional and Windows Azure Active Directory Module for Windows, you can execute the PowerShell commands/scripts explained in this article.

Getting Licensed Office 365 Users

A user must be assigned an Office 365 license before he or she can use Office 365 services. The license can be assigned during the user creation process or at a later point of time.

To get the list of users that are assigned an Office 365 license and store the output in a .CSV file, you can run this command:

Get-MSOluser -ALL | Select-Object UserPrincipalName, DisplayName, IsLicensed | Export-CSV AllLicensedUsers.CSV -NoTypeInformation

Get-MSOlUser identifies the “IsLicensed” attribute for every user that is set to “True,” which indicates that an Office 365 user is assigned an Office 365 license. The command retrieves the User Principal Name, Display Name and value assigned to the “IsLicensed” property for each user.

In cases where you need to view the list of Office licenses and services assigned to a particular user, you can use this PowerShell cmdlet:

$GetUserLicenses = Get-MsolUser -UserPrincipalName "[email protected]" | Select-Object userPrincipalName - ExpandProperty Licenses $GetUserLicenses .ServiceStatus

And if you wish to retrieve the licensing information for all Office 365 users, replace the “-UserPrincipalName” parameter with the “-ALL” parameter as shown in this command:

$GetUserLicenses = Get-MsolUser -All "[email protected]" | Select-Object userPrincipalName - ExpandProperty Licenses $GetUserLicenses .ServiceStatus

These commands display the output in the PowerShell window, but this output might not be as useful as you need.

Instead, you can create a script to store the information in a .CSV file and then run the script daily to ensure you have an up-to-date account of the Office 365 licenses assigned to users. You can then use the report to remove licenses as needed.

Getting Licenses Count for All Users

First use a command to get a list of users in Office 365 Tenant, a count of Office 365 Plans that you have bought, the total Office 365 licenses available, and the count of licenses assigned to Office 365 users. Use this PowerShell script to get that information in a .CSV file:

$LicenseReport = " C:TempLicenseReport.CSV " IF ( test-Path $LicenseReport ) { Remove-item $LicenseReport } $AllUsers = ( Get-MSOluser -ALL ).Count $TotalLicenseUsers = ( Get-msoluser -ALL | Select-Object UserPrincipalName -ExpandProperty licenses).Count $PlanCount = ( Get-MsolAccountSku ).Count $TotalLicenses = Get-MsolAccountSku | Measure-Object ActiveUnits -Sum $STR = " Total Users: " + $AllUsers Add-Content $LicenseReport $STR $STR = " Total Office 365 Plans: " + $PlanCount Add-Content $LicenseReport $STR $STR = " Total Office 365 Licenses in Plan: " + $TotalLicenses .Sum Add-Content $LicenseReport $STR $STR = " Total Licenses Assigned: " + $TotalLicenseUsers Add-Content $LicenseReport $STR

That PowerShell script generates a report named LicenseReport.CSV in the C:Temp folder. The script removes the previous report file and generates a new one every time you run it.

A report generated by using that script looks like this:

Office 365 PowerShell Report #1

Getting Licenses Assigned to each Office 365 User

Perhaps you need more specific information than a total count of licenses for all Office 365 Users. Instead, you might need a report that contains the Office 365 user name and Office 365 Plan, licenses, and services assigned to each user. You can use this PowerShell script to pull that report:

$UserLicFile = " C:TempUserLicensesPerUser.CSV " IF ( test-Path $UserLicFile ) { Remove-Item $UserLicFile } $STR = " User Principal Name, Office 365 Plan, Office 365 Service,Service Status " Add-Content $UserLicFile $STR $GetAllUsers = Get-MsolUser -All | Select-Object UserPrincipalName -ExpandProperty Licenses ForEach ( $AllU in $GetAllUsers ) { $SelUserUPN = $AllU .UserPrincipalName $T = $AllU $i = 0 ForEach ( $AllITems in $T ) { $T .Count $T [ $i ].AccountSkuId $Account = $T [ $i ].AccountSkuId $TTT = $T [ $i ].ServiceStatus ForEach ( $AllR in $TTT ) { $GR = $AllR .ServicePlan.ServiceType $GZ = $AllR .ProvisioningStatus $STRNow = $SelUserUPN + "," + $Account + "," + $GR + "," + $GZ Add-Content $UserLicFile $STRNow } $i = $i + 1 } }

That PowerShell script generates a report file in .CSV format that contains the license information for all of your Office 365 users.

Below is a sample report generated by this PowerShell script. It displays the Office 365 user principal name to which the office 365 license is assigned, the Office 365 plan from which the license is assigned, Office 365 Services that are assigned, and the status of individual services.

Office 365 PowerShell Report #2

To help you get a clear picture of the Office 365 licenses in use in your organization, you will want to run both of the scripts provided in this article.

Nirmal Sharma is a MCSEx3, MCITP and Microsoft MVP in Directory Services. He specializes in directory services, Microsoft Azure, Failover clusters, Hyper-V, System Center and Exchange Servers, and has been involved with Microsoft technologies since 1994. In his spare time, he likes to help others and share some of his knowledge by writing tips and articles on various sites and contributing to Health Packs for ADHealthProf.ITDynamicPacks.Net solutions. Nirmal can be reached at [email protected] .

Follow ServerWatch on Twitter and on Facebook

Get the Free Newsletter!

Subscribe to Daily Tech Insider for top news, trends & analysis

Latest Posts

What is a container understanding containerization, what is e-waste what you need to know, what is a print server | how it works and what it does, 6 best linux virtualization software for 2024, 5 top benefits of virtualization, related stories.

Logo

Subscribe for Practical 365 updates

Please turn off your ad blocker and refresh the page to subscribe.

You may withdraw your consent at any time. Please visit our Privacy Statement for additional information

Managing Office 365 Licenses with the Azure AD V2 PowerShell Module

Avatar photo

Table of Contents

Update: Because of the deprecation of the Azure AD and Microsoft Online Services PowerShell modules, Practical365 recommends that you use the Microsoft Graph PowerShell SDK to manage licenses for Microsoft 365 accounts. See this article for details about how to create a licensing report with SDK cmdlets.

In Office 365 we have three methods of managing license assignments for individual or multiple user accounts.

  • Using the Office 365 admin portal
  • Using Azure AD group-based license management
  • Using PowerShell

The Office 365 admin portal provides a simple web interface for managing license assignments. It’s easy to add a license for a user, or for multiple users, enable or disable sub-SKU features (the individual services that are included in a license), or remove a license. Licenses for multiple users can be managed at the same time. This method is useful for ad-hoc license management, or for bulk assigning licenses when you first provision an Office 365 tenant. The web interface is friendly for even a non-technical user, so license management tasks can be delegated to people outside of IT support if necessary.

Azure Active Directory group-based licensing, which I wrote about here , simplifies license management by mapping license assignments to groups. License management for end users is then a simple task of adding or removing users in groups, and doesn’t require the ongoing use of Office 365 management tools.

In this article I’m going to demonstrate how to manage Office 365 licenses using PowerShell. This is more complex than either of the previous methods, but is useful for automating license assignments as part of a user provisioning process. PowerShell is also a good method for querying license usage and generating your own custom reports for license consumption, which can help you to manage your costs over time.

We’ll look at:

The Azure AD V2 PowerShell Module

Listing available licenses, querying license assignments for user accounts, assigning a single license using powershell, assigning multiple licenses using powershell, assigning licenses with sub-sku features disabled, removing licenses using powershell.

License management in Office 365 is performed using the Azure Active Directory PowerShell module . The first version of this PowerShell module is also known as the MS Online module, and uses cmdlets with “Msol” in the name, for example Connect-MsolService and Get-MsolUser.

While the MS Online module is still available today, it will be deprecated in the near future. A new Azure Active Directory PowerShell V2 module has been developed to replace it. This module is also known as the Azure AD module. The Azure AD module uses the Office 365 Graph API to interact with Office 365. Microsoft aims to migrate the functionality of the MS Online module to the Azure AD module, and recommends that you use Azure AD for any script development. In this blog post I will demonstrate license management using the Azure AD module.

The Azure AD module is installed using PowerShellGet, which is included with Windows Management Framework (WPF) 5.0 (PowerShell 5.0). Windows 10 and Windows Server 2012 R2 or later ship with PowerShell 5.0 installed by default, which means that PowerShellGet is already available. For earlier operating systems, you’ll either need to upgrade to WMF 5.0, or install PowerShellGet for PowerShell 3.0 or 4.0. Some applications such as Exchange Server are sensitive to changes in the version of WMF that is installed on the system, so you should not upgrade WMF until you’ve verified that all your installed software will continue to work

After the Azure AD module is installed you can connect to your Office 365 tenant by running the Connect-AzureAD cmdlet, and then entering your admin credentials when prompted. The Azure AD module supports the use of multi-factor authentication (MFA).

To explore the available cmdlets in the Azure AD module, run the following command.

As a side note, Connect-AzureAD will work with stored credentials function as long as your account does not require MFA or you’re connecting from a network that allows MFA to be bypassed.

get license assignment date

The Get-AzureADSubscribedSku cmdlet is used to query the licenses that your organization has subscribed to in Office 365.

A more detailed view of the licenses that are enabled and consumed is available by expanding the PrepaidUnits property.

In the output above we can see that my tenant has 25 “ENTERPRISEPACK” licenses, and 5 “EMS” licenses. The SkuPartNumber  for each does not precisely match the name of the license that you’ll see in Office 365 documentation or in the license management sections of the Office 365 admin portal. For example, ENTERPRISEPACK is the SkuPartNumber for the Enterprise E3 license, while EMS is the SkuPartNumber for the Enterprise Mobility and Security E3 license. A complete list of part numbers and friendly names isn’t available on Microsoft online documentation sites, although with a little searching and common sense you can usually work out what they mean. If there’s any confusion, opening a support ticket with Microsoft will get you the answers you need.

The individual license features and services, also referred to as sub-SKU features, can also be inspected. As with the SkuPartNumber values, the ServicePlanName values are not a match for the friendly names that you see in the Office 365 or Azure admin portals, but names like SWAY , POWERAPPS_O365_P2 , and EXCHANGE_S_ENTERPRISE are obvious. Others are not so obvious, such as MCOSTANDARD (Skype for Business Online), but again some searching online will usually clear up any confusion.

There are two user properties that reveal the license assignments for a user. The first is the AssignedLicenses property, which can be retrieved using Get-AzureADUser .

In the output above we can see the SkuId of the license that is assigned to the user. The matching license can be found by running Get-AzureADSubscribedSku, which in the ouput below we can see is the ENTERPRISEPACK license (Enterprise E3).

The Get-AzureADUser output shown above also reveals the DisabledPlans property. This property contains the ServicePlanId values of the sub-SKU features that have been disabled for the user. There are two ways to match those ServicePlanId values to the actual names of the sub-SKU features. The first is to use the output of Get-AzureADSubscribedSku to view the ServicePlanId values for the individual services, as demonstrated earlier. For the example of Jane Tulley, the ID of the disabled plan is “7547a3fe-08ee-4ccb-b430-5077c5041653”, which is YAMMER_ENTERPRISE in the list of service plans for the ENTERPRISEPACK license.

The other approach is to look at the AssignedPlans property of the user.

In the output above we can see that the “YammerEnterprise” service is suspended, and has a ServicePlanId matching the ID in the list of DisabledPlans we saw earlier.

You will also notice that the service names returned in the Get-AzureADUser output do always not match the service plan names returned in the Get-AzureADSubscribedSku output. For example, Get-AzureADUser shows a service name of “TeamspaceAPI” whereas Get-AzureADSubscribedSku shows the same service as “TEAMS1”. These differences are mildly irritating but do reinforce the idea that you should match two difference pieces of data by the ServicePlanId, not by the friendly name, whenever you are running PowerShell cmdlets or writing scripts to manage your licenses.

For administrators who are familiar with using the MS Online PowerShell module to manage licenses, there is one minor difference to be aware of. The Get-AzureADUser and Get-MsolUser cmdlets return slightly different information for the same user object. Get-AzureADUser will only return sub-SKU features that are Enabled, Deleted or Suspended, whereas Get-MsolUser will return the status of all sub-SKU features. Here’s an example, using an account where I’ve disabled several sub-SKU features to demonstrate the differences in cmdlet output.

The Set-AzureADUserLicense cmdlet assigns and removes Office 365 licenses to user accounts. A simple example is assigning a license to a new user account. Before assigning the license, the usage location of the account also needs to be configure. The license assignment process involves a series of steps to:

  • Create an assigned license (singular) object
  • Add the assigned license object to another object representing the assigned licenses (plural)
  • Run Set-AzureADUserLicense and provide the value for the assigned licenses (plural)

To perform those steps we need to know the ObjectId of the user account, and the SkuId of the license.

Now we can go ahead and create the license assignment.

The user now has a single license SKU assigned, and the plans for that license are enabled.

get license assignment date

Using the same steps as above you can assign an additional license to a user. For example, if we wanted to add the EMS license to the user who is already licensed for Enterprise E3, we could simply re-run the steps above using the SkuId for the EMS license.

If you would like to assign multiple licenses at the same time you can do so with just a small modification to the process. Remember, we’re creating an assigned license (singular) object, and adding it to an assigned licenses (plural) object. We can add multiple assigned license (singular) objects by repeating those commands. Here’s an example of licensing a user for Enterprise E3 and EMS at the same time.

The user now has multiple license SKUs assigned, and the services for both of those SKUs are enabled.

In the output above you might notice that Intune, which is included with the EMS license, is not listed as a service. This is another example of how Get-AzureADUser doesn’t show services that are not in an enabled, suspended, or deleted state. Intune requires activation for the user, and is in a “PendingInput” state when the license is initially assigned to the user as you can see in the Get-MsolUser output below.

Office 365 licenses such as Enterprise E3 and E5 allow access to multiple services and applications. For some organizations it is required to disable some of the features of a license, either because the feature should not be used in that environment, or simply to manage a staged roll out and adoption of Office 365 features.

To assign a license with sub-SKU features disabled we use the same process demonstrated earlier, but this time we need to configure the license object with enable and disabled plans before applying the license to the user. For this example I’ll assign an E3 license but only enabled the Exchange Online mailbox and the Office 365 ProPlus applications.

The user now has the license SKU assigned, but with multiple disabled plans. Only the two enabled features are showing as enabled services for the user as well.

For the final demonstration in this article let’s look at how to remove an assigned license using PowerShell. The Set-AzureADUserLicense cmdlet is used for this task, and the process is similar to adding a license. The difference is that when creating the assigned licenses (plural) object we use RemoveLicenses instead of AddLicenses, and provide only the SkuId instead of the full license object.

The user has now had each of the previously licensed features marked as deleted due to the license being removed.

As you can see, managing Office 365 licenses with the Azure AD V2 PowerShell module is a complex task at first, but once you’ve performed the steps a few times it should become much more comfortable. Azure AD group-based license management is simpler, but won’t fit everyone’s needs. Using PowerShell to manage licenses like this will suit organizations who want to automated license assignments into other processes. The use of the Graph API also means you can ignore the Azure AD module itself and write custom code to interact with the REST API to perform the same tasks. That is out of scope of this blog post, but it’s something you can explore if custom development and integration into third party systems is a requirement for you.

About the Author

Avatar photo

Paul Cunningham

Avatar photo

Nice post. For Azure consulting services visit TechTriad

For years I have been running a detailed report of User licensing built from 3 commands: Get-MsolSubscription Get-MsolAccountSku Get-MsolUser -ALL The report splices out which part of the business owns which subscription and what users are using what licensing.

Now I need to use AzureAD or mgGraph modules and they each hae a command to view the licenses and sku’s but not to see the individual subscriptions.

Do you know a replacement for the Get-MsolSubscription command?? Thanks

Avatar photo

Does https://practical365.com/create-licensing-report-microsoft365-tenant/ help?

Pingback: Microsoft Grants Extension for Azure AD License Management Cmdlets

In the article, you state that the documentation does not provide a human understandable list for the skupartnumbers. I found it, after a looooooong search over here: https://docs.microsoft.com/en-us/azure/active-directory/enterprise-users/licensing-service-plan-reference

This Microsoft “Docs” URL *would* be nice, but in fact, it’s once more just a shame. Microsoft writes:

“These tables are for reference purposes and are accurate only as of the date when this article was last updated. Microsoft does not plan to update them for newly added services periodically.”

Obviously, Microsoft doesn’t value their customers that much to keep “Docs” up to date… or at least provide a service that always offers the latest license information with all this mess: String_IDs, SKUs, GUIDs, etc. etc.

But it’s actually much worse: Microsoft cheats the many millions of customers by charging licenses multiple times.

Of course I can prove this very easily 🙂

Can you pls brief on the warning key in the Prepaid Units.

Great article. How can I get the report for all the o365 licenses assigned to a list of users ?

For eg: My userlist file is C:\UserNamesInput.txt

Hello Paul, thank you very much for th clear exmaples.

Very usefull.

Best regards. Aleksej

It covers all most everything in Azure AD user Licensing, Very helpful article.

Thanks for Sharing.

Thank you for this article and write-up. Removing a license(s) from users individually or in bulk seems straightforward.

Say we have users leave the org. Accounts and licenses are removed from the user, but the licenses remain in O365 as unassigned and costing money. What I am looking for is the powershell method of deprovisioning unassigned licenses in O365 down to the assigned number. Why pay for licenses we’re not using?

How do we distinguish between a CSP License and an EA License?

I’m trying to construct a report that will show me all my Azure users and what licenses they have assigned.

For Example: Each User is assigned “Office 365 Enterprise E3” but then inside of “Office 365 Enterprise E3” you have 18 services that can be enable/disabled.

The Ideal would be to create a report on each Product (Office 365 Enterprise E3) then cycle through all the users showing what each user has enabled.

Has anyone got a PowerShell script that could help with this?

VERY HELPFUL In my ignorance, I opened a ticket to Microsoft support and they are not able to give me such detailed answers… By chance I happend to get to this mistery of licenses assignements dates I was looking for… Thanks to you and Internet Riccardo

I’m trying to remove Yammer from all accounts with a mixture of licenses. I have tried to digest your samples but I’m still unsure how to disable specific Sub Features on an existing license. Is this possible or does the script have to reapply the license with Yammer switched off?

First of all thank you for article.

I would like to get information about users + licensing, I did this code: Get-AzureADUser | Select DisplayName,mail,Department,CompanyName,UsageLocation,AssignedLicenses -ExpandProperty AssignedLicenses | Where {$_.SkuId -eq “6fd2c87f-b296-42f0-b197-1e91e994b900” -or $_.SkuId -eq “4b585984-651b-448a-9e53-3b10f069cf7f”} | ft -a

Could I show the SkuId name in result? Like: DisplayName | Mail | Department | CompanyName | UsageLocation | AssignedLicenses

Hey hello and thanks for your article.

How can I get all the users with specific service like “MicrosoftOffice”? Thanks for your help!

I mean this “Get-AzureADUser -SearchString [email protected] | Select -ExpandProperty AssignedPlans”

Can anybody know how to check the date when license is assigned, who assign license and to whom with Office 365 Powershell. is it possible ?

Thanks in advance.

thanks for the article. i am looking for a way to Enabled individual ServicePlan for existing users. we use E3 license with only have a few service plans enabled, now we want to enable more plans, such as “Team”. How can we do that without removing the whole license and re-add.

I am also wondering about it. How can we do it in a more friendly way?

Very helpful article

Hi Paul, have you noticed, or is it just me, that the Get-AzureADSubscribedSku now no longer returns the ServicePlans objects with each Sku object but instead returns a string that looks like the following:

class ServicePlanInfo { AppliesTo: User ProvisioningStatus: Success ServicePlanId: efb87545-963c-4e0d-99df-69c6916d9eb0 ServicePlanName: EXCHANGE_S_ENTERPRISE }

Just wanting to do a sanity check before I start building some code to parse those strings for the ServicePlanId and ServicePlanName. Looks like this is YAML output, essentially, except for the class declaration.

You can ignore the above – the AzureAD commands were being used in my case imported from another PSSession. The serialization must be causing the effect.

Hello Thank you very much for your article. I was wondering. If i have many users, and want to add a licence for all this users? How can i do it? Do i need a csv file or muss write my code in a for each loop? Please can you help me or give me more informations? Thank you

Yes, some PowerShell code to loop through a list of users would do the trick.

Or switch to using group-based license management.

“AdHoc License Administrator” role has been deprecated and “User administrator” role is required at the minimum for managing the licenses.

“User administrator” role gives more access than what I would like to give to the account running the provisioning scripts. Have you found a method to delegate only “License management” permissions to the account running the provisioning scripts.

Thanks Paul, nice post as usual.

On a similar note, I put together a script (still using the MSOL module) to bulk add/remove licenses.

Details: http://ezoltan.blogspot.com/2017/12/assign-or-remove-o365-licenses.html Download: https://gallery.technet.microsoft.com/Assign-or-Remove-O365-e397e1da

Regards, Zoltan

Using the get-azureaduser and get-azureaduserlicensedetail I can easily see what license are assigned. Is there a way to determine if the license is directly applied, or applied using Azure AD group based licenses? I found a way using the MSOL module, but not the AzureAD module.

I have a similar question about cmdlets and methods for viewing licenses assigned using security groups. I have the methods that exist today in the MSOnline module will have counterparts in AzureAd module. This is hoping that that v2 supports more features — not less.

I want to remove multiple licenses using PowerShell. Actually I able to remove single licence like below. But How do I remove multiple licenses?

$AzureUser = Get-AzureAdUser -ObjectId $ADuser.UserPrincipalName

$License = New-Object -TypeName Microsoft.Open.AzureAD.Model.AssignedLicense

$License.SkuId = “6fd2c87f-b296-42f0-b197-1e91e994b900” #6fd2c87f-b296-42f0-b197-1e91e994b900 Office 365 E3

$LicensesToAssign = New-Object -TypeName Microsoft.Open.AzureAD.Model.AssignedLicenses

$LicensesToAssign.AddLicenses = @() $LicensesToAssign.RemoveLicenses = $License.SkuId

Set-AzureADUserLicense -ObjectId $AzureUser.ObjectId -AssignedLicenses $LicensesToAssign

Had this question too, and I figured it out. The logic for this seems pretty silly, and the logic is beyond me, but you need to: – Create an object for each license SkuId – Add the correct license to the objects made in previous step – Create the object with the licenses (plural) – Add the previously created variables to another object (I think) – Create the array – Create the variable/property to remove the licenses – Create the user variable – Then remove the licenses

So the code would look like this: #Hard code the username or prompt for username $ADName = myuserprincipalname / $ADName = Read-host

$E3License = New-Object -TypeName Microsoft.Open.AzureAD.Model.AssignedLicense $EMSLicense = New-Object -TypeName Microsoft.Open.AzureAD.Model.AssignedLicense $E3License.SkuId = “6fd2c87f-b296-42f0-b197-1e91e994b900” $EMSLicense.SkuId = “efccb6f7-5641-4e0e-bd10-b4976e1bf68e” $LicensesToAssign = New-Object -TypeName Microsoft.Open.AzureAD.Model.AssignedLicenses $LicensesToAssign.AddLicenses = $E3License, $EMSLicense $LicensesToAssign.AddLicenses = @() $LicensesToAssign.RemoveLicenses = $E3License.SkuId, $EMSLicense.SkuId $user = Get-AzureADUser -SearchString “$adname” Set-AzureADUserLicense -ObjectId $user.ObjectId -AssignedLicenses $LicensesToAssign

What if you want to enable previously disabled plans? Would this cause disruption? Will it pick up the add or error as the license is already assigned?

I don’t understand your question. What is the scenario you’re looking at?

I’m in the same boat Paul.

Two Scenarios I’d like to try and work through:

1) All users were globally disabled Teams (when that was a thing, which it isn’t now), and we want to add that SubSKU (Teams) back in for all enabled / licensed Users.

2) When we piloted Teams, a group of 20 users were given the Teams SubSKU to allow them to evaluate Teams. If 1), above, works, what will happen to those 20 users. Would the script need to iterate through and skip them if they were already enabled for Teams, or would it just enable it again and continue.

I also have the same question as everyone else. Can we re-apply a license with additional features enabled or disabled. It seems like that is not the case.

Is the only way to add and remove features to remove the full license then re apply with desired features?

This probably won’t help you, but maybe it will help someone else who reads your blog. Your bit on removing licenses was helpful; however, we have a ton of SKUs. There’s no way my Junior Admins or I will remember the SkuIDs for these…so I needed a way to easily remove licenses from a user account without having that information. I wrote this module:

function global:Remove-CompanyUserLicense ($delicenseUID)

$delicenseEmail = $delicenseUID + ‘@company.com’ $Current = Get-AzureADUser -ObjectId $delicenseEmail | Select -ExpandProperty AssignedLicenses $License = New-Object -TypeName Microsoft.Open.AzureAD.Model.AssignedLicense $License.SkuId = $Current.SkuId $LicensesToAssign = New-Object -TypeName Microsoft.Open.AzureAD.Model.AssignedLicenses $LicensesToAssign.AddLicenses = @() $LicensesToAssign.RemoveLicenses = $License.SkuId

Set-AzureADUserLicense -ObjectId $delicenseEmail -AssignedLicenses $LicensesToAssign

Write-Host -ForegroundColor Cyan “License has been removed on $delicenseEmail.”

Write-Output “Error clearing license.”

I’m sure there is a more efficient way to do this, as my Powershell is a bit green. At any rate, I thought it might help save someone some time. Great blog, by the way!

Hi Paul Great article… Trying to make reporting on a user readable for humans without memorising each SkuId. Has anyone managed a script that gives The License SkuPartNumber assigned The assigned License ServicePlanName Preferably parsable as an object for reporting… This is my output and its terrible…

Status : ObjectID : 0e2afe5b-22d9-442f-9ee6-b66c79b5071f UserPrincipalName : [email protected] UsageLocation : NZ AssignedLicenses : {class AssignedLicense { DisabledPlans: System.Collections.Generic.List`1[System.String] SkuId: efccb6f7-5641-4e0e-bd10-b4976e1bf68e } , class AssignedLicense { DisabledPlans: System.Collections.Generic.List`1[System.String] SkuId: 6fd2c87f-b296-42f0-b197-1e91e994b900 } } AssignedPlans : {@{Service=ProjectWorkManagement}, @{Service=MicrosoftOffice}, @{Service=YammerEnterprise}, @{Service=Sway}…}

very nice article thanks

Leave a Reply Cancel reply

Latest articles.

Microsoft 365 Tenant-to-Tenant Migration Assessment Version 2

Microsoft 365 Tenant-to-Tenant Migration Assessment Version 2

In this blog, Sean Mcavinue reviews an update to his original Tenant-to-Tenant Migration Assessment, which is designed to gather key data to consider during the migration planning process.

  • Microsoft 365

Exchange Server Subscription Edition Arrives in Summer 2025

Exchange Server Subscription Edition Arrives in Summer 2025

Microsoft has announced that Exchange Server Subscription Edition (SE) will appear in summer 2025. You'll be able to do an inplace upgrade from Exchange Server 2019 CU15 or a "legacy upgrade" (hardware switchover) for other versions. The initial version of Exchange Server SE is unexciting, perhaps deliberately so. It's all about getting customers to transition to the subscription model.

  • Exchange Server

Practical Protection: Understanding Entra ID and Passkeys

Practical Protection: Understanding Entra ID and Passkeys

This Episode of Practical Protection is all about Passkeys, how they are different from other credential types, and how they could put an end to phishing.

get license assignment date

Contribute to the Microsoft 365 and Office forum! Click  here  to learn more  💡

April 9, 2024

Contribute to the Microsoft 365 and Office forum!

Click  here  to learn more  💡

  • Search the community and support articles
  • Microsoft 365 and Office
  • Subscription, account, billing
  • Search Community member

Ask a new question

Inactive profile

Checking licence changes in audit logs

Hi everyone,

This morning I found out that 5 of our users had lost their o365 licenses. I had to manually assign these licenses again. When i want to check the audit logs, to see what happened, I notice that the change of licenses is not logged. Do I need to turn this kind of logging manually on?

Kind regards,

Rick van Oosterhout

Report abuse

Reported content has been submitted​

Replies (7) 

Inactive profile

2 people found this reply helpful

Was this reply helpful? Yes No

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

Thanks for your feedback.

How can I check if those are turned on and if not, how can I turn those on?

Eli Qian MSFT

  • Microsoft Agent |

You could follow the picture to search licenses assigned logs again.

get license assignment date

If the action that assigning licenses is still not logged, it can take up to 24 hours for the admin events related audit log entry to be displayed in the search results.

get license assignment date

Here is Search the audit log in the Office 365 Security & Compliance Cente r for your reference.

Besides, if the issue occurs again, I would like to collect following information:

1.Are these users Online users or local AD users?

2.What licenses do they have before these license lost?

May I know if the issue has been resolved? If you need further assistance, please share more information I mentioned with us. 

The issue has not been resolved yet. When I audit for license changes, I get 0 results.

The users are online users, and we are all using a office365 business license.

Recently, there is Service Incident as the picture shows:

get license assignment date

You might be affected by the Service Incident. For further assistance, I would like to collect your tenant information via private message. Please check it.

Thank you for your understanding.

Best Regards,

We haven't hear back from you. Do you need further assistance? If so, please share more information I mentioned in private message.

Question Info

  • Norsk Bokmål
  • Ελληνικά
  • Русский
  • עברית
  • العربية
  • ไทย
  • 한국어
  • 中文(简体)
  • 中文(繁體)
  • 日本語

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

licenseAssignmentState resource type

  • 14 contributors

Namespace: microsoft.graph

The licenseAssignmentStates property of the user entity is a collection of licenseAssignmentState objects. It provides details about license assignments to a user. The details include information such as:

  • What plans are disabled for a user
  • Whether the license was assigned to the user directly or inherited from a group
  • The current state of the assignment
  • Error details if the assignment state is Error

JSON representation

The following JSON representation shows the resource type.

Was this page helpful?

Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see: https://aka.ms/ContentUserFeedback .

Submit and view feedback for

Additional resources

IMAGES

  1. Report Office 365 License Assignments to User Accounts

    get license assignment date

  2. Assign licenses to a group

    get license assignment date

  3. Assign licenses to a group

    get license assignment date

  4. How license assignment works

    get license assignment date

  5. New Jersey License Assignment Form

    get license assignment date

  6. License assignment

    get license assignment date

VIDEO

  1. How to install your Keyed license using the servercode

  2. Dabo's USSF B license Assignment

  3. Driving license in UAE.... how you can get license in UAE #drivinglicenseinuae #dubai #license #uae

  4. How To Fix "Windows License Will Expire Soon in Windows 11 / 10"

  5. VTU, 21RMI56, Research Methodology & IPR, Question & Answer, Module 4, Part 4

  6. 4. Azure DevOps AZ 400

COMMENTS

  1. See the assignment date of a license

    If I run the following command, I get all assigned licenses for the same user, so the command above should return at least something. The .Licenses parameter is useful, but it does not solve my problem regarding the timestamp of the assignment. PS C:\Users> (Get-MsolUser -UserPrincipalName [email protected]).Licenses ExtensionData: ...

  2. View Microsoft 365 account license and service details with PowerShell

    Reading user properties including license details requires the User.Read.All permission scope or one of the other permissions listed in the 'Get a user' Graph API reference page. Connect-Graph -Scopes User.ReadWrite.All, Organization.Read.All Next, list the license plans for your tenant with this command. Get-MgSubscribedSku

  3. Find out license assignment date

    AL. AlexSun_2012. Replied on October 26, 2015. Report abuse. hi samir, unfortunately, there is no official instruction to check the date when a user got the licenses in office 365. however, if the licenses was assigned just when the user was created, you can run the following cmdlet to find out the date when the creating date after connecting ...

  4. Office 365 License Assignment Dates

    In this blog post I will share a Powershell Spell that can be utilized to export the report of license assignment dates. Prerequisites for this Solution: AzureAD Module; Import Excel Module (for exporting to excel) Now first get the service plan id for the licenses you are interested in. Log on to Powershell using à. Connect-AzureAD

  5. Office 365 license assigned date export

    I tried to go to Billing --> License --> Selected Product --> Export but License assignment or date is missing in the export. I also tried to export from Admin center report but there's no option when did Visio or Project license assigned. Any help would be appreciated. Microsoft Entra ID. Marilee Turscak-MSFT 34,036.

  6. How to Check Office 365 License Usage & History

    To get the list of users that are assigned an Office 365 license and store the output in a .CSV file, you can run this command: Get-MSOlUser identifies the "IsLicensed" attribute for every user that is set to "True," which indicates that an Office 365 user is assigned an Office 365 license. The command retrieves the User Principal Name ...

  7. How to check date of license assignment ?

    How to check date of license assignment ? Hi, Is there a Powershell script that shows you when ( for example ) a Visio license has been assigned to a user ? We have 50 Visio licenses and I would like to know when a user had this license assigned. Thanks in advance for your help. Labels: ...

  8. Why Azure AD License Assignment Dates Can Mislead

    Using the License Assignment State API. PowerShell being PowerShell, there's usually an alternative method to explore to do something. In this instance, we can use the Graph License Assignment State API to retrieve the timestamp stored in the Graph for the last time the license assignment changed. This is a relatively new API, and its timestamps only go back to mid-2022.

  9. PowerShell command to check License assignment for users- Direct or

    Hello, Could anyone please post PowerShell command to extract the list of users who only have Direct Licensing assigned. Or may be list of all the users with the licensing status- if Direct or Inherited.

  10. Create a Microsoft 365 Licensing Report with PowerShell

    Stage 1: Extract Licensing Data for the Tenant. The basic steps in generating a report are in two stages. First, we create two data (CSV) files containing: The product licenses (SKUs) used in the tenant. The service plans belonging to the product licenses. A service plan is something like Exchange Online Plan 2 or Teams which is bunded in a ...

  11. Managing Office 365 Licenses with the Azure AD V2 PowerShell Module

    Using PowerShell. The Office 365 admin portal provides a simple web interface for managing license assignments. It's easy to add a license for a user, or for multiple users, enable or disable sub-SKU features (the individual services that are included in a license), or remove a license. Licenses for multiple users can be managed at the same time.

  12. Manage Office 365 licenses with PowerShell

    Get-Command -Noun *MSOL*. Listing Office 365 cmdlets. This command returns all MSOnline module cmdlets. You can also list the number of cmdlets in the module with this command: (Get-Command -Noun *MSOL*).count. Total count of Office 365 cmdlets. Now we are ready to manage Office 365 licenses with PowerShell.

  13. List licenseDetails

    Retrieve a list of licenseDetails objects for enterprise users. This API returns details for licenses that are directly assigned and those transitively assigned through memberships in licensed groups. This API is available in the following national cloud deployments. Expand table. Global service. US Government L4.

  14. Microsoft Graph API: License assignment time without utilizing audit

    I want to get the license assignment time for each license assigned to each user in a tenant. Using the audit logs I'm able to fetch this data but its partial in nature as the audit logs are retained for 30 days by default, so I can't get the time of license assignment if it happened before this 30 day period.

  15. Date license activation to the user

    hi breno, there is no such a property for the get-msolusers command to get when the user has been assigned the license using powershell. you can use get-msoluser -all | select * to get all properties to verify that.. as far as i know, some users are assigned license when creating them. so, if this is the scenario from your side, you can consider getting user's created date to check the license ...

  16. Checking licence changes in audit logs

    This morning I found out that 5 of our users had lost their o365 licenses. I had to manually assign these licenses again. When i want to check the audit logs, to see what happened, I notice that the change of licenses is not logged. Do I need to turn this kind of logging manually on? Kind regards, Rick van Oosterhout

  17. Microsoft Graph API

    To get license assignment details, I'm wondering if there is a way to get the required data without making a separate call for each user in my tenant. That would amount to thousands of API calls at a time. It seems like a waste of resources. I have considered performing a batch POST request with each user I want license details for in the ...

  18. Is there a way to get license expiry and license assigned date to user

    Is there a way to get license expiry and license assigned date to user from GRAPH REST API Velshankar Manickavasagam 1 Reputation point 2021-08-18T04:42:08.417+00:00

  19. Medicare.gov

    Welcome! You can use this tool to find and compare different types of Medicare providers (like physicians, hospitals, nursing homes, and others). Use our maps and filters to help you identify providers that are right for you. Find Medicare-approved providers near you & compare care quality for nursing homes, doctors, hospitals, hospice centers ...

  20. City of Moscow Permits

    Download forms and permit applications from the Streets and Engineering Divisions. Links for permits for the City of Moscow.

  21. Licensing

    Fees are: Bicycle License (Lifetime): Form available at police department. Fee is $7.00. Licensing fees and requirements are listed on each application. Katie Short oversees licensing for the Moscow Police Department. If you have questions or need assistance with licenses, please contact her at the phone number on the right or at (208) 883-7054.

  22. Business Licensing

    Vending licenses are processed through the Moscow Police Department. Contact Us. Katie Short Administrative Specialist. Email Katie Short . Phone: 208-883-7052. Moscow Police Department. Physical Address 155 Southview Ave Moscow, ID 83843. Phone: 208-883-7054. Corey O'Brien Permits Coordinator ...

  23. Forms & Applications

    Boards and Commissions Purpose and Schedules (PDF) View forms and applications for Moscow City.

  24. licenseAssignmentState resource type

    Namespace: microsoft.graph. The licenseAssignmentStates property of the user entity is a collection of licenseAssignmentState objects. It provides details about license assignments to a user. The details include information such as: What plans are disabled for a user. Whether the license was assigned to the user directly or inherited from a group.