This PowerShell script generates a comprehensive Microsoft 365 license assignment report by connecting to Microsoft Graph API and analyzing license distribution across users and groups. The script examines all users in the tenant to identify how licenses are assigned - whether directly to users, inherited through group membership, or both - and compiles detailed infor
This PowerShell script generates a comprehensive Microsoft 365 license assignment report by connecting to Microsoft Graph API and analyzing license distribution across users and groups. The script examines all users in the tenant to identify how licenses are assigned - whether directly to users, inherited through group membership, or both - and compiles detailed information about each assignment including friendly license names, assignment sources, and user account status. The script creates an interactive HTML report that provides a complete overview of license utilization, subscription status with end dates, and identifies potential issues like disabled users still consuming licenses. It supports multiple authentication methods (interactive, client secret, certificate, managed identity, and access token) and can automatically email the generated report to specified recipients with the original file being cleaned up afterward.
Copy and Paste the following command to install this package using Microsoft.PowerShell.PSResourceGet More Info
You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deploy all the dependencies to Azure Automation. Learn More
Manually download the .nupkg file to your system's default download location. Note that the file won't be unpacked, and won't include any dependencies. Learn More
Initial release - Comprehensive Microsoft 365 license assignment report with HTML output v1.0 -2.3 - Test phase v2.4 - Added function Test-MgGraphConnection to check for existing connections with the proper permissions V2.5 - removed the need of "Microsoft.Graph.Beta.Identity.DirectoryManagement","Microsoft.Graph.Beta.Users", "Microsoft.Graph.Beta.Groups". - Powershell 7 as requirements have been fixed + faster v2.6 - Added Interactive, ClientSecret, Certificate, Identity and AccessToken parameters to support different authentication methods. - Added support for sending the report via email with customizable subject and body text. v2.7 - Added last successful sign-in information for each user.