Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New Feature] - Get-PnPTenantInfo - to get tenant info of any tenant #3414

Merged
merged 13 commits into from
Sep 26, 2023

Conversation

NishkalankBezawada
Copy link
Contributor

@NishkalankBezawada NishkalankBezawada commented Sep 15, 2023

Type

  • Bug Fix
  • New Feature
  • Sample

What is in this Pull Request ?

Gets information about any tenant

SYNOPSIS

Gets information about any tenant

SYNTAX

By TenantId

Get-PnPTenantInfo -TenantId <String>

By DomainName

Get-PnPTenantInfo -DomainName <String>

Current Tenant

Get-PnPTenantInfo

DESCRIPTION

Gets information about any tenant. If no Domain name or Tenant id is specified, it returns the Tenant Info of the current tenant.

EXAMPLES

EXAMPLE 1

Get-PnPTenantInfo -TenantId "e65b162c-6f87-4eb1-a24e-1b37d3504663"

TenantId                             FederationBrandName DisplayName DefaultDomainName
--------                             ------------------- ----------- -----------------
e65b162c-6f87-4eb1-a24e-1b37d3504663                     contoso      contoso.onmicrosoft.com

Returns the tenant information of the specified TenantId as shown. A valid connection with Connect-PnPOnline is required either

EXAMPLE 2

Get-PnPTenantInfo -DomainName "contoso.com"

TenantId                             FederationBrandName DisplayName DefaultDomainName
--------                             ------------------- ----------- -----------------
e65b162c-6f87-4eb1-a24e-1b37d3504663                     contoso      contoso.onmicrosoft.com

Returns the Tenant Information for the tenant contoso.sharepoint.com as shown. A valid connection with Connect-PnPOnline is required either

EXAMPLE 3

Get-PnPTenantInfo

TenantId                             FederationBrandName DisplayName DefaultDomainName
--------                             ------------------- ----------- -----------------
e65b162c-6f87-4eb1-a24e-1b37d3504663                     contoso      contoso.onmicrosoft.com

Returns Tenant Information of the current tenant.

EXAMPLE 4

Get-PnPTenantInfo -CurrentTenant

TenantId                             FederationBrandName DisplayName DefaultDomainName
--------                             ------------------- ----------- -----------------
e65b162c-6f87-4eb1-a24e-1b37d3504663                     contoso      contoso.onmicrosoft.com

Returns Tenant Information of the current tenant.

PARAMETERS

-TenantId

The id of the tenant to retrieve the information. You can use either TenantId or DomainName to fetch the Tenant information of any tenant.

Type: String
Parameter Sets: GETINFOBYTENANTID

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

-DomainName

The Domain name of the tenant to lookup. You can use either TenantId or DomainName to fetch the Tenant information of any tenant. Use the full domain name as "contoso.onmicrosoft.com"

Type: String
Parameter Sets: GETINFOBYTDOMAINNAME

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

-CurrentTenant

Gets the Tenant Information of the current tenant.

Type: SwitchParameter
Parameter Sets: GETINFOOFCURRENTTENANT

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

RELATED LINKS

tenantRelationship: findTenantInformationByTenantId

tenantRelationship: findTenantInformationByDomainName

@gautamdsheth
Copy link
Collaborator

gautamdsheth commented Sep 15, 2023

Hi @NishkalankBezawada - do you need this cmdlet ? We already have Get-PnPTenantId cmdlet which retrieves tenant Id value .

What we usually do here is we add only cmdlets which we should need in your day to day life or which complete a story like the one you did PnPFlowOwner

Adding more cmdlets means we will have to spend more time in maintaining it. So , need to add only those ones which we absolutely need.

@NishkalankBezawada
Copy link
Contributor Author

NishkalankBezawada commented Sep 15, 2023

Hi @NishkalankBezawada - do you need this cmdlet ? We already have Get-PnPTenantId cmdlet which retrieves tenant Id value .

What we usually do here is we add only cmdlets which we should need in your day to day life or which complete a story like the one you did PnPFlowOwner

Adding more cmdlets means we will have to spend more time in maintaining it. So , need to add only those ones which we absolutely need.

Hello @gautamdsheth,

Agreed. But I did see some scope of enhancement in this command (may be), and took an inspiration from cli-m365-tenant-info-get.

Anyways, should i close the PR then? Please suggest

Thanks,
Nishkalank Bezawada

@KoenZomers
Copy link
Collaborator

Get-PnPTenantId just gets the tenant Id. We also have Get-PnPTenantInstance but that just gets the URLs and data locations of a tenant. This new cmdlet would allow to retrieve the default domain name. That could be useful and I don't believe we have anything as such today yet. I would say for the scenario where you don't provide any parameters, as I see in your example above, it would return an error. Could that be updated to show the info about the currently connected to tenant instead? That would fall more in line with how other cmdlets work today.

@gautamdsheth What do you think?

I would say we keep it

@KoenZomers KoenZomers added in review PR or issue is currently being reviewed needs discussion labels Sep 18, 2023
@gautamdsheth
Copy link
Collaborator

@NishkalankBezawada / @KoenZomers - yeah ok lets keep it. Leaving some review comments.

src/Commands/Model/TenantInfo.cs Outdated Show resolved Hide resolved
src/Commands/Admin/GetTenantInfo.cs Outdated Show resolved Hide resolved
@NishkalankBezawada
Copy link
Contributor Author

Get-PnPTenantId just gets the tenant Id. We also have Get-PnPTenantInstance but that just gets the URLs and data locations of a tenant. This new cmdlet would allow to retrieve the default domain name. That could be useful and I don't believe we have anything as such today yet. I would say for the scenario where you don't provide any parameters, as I see in your example above, it would return an error. Could that be updated to show the info about the currently connected to tenant instead? That would fall more in line with how other cmdlets work today.

@gautamdsheth What do you think?

I would say we keep it

Hello @KoenZomers

As suggested in this conversation, I have implemented

Get-PnPTenantInfo which will return the current tenant information

Thanks,
Nishkalank

@KoenZomers
Copy link
Collaborator

Thanks @NishkalankBezawada , nice addition!

@KoenZomers KoenZomers merged commit 03c22de into pnp:dev Sep 26, 2023
3 checks passed
@NishkalankBezawada
Copy link
Contributor Author

Thanks @NishkalankBezawada , nice addition!

Thanks @KoenZomers For your support.

@NishkalankBezawada NishkalankBezawada deleted the New-Command-Get-Tenant-Info branch September 26, 2023 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in review PR or issue is currently being reviewed needs discussion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants