As an Office 365 Administrator, often you are in the situation to get all licensed users with their assigned licenses and services. Using the O365 admin portal, you can get user’s license information, but you need to click each user to know about their license subscriptions and service status which is a cumbersome task. To ease your work, you can use PowerShell commands. Get-Msoluser will get the details of all Office 365 users and Where condition used to filter out licensed users alone. Now, you can export O365 licensed users to CSV file.
Do you think it’s easy? Definitely not! Because we need to consider following things before jumping right away.
- A user can have multiple licenses.
- Each license gives access to a set of services.
- A user might not have access to all services. Some services might be enabled or disabled based on user needs.
- License subscription names are not user-friendly by default.
We have created a PowerShell script that will get you the detailed license usage report covering all the above cases. It reports all licensed users with their country, assigned licenses, services, and its status. So! Let’s jump into the script right away.
Download Script: O365UserLicenseReport
- Office 365 E3 is a cloud-based suite of productivity apps and services with information protection and compliance capabilities included. Install Office mobile apps on up to five PCs or Macs, five tablets, and five phones per user. Protect information with message encryption, rights management, and data loss prevention for email and files.
- After your organization signs up for Microsoft 365, the admin can assign different Microsoft 365 licenses to each user account. The different licenses include different services, such as SharePoint in Microsoft 365 and Skype for Business Online. See the different Office 365 for business plans. Note: This topic is for Microsoft 365 for business.
Script Highlights:
- Exports Office 365 user license report to CSV file.
- You can choose to either “export license report for all office 365 users” or pass an input file to get license report of specific users alone.
- License Name is shown with its friendly name like ‘Office 365 Enterprise E3’ rather than ‘ENTERPRISEPACK’.
- The script can be executed with MFA enabled account
- The script gives 2 output files. One with the detailed report of O365 Licensed users another with the simple details.
- Output file stores most required attributes like Display Name, User Principal Name, Country, Licenses, License Friendly Name, Service, Service Friendly Name, and Service Status. You can include more attributes by easily modifying the script.
Manage Microsoft 365 Users, Licenses, And Groups with PowerShell April 21, 2021 April 21, 2021 O365 Powershell, Office 365, Office 365 Reports No Comments With Microsoft 365 admin center, you can easily manage Microsoft 365 user accounts and licenses.
Office 365 License Report – Sample Outputs:
Exported report shows list of licensed users and their assigned licenses.
Detailed Office 365 User License Report:
Detailed Office 365 users’ assigned license report contains user’s Display Name, User Principal Name, License Plan, Friendly-name of License Plan, Service Name, Friendly-name of Service, and Service Status.
Simple Office 365 User License Report:
The simple Office 365 user license report contains user’s Display Name, User Principal Name, and Friendly-name of assigned license with their respective services.
Office 365 User License Report – Execution Methods:
You can use this script to either export all licensed users or export list of licensed users in Office 365.
Export all Licensed Users in Office 365:
To export all licensed users in Office 365, run the script as follows.
Get Office 365 License Report for a Single/List of Office 365 Users:
You can use –UserNamesFile param to get license report of a user from the input list called “UserNamesInput.txt”.
The UserNamesFile must follow the format below: UPN separated by new line without header.
Note: As an admin, it’s essential to know when your subscriptions are going to expire or when Microsoft will charge for renewal. If you are not sure about the answer, you can check Office 365 subscription expiry date report.
Get More Detailed Office 365 License Report:
If you want to get more detailed Office 365 license reports based on
- Regainable licenses
- Users and Licenses
- Licensed users
- Unlicensed users
- Users with specific subscription
- Users with free subscription
- Users with trial subscription
- User license changes
- License expiry
- Purchased subscription expiring users
- Purchased subscription expired users
- Trial expiring users
- Trial expired users
- Users with suspended subscription
- Subscription
- Subscription usage report
- Expired subscription
- Unused subscription
- Purchased subscription
- Trial subscription
you can take a look at AdminDroid Microsoft 365 reporting and auditing tool.
AdminDroid provides over 100+ reports and a handful of dashboards completely for free. It includes reports on Users, Licenses, Groups, Group Members, Devices, Login Activities, Password Changes, License Changes, and more. The free edition doesn’t have any restrictions in reporting functionalities such as customization, scheduling, and exporting. For your Azure AD reporting and auditing needs, you can download Free Office 365 reporting tool by AdminDroid and see how it helps for you.
Additionally, AdminDroid provides 950+ pre-built reports and 18 smart visually appealing dashboards to know about your Office 365 environment at a glance. This tool provides reports on Office 365 reporting, auditing, analytics, usage statistics, security & compliance, etc.
I hope export Office 365 license report using PowerShell blog was helpful. If you modify the script and use it for other use cases, then please leave your idea in the comment section and help more admins.
You may also like these blogs:
If you’re struggling with figuring out how to manage Office 365 user licensing at scale, look no further! You can now manage Office 365 user licensing by a group with Azure Active Directory (AD) group-based licensing with Office 365!
Azure AD group-based licensing allows you to standardize licensing applications by managing them in groups rather than by individual users. This can soon turn into a huge time-saver for admins! With a seemingly never-ending rollout of Office 365 services, you owe it to yourself to manage licenses in bulk.
Azure AD Group-based licensing is a system of implementing a licensing template that is assigned to users through group membership. Unlike manual license assign that can be performed in the Microsoft 365 Admin Center, all portal-based tasks must be performed in the Azure AD portal.
In this article, you’re going to learn how Office 365 licensing works today and then how you can save a lot of time and management headaches with Azure group-based licensing.
Let’s get started!
Licensing Office 365 (The Hard Way)
Office 365 consists of a suite of services like Exchange Online, SharePoint Online, Skype for Business Online, among others. Each service can be licensed individually by user.
Individual Licenses
For example, let’s say you have purchased an Exchange Online Plan 1 license product. You’d like to allocate a user license to that product using a single Exchange Online mailbox.
In the Microsoft 365 Admin Portal, you’d click on Assign as shown below to apply the Exchange Online Plan 1 license product to the mailbox.
The above example is for one product – Exchange Online. But licensed products also come in suites with the Microsoft or Office 365 E3 license product, for instance.
Suite Licenses
When assigning a suite license, the individual services can be controlled as you can see below. Here you can apply license products to the mailbox at once.
Using PowerShell May Work But Comes with Drawbacks
At some point, an organization may then need to update user licenses. They then may turn to PowerShell. Although a PowerShell script is certainly a solution, it’s not as simple as one might expect.
Even if you know how to write PowerShell code, you’ll still be faced with a confusing list of various PowerShell modules to use like MSOnline, AzureAD, AzureADPreview and Az. Which one do you use in which circumstance? It’s not entirely clear. All work similarly.
The hardest part is figuring out which PowerShell cmdlets in these modules map to options in the Microsoft 365 Admin Portal. Inside of PowerShell, you’ll see cryptic names like Deskless for Office Online. These names are not in the Microsoft 365 Portal.
To assign and remove user licenses with PowerShell, you’d have to find license SKUs, build a list of license options by navigating those cryptic names and more. There is no simple cmdlet (within these modules) to easily enable and disable user licenses.
Although this approach works, it will mean writing a lot of PowerShell code which comes with its own set of management challenges.
Azure AD group-based licensing removes the requirement to get into the weeds with PowerShell and simplifies the license management process.
Licensing with Azure AD Group-Based Licensing
To forego the challenges of managing user licenses individually or using PowerShell, let’s dive into how to manage licenses via groups via group-based licensing.
Prerequisites
If you plan to follow along with the following demonstration, know that you will need to meet a few prerequisites. You’ll first need to ensure you’re in an organization with the following licenses (paid subscriptions or active trials):
- Azure AD Premium P1, or higher
- Office 365 E3 license (or equivalent), or higher
- Enterprise Mobility + Security E3, or higher (includes Azure AD Premium P1)
- Microsoft 365 E3, or higher (includes both Office 365 E3, or higher and Enterprise Mobility + Security, or higher)
In addition, each user that has licenses applied via group-based licensing must have licenses for the product to be assigned.
Licensing Requirements
Azure AD Group-based licensing is only available for organizations with the following licenses (paid subscriptions or active trials):
- Azure AD Premium P1, or higher
- Office 365 E3 license (or equivalent), or higher
- Enterprise Mobility + Security E3, or higher (includes Azure AD Premium P1)
- Microsoft 365 E3, or higher (includes both Office 365 E3, or higher and Enterprise Mobility + Security, or higher)
Drivers drew. In addition, each user that has licenses applied via group-based licensing must have licenses for the product to be assigned and the previously mentioned licensing to support group-based licensing.
License requirements for Azure AD Group-based licensing present a “chicken and egg” problem. The prerequisite licenses must be available, but without having assigned the licenses, the users do not have the required license assigned. To account for this problem, Azure AD Group-based licensing is enabled tenant-wide as soon as subscriptions that meet the licensing requirements exist.
Office 365 Licensing
To remain in the spirit of the license, only the number of users that will be assigned one of the required licenses should have group-based licensing applied.
If, for example, 300 Office 365 E3 licenses exist (and no Azure AD Premium licenses exist), then only 300 users should be licensed via group-based licensing. There is no control that prevents exceeding the limits, so self-auditing is recommended to ensure tenants remain in compliance.
More information on licensing requirements can be found on Microsoft’s licensing requirements page.
Azure AD Group-Based Licensing How-To Walkthrough
To implement Azure AD group-based licensing consists of four rough steps:
- Create a group in Azure AD (synchronized, on-premises group or a group only in Azure AD)
- Choose a license to apply
- Choose the license options to apply
- Select the applicable group(s) to apply the license settings
Once these steps have been done, licenses can be applied in a consistent manner to users by assigning them to the appropriate groups.
Let’s now get our hands dirty and walk through a simple example of how to implement Azure AD Group-based licensing.
Creating an Azure AD Group
The first task you’ll need to do is create a group. This is the group you’ll eventually use to assign licenses to members inside of the group.
The following steps are displayed in the next screenshot.
- To get started, ensure you’re logged into the Azure AD Portal.
- In the portal, navigate to Azure Active Directory —> Groups.
- Click New group.
- Assign the Group name as E3 Standard. You can choose any group name you wish.
- Click Members to add the desired members, select the desired users and click on Select.
- Click Create to confirm creation of the group.
Assigning Office 365 License to the Azure AD Group
Once the group is created, it’s time to assign product licenses to the group. The following steps are displayed in the next screenshot.
- While still in the Azure AD portal, navigate to: Azure Active Directory —> Licenses —> All products.
- Check the product to license as Microsoft 365 E3 or another product.
- Click Assign.
- To choose the assignment group, click Users and groups.
- Select E3 Standard or the name of the group created earlier.
- Click Select.
- Click Assignment options.
- Toggle the desired options.
- Click OK.
- Click Assign as seen below.
More information can be found at the Assign licenses to users by group membership in Azure Active Directory page.
If a user is assigned to multiple groups the various SKUs and options will be added together to form to total license assignment for the user.
Direct vs. Inherited Licensing
A key concept for Azure AD Group-based licensing is Direct versus Inherited licensing. If a user has had licenses assigned manually, these are known as direct assignments and Azure AD Group-based Licensing will not override these. Reviewing a member of a group that has had directly-assigned and licenses inherited, you can see below.
Removing Office 365 Licenses
For Azure AD group-Based licensing to be effective, direct-assigned licenses should be removed such that any changes to assignment options are handled with consistency via a group assignment. Any inherited assignments will remain, so the previous redundancy works to transition the user to group-based licensing seamlessly.
When users are assigned a license both directly and via inheritance, the redundant direct license assignment must be removed. To do so, in the Azure AD Portal:
- Navigate to Users.
- Select the user to modify.
- Click Licenses.
- Click on the license to remove.
- Click Remove license.
- Click Yes.
You can see in the below screenshot of what this will look like from steps five and six.
After a few moments, only the inherited license remains, as seen below.
For more information, refer to the Microsoft page on How to migrate users with individual licenses to groups for licensing.
After the direct licenses have been removed, users will be managed entirely through groups-based licensing.
Removing Groups with Group-Based Licensing
As a fail-safe mechanism, a group involved in groups-based licensing cannot be removed until all license assigned handled be the group are removed. This is to prevent inadvertent license removal that would result in users being unable to perform work.
In order to remove a group, follow the below steps:
- In the Azure AD Portal navigate to Azure Active Directory —> Licenses —> All products.
- Check the product to license Microsoft 365 E3.
- Check the group to remove.
- Click Remove license.
- Click Yes.
You can see what steps four through six look like below.
Now the group may be removed. Be mindful of any other potential conflicts that removing licensing from a group could create, like with dependent products.
Remediating Licensing Issues
As with direct licensing, where the admin portal displays errors in applying licenses, groups-based licensing can encounter the same circumstances which must be reconciled.
When licensing issues occur with groups-based licensing, administrators are not interactively working with the portal or PowerShell and will need to become informed of such issues. Licensing issues can be identified in the Azure AD portal under the licensing section, as seen below.
Conflicting Licenses
Some subscriptions have conflicting versions of licenses that cause a failure to occur when applying licenses. This failure happens when manually assigning licenses and using group-based licensing at the same time.
When you assign the Exchange Online Plan 1 license and there is an attempt to assign a license that includes Exchange Online Plan 2, or SharePoint Online Plan 1 and SharePoint Online Plan 2 is a great example. The licenses will conflict with each other.
To resolve this issue, refer to the above steps on removing the direct assignment that causes the conflict or, if necessary, remove the group-based membership.
Types Of O365 Licenses
This situation can be tricky to navigate if the combination of assignments is necessary to get a complete licensing profile assigned to a user.
No Unassigned Licenses are Available
Even though you do everything right you might still end up in a situation where you simply run out of licenses to assign. As mentioned in the Prerequisites section, each license applied via groups-based licensing must be available within the tenant’s subscriptions.
If there are 30 users, for example, in a group being assigned an Office 365 E3 license but there are only 25 licenses for that SKU, there will not be enough unassigned licenses to fulfill the settings applied through groups-based licensing. You can see an example of this situation below.
Unmet Dependencies
Certain licenses depend on other licenses being applied. For instance, individual licenses for PSTN service for Skype for Business and/or Microsoft Teams require all users to have the underlying products assigned.
In this instance, if a user is not assigned options for Skype for Business or Microsoft Teams, any PSTN licenses applied will result in an unmet dependency which but be remediated prior to any PSTN functionality to be available to the assigned users.
Unassigned Usage Location
Before a user can be assigned any licenses, a usage location must be selected. The usage location is used when legal or regulatory mandates exist that restrict certain products from being used. If no usage location is assigned, the tenant location will be assigned as the usage location with groups-based licensing. While this allows the user to function, it could result in legal or regulatory ramifications.
With direct license assigned, an error would be presented rather than automatically assigning the tenant location as the usage location.
Reprocessing Users
O365 License Cost
After remediating any licensing errors, users may still not be in a proper license assignment. In such an event, it is necessary to force the reprocessing of license assignments.
To reprocess licensing for a user:
- Navigate to Users.
- Select the user to reprocess
- Click Licenses.
- Click Reprocess.
More information can be found at the Identify and resolve license assignment problems for a group in Azure Active Directory Microsoft docs page.
Summary
Azure AD Group-based licensing can contribute to the consistent assignment and updating of product licensing within Office 365. In addition, it can be part of a mature provisioning process; such a process may begin with user creation in Active Directory, synchronization to Azure AD, provisioning an Exchange Online mailbox via the on-premises Exchange Management Shell, and assigning licenses through groups-based licensing.