I have created a script that uses the Microsoft Graph to report iicenses for the tenant as shown above. You’ll find it here:
https://github.com/directorcia/Office365/blob/master/graph-licenses-get.ps1
along with the documentation here:
https://github.com/directorcia/Office365/wiki/Report-tenant-licenses
You will need to have the Microsoft Graph PowerShell module installed and up to date.
The first time you run the script you maybe prompted to login to your tenant and then you may also be asked to provide permissions. This script requires:
LicenseAssignment.Read.All
which you may need to consent to the first time.
After the script executs you should see an output as shown above showing the license, the total of licenses available in the tenant and those that are currently assigned.
You can also use the –csv command line option to put the results to a CSV file in the parent directory