Skip to content

New command: 'tenant info get' to retrieve details of a tenant #5389

@martinlingstuyl

Description

@martinlingstuyl

Usage

m365 tenant info get [options]

Description

Retrieve information about any tenant

Options

Option Description
-d, --domainName [domainName] The primary domain name of a tenant. Optionally specify either domainName or tenantId but not both. If none are specified, the tenantId of the currently signed-in user is used.
-i, --tenantId [tenantId] The unique tenant identifier of a tenant. Optionally specify either domainName or tenantId but not both. If none are specified, the tenantId of the currently signed-in user is used.

Examples

Get tenant information for the currently signed in user

m365 tenant info get

Get tenant information for the Contoso tenant

m365 tenant info get --domainName contoso.com

Default properties

  • tenantId
  • displayName
  • defaultDomainName

Additional Info

The following endpoints can be used:

https://learn.microsoft.com/en-us/graph/api/tenantrelationship-findtenantinformationbydomainname?view=graph-rest-1.0
https://learn.microsoft.com/en-us/graph/api/tenantrelationship-findtenantinformationbytenantid?view=graph-rest-1.0&tabs=http

If no option is specified, the Tenant ID should be retrieved from the Access Token and used to call one the second endpoint above.

The permission scope CrossTenantInformation.ReadBasic.All should be added to the CLI App Registration.

Response

{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.tenantInformation",
"tenantId": "some-guid",
"federationBrandName": null,
"displayName": "Contoso, Ltd",
"defaultDomainName": "some-domain"
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions