Pnp error when connect-pnponline

Tanmoy Das 806 Reputation points
2021-01-05T05:58:08.76+00:00

Hi,

When I am trying to connect-Pnponline, getting this error

Connect-PnPOnline : AADSTS65001: The user or administrator has not consented to use the application with ID
'31359c7f-bd7e-475c-86db-fdb8c937548e' named 'PnP Management Shell'. Send an interactive authorization request for
this user and resource.

I am not using any application to connect, just using credential.

Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} vote

3 answers

Sort by: Most helpful
  1. TylerH 66 Reputation points
    2021-01-27T19:05:59.373+00:00

    See this response https://github.com/pnp/sp-starter-kit/issues/436#issuecomment-694936145

    You have to connect with Connect-PnPOnline -Url <url> -PnPManagementShell and then you will receive a code to enter on https://microsoft.com/devicelogin, where you will need to login with credentials for an account that must have the Application Admin role assigned to them in the Admin Center, and then you can consent to give PnP Management Shell access to your tenant.

    After that, you should be able to login with Connect-PnPOnline -Url <url> again.

    12 people found this answer helpful.

  2. Aydin, Serkar 6 Reputation points
    2021-07-10T05:22:45.383+00:00

    Meanwhile you can do it with Connect-PNPonline -url <url> -interactive
    connecting-to-sharepoint-online

    1 person found this answer helpful.
    0 comments No comments

  3. JoyZ 18,126 Reputation points
    2021-01-05T08:51:22.503+00:00

    Hi anonymous user,

    Please provide the complete PnP Powershell for further troubleshooting.

    Per my test, I connect to SharePoint prompting for the username and password to use to authenticate without errors:

    Connect-PnPOnline -Url https://contoso.sharepoint.com -Credentials (Get-Credential)  
    

    Update the module to latest version then compare the result:

    Update-Module SharePointPnPPowerShell*  
    

    If an Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.