Skip to content

Get-MgLicenseData

SYNOPSIS

Retrieve Microsoft 365 license data.

SYNTAX

Get-MgLicenseData [[-Name] <String>] [<CommonParameters>]

DESCRIPTION

The `Get-MgLicenseData` function retrieves Microsoft 365 license data, including details about total, in-use, and free licenses. It also fetches renewal information for subscriptions and supports filtering by product name using a regular expression.

EXAMPLES

EXAMPLE 1

Get-MgLicenseData

Retrieves license data for all Microsoft 365 products matching the default filter.

EXAMPLE 2

Get-MgLicenseData -Name "Microsoft 365 E5"

Retrieves license data for the "Microsoft 365 E5" product.

EXAMPLE 3

Get-MgLicenseData -Name "Exchange Online"

Retrieves license data for all Exchange Online products.

PARAMETERS

-Name

A regular expression to filter licenses by product name. Defaults to match common Microsoft 365 products such as "Microsoft 365", "Microsoft Entra ID", "Office 365", "Exchange Online", and "Enterprise Mobility".

Type: String
Parameter Sets: (All)
Aliases: DisplayName, ProductName

Required: False
Position: 1
Default value: ^(Microsoft 365 |Microsoft Entra ID |Office 365 |Exchange Online |Enterprise Mobility )
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES