Jul 31 2019
01:44 AM
- last edited on
Feb 07 2023
07:59 PM
by
TechCommunityAP
Jul 31 2019
01:44 AM
- last edited on
Feb 07 2023
07:59 PM
by
TechCommunityAP
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
Jul 31 2019 10:24 AM
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.
Aug 01 2019 03:09 AM
@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.
Aug 01 2019 03:27 AM - edited Aug 01 2019 03:29 AM
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,
Aug 01 2019 03:44 AM
Thanks Hemat, i will start to do some test right now :).
Mar 29 2020 03:15 PM
@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.
Jun 28 2020 03:10 AM - edited Jun 28 2020 03:11 AM
@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.
Jul 29 2021 09:24 PM
Aug 25 2021 06:30 AM
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
}
}
Sep 13 2021 01:37 AM