Skip to content

Get-MgmtGraphSubscribedSku

MgmtGraph: Audits tenant license subscriptions (SKUs)

#Requires -Version 5.1
#Requires -Modules Microsoft.Graph.Identity.DirectoryManagement

[CmdletBinding()]
Param ()

Process {
    try {
        $skus = Get-MgSubscribedSku -ErrorAction Stop
        
        $results = foreach ($s in $skus) {
            [PSCustomObject]@{
                SkuPartNumber = $s.SkuPartNumber
                SkuId         = $s.SkuId
                Consumed      = $s.ConsumedUnits
                Enabled       = $s.PrepaidUnits.Enabled
                Warning       = $s.PrepaidUnits.Warning
                Suspended     = $s.PrepaidUnits.Suspended
                Timestamp     = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
            }
        }

        Write-Output ($results | Sort-Object SkuPartNumber)
    }
    catch {
        throw
    }
}

This script has no configurable parameters.

An interactive directory of PowerShell scripts.