Forum Discussion
Office 365 license consumption alert
- Mar 23, 2017
In terms of alerts, no. A quick glance at the Admin portal or the Reports can give you this info. If you need it automated it really takes few lines of PowerShell code to check for available licenses and fire up an email notification.
This issue, the lack of an Office 365 license consumption alert, is still unresolved (06/22/2018).
There is a feedback forum post for the task; https://feedback.azure.com/forums/169401-azure-active-directory/suggestions/33768322-get-low-license-count-notification
Please vote it up if you really want to see the change.
And as others have noted, you can set up a scheduled task to PowerShell an email to your relevant crew who may see going to the portal as an inconvenience.
I included my script below with <descriptions> of items that need filled in.
If you need help getting keys and such to encrypt passwords, try Share-gate or KeePass who provide good MS Online compatible encryption tools.
#
# Send_O365LicensingReport.ps1
#
$key = (<integer array>);
$secureString = "<encrypted Password>"
$PWord = ConvertTo-SecureString $secureString -key $key;
$User = "<GlobalAdmin>@<company domain or .microsoftonline.com>";
$Credential = New-Object –TypeName "System.Management.Automation.PSCredential" –ArgumentList $User, $PWord
#Get the Office365 tenant credentials
$Office365credentials = Get-Credential $Credential;
Connect-MsolService -Credential $Office365credentials;
write-host "Connecting to Microsoft SharePoint Online Service ..."
[String]$SkuReport1 = Get-msolAccountSku | Select @{N='Product Name';E={switch ($_.AccountSkuId) { '<company domain>:ENTERPRISEPREMIUM' {'Office 365 Enterprise E5'} '<company domain>:POWER_BI_PRO' {'Power BI Pro'} '<company domain>:ENTERPRISEPACK' {'Office 365 Enterprise E3'} '<company domain>:SHAREPOINTSTORAGE' {'SharePoint Online Storage'} '<company domain>:POWER_BI_STANDARD' {'Power BI (free)'} '<company domain>:EMS' {'Enterprise Mobility + Security E3'} '<company domain>:MCOMEETADV' {'Audio Conferencing'} '<company domain>:DYN365_ENTERPRISE_SALES' {'Dynamics 365 for Sales Enterprise Edition'} '<company domain>:DYN365_ENTERPRISE_TEAM_MEMBERS' {'Dynamics 365 for Team Members Enterprise Edition'} default {'Unknown'} }}}, @{N='Active Units';E={$_.ActiveUnits}}, @{N='Consumed Units';E={$_.ConsumedUnits}}, @{Name = 'RemainingUnits'; Expression = {[string]([int]( $_.ActiveUnits - $_.ConsumedUnits))}}, @{N='Account SkuId'; E={$_.AccountSkuId}} | ConvertTo-Html
Send-MailMessage -SmtpServer mail.<company domain> -To <recipient>@<company domain> -From <sender>@<company domain> -Subject "Consumed licenses report" -Body $SkuReport1 -BodyAsHtml
- Adam FowlerSep 25, 2019Iron Contributor
A daily report via PowerShell is nice, but even better is an alert when certain numbers are hit based on previous reports! E.g. 0 remaining or 1 remaining.