Skip to content

Commit

Permalink
Add warning to Get-PnPTenantInfo about required permissions (#4473)
Browse files Browse the repository at this point in the history
* Add warning to Get-PnPTenantInfo about required permissions

* Updated Get-PnPTenantInfo documentation with Required Permissions

* Corrected the pull request build error

* Changed the required permissions attribute to use Delegated or Application Permissions

---------

Co-authored-by: Gautam Sheth <[email protected]>
  • Loading branch information
NishkalankBezawada and gautamdsheth authored Oct 29, 2024
1 parent 1b8af72 commit 3d6072f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions documentation/Get-PnPTenantInfo.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ online version: https://pnp.github.io/powershell/cmdlets/Get-PnPTenantInfo.html
## SYNOPSIS
Gets information about any tenant

** Required Permissions **
Graph: CrossTenantInformation.ReadBasic.All

## SYNTAX

### Current Tenant (default)
Expand Down
6 changes: 4 additions & 2 deletions src/Commands/Admin/GetTenantInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.SharePoint.Client;
using PnP.PowerShell.Commands.Attributes;
using PnP.PowerShell.Commands.Base;
using PnP.PowerShell.Commands.Utilities.REST;
using System;
Expand All @@ -7,6 +8,7 @@
namespace PnP.PowerShell.Commands.Admin
{
[Cmdlet(VerbsCommon.Get, "PnPTenantInfo")]
[RequiredApiDelegatedOrApplicationPermissions("graph/CrossTenantInformation.ReadBasic.All")]
[OutputType(typeof(Model.TenantInfo))]
public class GetTenantInfo : PnPAdminCmdlet
{
Expand Down Expand Up @@ -35,13 +37,13 @@ protected override void ExecuteCmdlet()
var requestUrl = BuildRequestUrl();

WriteVerbose($"Making call to {requestUrl} to request tenant information");
var results = RestHelper.Get<Model.TenantInfo>(Connection.HttpClient, requestUrl, graphAccessToken);
var results = GraphHelper.Get<Model.TenantInfo>(this, Connection, requestUrl, graphAccessToken);
WriteObject(results, true);
}

private string BuildRequestUrl()
{
var baseUrl = $"https://{Connection.GraphEndPoint}/v1.0/tenantRelationships/";
var baseUrl = $"/v1.0/tenantRelationships/";
var query = string.Empty;
switch (ParameterSetName)
{
Expand Down

0 comments on commit 3d6072f

Please sign in to comment.