0

I was learning how to use the service principal PowerShell PnP commands and everything was fine until I reached Get-PnPTenantServicePrincipalPermissionRequests. I understand how to grant and revoke permissions for this service principal and how to list the current ones but no idea of what is the mission for getting the requests made and how to treat them.

Is there any way of working with this collection of items? Because I didn't find it.

1

The Get-PnPTenantServicePrincipalPermissionRequests cmdlet returns a collection of SPOWebAppServicePrincipalPermissionRequest objects. this object exposes both an Approve method and a Deny Method. So, for example, if you wanted to Deny all permission requests, your code would look something like:

Connect-PnPOnline -url https://mytenant-admin.sharepoint.com -useweblogin

$permissionRequests = Get-PnPTenantServicePrincipalPermissionRequests
foreach ($req in $permissionRequests)
{
    $req.Deny()
}

Invoke-PnPQuery
| improve this answer | |
  • @willian -Thanks for your response, it has complete sense!!! I'm trying to deny my requests but got an error. I made them with a wrong resource parameter and I think this is the reason why I'm failing. In the other hand, when I grant access to Graph, it is granted automatically without creating a request, do you know why is this happening? – jaloplo Feb 27 at 9:18
  • 1
    I do not know why it would be automatic, perhaps there is another setting somewhere that makes certain types of requests auto-granted? – willman Feb 27 at 9:51
  • @willian - you have two commands in PnP to approve or deny those requests: Approve-PnPTenantServicePrincipalPermissionRequest and Deny-PnPTenantServicePrincipalPermissionRequest. I figure out that they support in the SPOnline Cmdlets. – jaloplo Mar 2 at 13:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.