
Do the following work:
- Connect-PnPOnline -UseWebLogin
- Connect-PnPOnline -SPOManagementShell
Also, the PnP cmdlets have been replaced with the module PnP.PowerShell if you want to try the new ones out.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am trying to connect to a SharePoint online communication site which have MFA enabled, I tried running this command:
PS C:\WINDOWS\system32> connect-pnponline "https://***.sharepoint.com/sites/***/" -PnPO365ManagementShell -launchbrowser
where i will get a popup >> then i will enter the code >> enter username and password >> close the popup >> but I got this error:
WARNING: To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code D****9
to authenticate.
WARNING: Code has been copied to clipboard
connect-pnponline : Object reference not set to an instance of an object.
At line:1 char:2
Although I entered the above code and enter the username and password and confirm the MFA.
Anyone advice please?
here is the popup which i closed:-
Do the following work:
Also, the PnP cmdlets have been replaced with the module PnP.PowerShell if you want to try the new ones out.
Hi, @john john ,
I tested with the cmdlets provided by Trevor and both works with MFA enabled account. Please have a try with the them.
The connect-pnponline "https://***.sharepoint.com/sites/***/" -PnPO365ManagementShell -launchbrowser
stuck after I entering the credential.
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.