Skip to content

Commit 3d6072f

Browse files
Add warning to Get-PnPTenantInfo about required permissions (#4473)
* 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 <gautamdsheth@outlook.com>
1 parent 1b8af72 commit 3d6072f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

documentation/Get-PnPTenantInfo.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ online version: https://pnp.github.io/powershell/cmdlets/Get-PnPTenantInfo.html
1212
## SYNOPSIS
1313
Gets information about any tenant
1414

15+
** Required Permissions **
16+
Graph: CrossTenantInformation.ReadBasic.All
17+
1518
## SYNTAX
1619

1720
### Current Tenant (default)

src/Commands/Admin/GetTenantInfo.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Microsoft.SharePoint.Client;
2+
using PnP.PowerShell.Commands.Attributes;
23
using PnP.PowerShell.Commands.Base;
34
using PnP.PowerShell.Commands.Utilities.REST;
45
using System;
@@ -7,6 +8,7 @@
78
namespace PnP.PowerShell.Commands.Admin
89
{
910
[Cmdlet(VerbsCommon.Get, "PnPTenantInfo")]
11+
[RequiredApiDelegatedOrApplicationPermissions("graph/CrossTenantInformation.ReadBasic.All")]
1012
[OutputType(typeof(Model.TenantInfo))]
1113
public class GetTenantInfo : PnPAdminCmdlet
1214
{
@@ -35,13 +37,13 @@ protected override void ExecuteCmdlet()
3537
var requestUrl = BuildRequestUrl();
3638

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

4244
private string BuildRequestUrl()
4345
{
44-
var baseUrl = $"https://{Connection.GraphEndPoint}/v1.0/tenantRelationships/";
46+
var baseUrl = $"/v1.0/tenantRelationships/";
4547
var query = string.Empty;
4648
switch (ParameterSetName)
4749
{

0 commit comments

Comments
 (0)