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

Add warning to Get-PnPTenantInfo about required permissions #4473

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")]
[RequiredApiApplicationPermissions("graph/CrossTenantInformation.ReadBasic.All")]
NishkalankBezawada marked this conversation as resolved.
Show resolved Hide resolved
[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
Loading