Pnp error when connect-pnponline

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


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.

A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
5,977 questions
No comments
1 vote

3 answers

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

    See this response

    You have to connect with Connect-PnPOnline -Url <url> -PnPManagementShell and then you will receive a code to enter on, 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.

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

    Meanwhile you can do it with Connect-PNPonline -url <url> -interactive

    No comments

  3. answered 2021-01-05T08:51:22.503+00:00
    JoyZ 17,881 Reputation points

    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 -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.