Quick and Easy Office 365 License Assignment Report

Leveraging Get-AzureADSubscribedSku to Find Office 365 E3 Accounts

I love receiving suggestions from readers. After posting my note about Microsoft’s epic failure to communicate the real facts about mailbox auditing by default, Ofir Doron pointed out a good way to create a list of Office 365 E3 accounts that could then be used to enable mailbox auditing. You still need to take care of shared mailboxes, so I’ve updated the script to process both user and shared mailboxes.

The basis of the suggestion is to use the GUID of the Office 365 E3 license to identify accounts to check. The GUID is found by running the Get-AzureADSubscribedSku cmdlet from the Azure Active Directory module to return details of the SKUs (stock control units) available in the tenant. The EnterprisePack SKU in the list is Office 365, so the SKU identifier we need to use is 6fd2c87f-b296-42f0-b197-1e91e994b900. This value seems to be the same for all tenants.

The script uses this command to fetch a set of mailboxes for Office 365 E3 accounts:

We then process those mailboxes to make sure that they are enabled for mailbox auditing.

Leveraging Knowledge Learned

Moving on from mailbox auditing, a delight of PowerShell is that you can repurpose some new knowledge to solve other problems. In this case, I want to create a report of license assignments in the tenant. In other words, which accounts have been assigned the licenses returned by Get-AzureADSubscribedSku.

This script loops through all the license SKUs to find the accounts assigned each SKU. We put things together in a PowerShell list object and output it via Out-GridView (Figure 1). You need to be connected to Azure Active Directory before running the script.

Quick and Easy Office 365 License Report
Figure 1: Quick and Easy Office 365 License Report

Simple, easy, and a great example of how a little PowerShell can go a long way. And because the code is PowerShell and available to all, you can take it and amend it to match your needs.

P.S. Proving that PowerShell can solve problems in multiple ways, a previous post explains how to use the Microsoft Online Services module to retrieve and report license information.

Need more information about how to manage Office 365 licenses with PowerShell? Look no further than the Office 365 for IT Pros eBook. It’s packed full of examples.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.