Skip to main content

Get-XdrMtoTenantList

SYNOPSIS​

Retrieves the list of accessible tenants from Microsoft Defender XDR.

SYNTAX​

Get-XdrMtoTenantList [-Force] [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION​

Gets the list of tenants that the current user has access to in the Microsoft Defender XDR portal, including tenant information such as name, tenant ID, environment, and access status. This function includes caching support with a 30-minute TTL to reduce API calls.

EXAMPLES​

EXAMPLE 1​

Get-XdrMtoTenantList
Retrieves the list of accessible tenants using cached data if available.

EXAMPLE 2​

Get-XdrMtoTenantList -Force
Forces a fresh retrieval of the tenant list, bypassing the cache.

EXAMPLE 3​

Get-XdrMtoTenantList | Where-Object $_.selected
Retrieves the currently selected tenant.

EXAMPLE 4​

Get-XdrMtoTenantList | Where-Object -not $_.lostAccess
Retrieves only tenants where access has not been lost.

PARAMETERS​

-Force​

Bypasses the cache and forces a fresh retrieval from the API.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-ProgressAction​

The ProgressAction parameter is a common parameter, not a cmdlet parameter. For more information, see about_CommonParameters.

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
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​

Object[]​

Returns an array of tenant information objects with properties:​

- selected: Whether this is the currently selected tenant​

- lostAccess: Whether access to this tenant has been lost​

- name: The display name of the tenant​

- tenantId: The Azure AD tenant ID (GUID)​

- tenantAadEnvironment: The AAD environment type (1 = Public Cloud)​

- addedOn: The date when the tenant was added (if available)​

Also returns responseTypes object with B2B and GDAP status​

NOTES​