Skip to main content

Resolve-MsIdTenant

SYNOPSIS

Resolve TenantId or DomainName to an Azure AD Tenant

SYNTAX

Resolve-MsIdTenant [-TenantValue] <String[]> [[-Environment] <String>] [-SkipOidcMetadataEndPoint]
[-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

Resolves TenantID or DomainName values to an Azure AD tenant to retrieve metadata about the tenant when resolved

EXAMPLES

EXAMPLE 1

Resolve-MsIdTenant -Tenant example.com

Resolve tenant example.com

EXAMPLE 2

Resolve-MsIdTenant -TenantId c19543f3-d36c-435c-ad33-18f11b8c1a15

Resolve tenant guid c19543f3-d36c-435c-ad33-18f11b8c1a15

EXAMPLE 3

Resolve-MsIdTenant -Tenant "example.com","c19543f3-d36c-435c-ad33-18f11b8c1a15"

Resolve tenant domain, example.com, and tenant guid, c19543f3-d36c-435c-ad33-18f11b8c1a15.

EXAMPLE 4

$DomainList = get-content .\DomainList.txt
Resolve-MsIdTenant -Tenant $DomainList

Resolve tenants in DomainList.txt

PARAMETERS

-TenantValue

The TenantId in GUID Format or TenantDomainName in DNS Name format to attempt to resolve to Azure AD tenant

Type: String[]
Parameter Sets: (All)
Aliases: DomainName, TenantId

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

-Environment

Environment to Resolve Azure AD Tenant In (Global, USGov, China, USGovDoD, Germany)

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: Global
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

-SkipOidcMetadataEndPoint

Include resolving the value to an Azure AD tenant by the OIDC Metadata endpoint

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-ProgressAction

{{ Fill ProgressAction Description }}

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

System.String

NOTES

  • Azure AD OIDC Metadata endpoint - https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-protocols-oidc#fetch-the-openid-connect-metadata-document
  • A Result of NotFound does not mean that the tenant does not exist at all, but it might be in a different cloud environment. Additional queries to other environments may result in it being found.
  • Requires CrossTenantInfo.ReadBasic.All scope to read MS Graph API info, i.e. Connect-MgGraph -Scopes CrossTenantInfo.ReadBasic.All
  • THIS CODE-SAMPLE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. This sample is not supported under any Microsoft standard support program or service. The script is provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the script be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample or documentation, even if Microsoft has been advised of the possibility of such damages, rising out of the use of or inability to use the sample script, even if Microsoft has been advised of the possibility of such damages.