Forum Discussion

Cristian Ceobanu's avatar
Cristian Ceobanu
Copper Contributor
Jul 31, 2019

Get email alerts for low than 50 free Office 365 licenses

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-storage-microsoft-flow/

10 Replies

  • Kdships's avatar
    Kdships
    Copper Contributor

    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-running-low-or-out-of-office-365-license/

    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 

     

    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,

    • AusSupport180's avatar
      AusSupport180
      Brass Contributor
      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 ?
      • SimBur2365's avatar
        SimBur2365
        Brass Contributor
        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/
  • 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.

    • Cristian Ceobanu's avatar
      Cristian Ceobanu
      Copper Contributor

      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.

Resources