Get email alerts for low than 50 free Office 365 licenses

Copper Contributor

Hi all,

In my environment we have for the moment to SG who are entitled for 0ffice 365 licence. Is a dynamic environment and a few times we have been very closed to rich our total limit.

I’m locking for a option to send some alerts when the available licence number drops under a specific number

I’ve found a few tutorials but I couldn’t used them, not complete solutions.

https://techcommunity.microsoft.com/t5/Office-365/Office-365-license-consumption-alert/td-p/56036 

https://gcits.com/knowledge-base/get-email-alerts-unused-office-365-licenses-azure-functions-azure-s...

10 Replies

It's easy to do with PowerShell, what exactly is not working for you in the proposed solutions? You need one call of Get-MsolAccountSku, a simple if statement and then an email action. There's no need for azure functions or Flows or anything.

@VasilMichevHi Vasil, indeed the first part is true Get-MsolAccountSku work fine but the second part is not easy to achieve and I couldn't make the script to work, check if number is smaller than x and then send a email.

@Cristian Ceobanu 

 

You can simply use below logic - Get the number of consumed units and based on the consumption call email alert. You can extend below logic for your script by adding some error handling and email function. 

 

Change the tenant name and sku type - you want to monitor 

 

$GetConsumedUnits=(Get-MsolAccountSku | where {$_.AccountSkuId -eq "tenant:ENTERPRISEPACK"}) | Select-Object ConsumedUnits
If ($GetConsumedUnits.ConsumedUnits -gt xx)
{
Call Email  Alert Function
}

 

Cheers,

H,

@Hemat Maheshwari 

Thanks Hemat, i will start to do some test right now :).

@Cristian Ceobanu, this is probably what you are looking for. https://insterswap.wordpress.com/2020/03/29/automatically-alert-your-team-when-your-tenant-is-runnin...

Depending on how big or complicated your environment is, the script may require a little modification. Our need was just as simple as “tell us when our license is low or out”. As the saying goes, necessity is the mother of invention. Feel free to modify the script.

@Cristian Ceobanu Try this: https://janbakker.tech/use-power-automate-or-logic-apps-to-keep-an-eye-on-your-licenses/

 

no scripts, and you can work with percentage threshold and a specific number. 

Hi @Hemat Maheshwari

I'm schedule to run weekly and send an email.
Get-MsolAccountSku | select ActiveUnits, ConsumedUnits, @{n='AvailableUnits';e={($_.ActiveUnits - $_.ConsumedUnits)}}, AccountSkuId

But how do i email only Availableunit under 5 ?

@AusSupport180 

 

You simply store the results of that in a variable, then you can do a foreach loop for each line, and do some fancy percentage maths to see if anyone is over a certain level, then send a mail based on that.

 

type:

$licenseinfo = Get-MsolAccountSku | select ActiveUnits, ConsumedUnits, @{n='AvailableUnits';e={($_.ActiveUnits - $_.ConsumedUnits)}}, AccountSkuId

foreach ($sku in $licenseinfo) {

$percentageused = $sku.ConsumedUnits / $sku.ActiveUnits * 100

 

if ($percentageused -ge 80) {

 

#send mail function

}
}

Hi, here is a script you can run from Azure Automation... you can now also create a free sendgrid account directly in Azure Solutions to call from a runbook. Cheers 😃
https://www.howdoiuseacomputer.com/index.php/2021/09/12/azure-microsoft-365-licensing-alert/