Skip to content

Remove-MgmtGraphSubscribedSku

MgmtGraph: Deletes a tenant license subscription (SKU)

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

[CmdletBinding()]
Param (
    [Parameter(Mandatory = $true, Position = 0)]
    [string]$Identity
)

Process {
    try {
        $params = @{
            'SubscribedSkuId' = $Identity
            'Confirm'         = $false
            'ErrorAction'     = 'Stop'
        }

        Remove-MgSubscribedSku @params
        
        $result = [PSCustomObject]@{
            SkuId     = $Identity
            Action    = "SubscribedSkuRemoved"
            Status    = "Success"
            Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
        }

        Write-Output $result
    }
    catch {
        throw
    }
}

Specifies the ID of the Subscribed SKU to remove.

An interactive directory of PowerShell scripts.