question

spadmin avatar image
1 Vote"
spadmin asked AydinSerkar-8656 answered

Pnp error when connect-pnponline

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.

office-sharepoint-online
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

JulieWang-MSFT avatar image
0 Votes"
JulieWang-MSFT answered Srini-4386 commented

Hi @spadmin,

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.


· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @spadmin,

Is there any progress on this issue?

Please feel free to reply.

0 Votes 0 ·

Hi @spadmin,

I’m checking how the things are going on about this issue.

Please feel free to reply if there is any update.

0 Votes 0 ·
TylerH-2964 avatar image
9 Votes"
TylerH-2964 answered MAYOWAODEWOLE-2064 commented

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.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @spadmin,

Agree with Tylerh, if you have updated the PnPManagementShell, it's necessary to grant permission of PnP Management Shell application on your device.

1 Vote 1 ·

Thanks so very much @TylerH-2964

This works perfectly well.

1 Vote 1 ·
AydinSerkar-8656 avatar image
1 Vote"
AydinSerkar-8656 answered

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


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.