次の方法で共有


How many of my licenses are in use?

Yesterday a good friend of mine, who also happen to be one of my customers, asked an interesting question that no other customer asked me: “Is it possible for us to receive some kind of alert when I’m running out of licenses in Office 365?”

That question got me thinking. And to be honest, I didn’t know the answer… so I went looking for and figured we do not have such alert yet. Worry not, because PowerShell is your friend, and nothing is lost until you say so.

Turns out that AureAD PowerShell module can list all the available subscriptions with the respective numbers of enabled and assigned licenses.

The first thins you must do is to install the AzureAD PowerShell module in your computer. The procedure is documented here.

Then you connect to Azure AD:

Import-Module -Name "AzureAD"Connect-AzureAD | Out-Null

 

And then…

Get-AzureADSubscribedSku | Where-Object {$_.CapabilityStatus -eq "Enabled"} | ForEach-Object {New-Object -TypeName "PSObject" -Property @{SkuPartNumber = $_.SkuPartNumberConsumedUnits = $_.ConsumedUnitsPrepaidUnits = $_.PrepaidUnits.EnabledConsumption = ($_.ConsumedUnits / $_.PrepaidUnits.Enabled).ToString("P")}} | Format-Table -Property SkuPartNumber, PrepaidUnits, ConsumedUnits, Consumption

 

If you save this code as a PowerShell script, it will give you an output like the one bellow:

 

How cool is that?