Sp-starter-kit: Connect-PnPOnline : Exception has been thrown by the target of an invocation

Created on 18 Jun 2019  路  11Comments  路  Source: pnp/sp-starter-kit

Category

  • [x] Question
  • [ ] Bug
  • [ ] Enhancement

Expected or Desired Behavior

I try to install sharepoint starter kit. First thing is to run following command Connect-PnPOnline https://tenant.sharepoint.com in order to connect successfully.

Observed Behavior

I am behind a corporate proxy and try to run following command: Connect-PnPOnline https://.sharepoint.com . This resolved in an 407 error. I solved the 407 error by setting following property in PS: [System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials . After setting this property the 407 error is gone. When I run the command again, I got prompted for my user credentials. After entering the credentials I get following error: Connect-PnPOnline : Exception has been thrown by the target of an invocation.
At line:1 char:1

  • Connect-PnPOnline https://.sharepoint.com
  • ~~~~~~~~~~~~~~~~~

    • CategoryInfo : NotSpecified: (:) [Connect-PnPOnline], TargetInvocationException

    • FullyQualifiedErrorId : System.Reflection.TargetInvocationException,SharePointPnP.PowerShell.Commands.Base.Conne

      ctOnline

When I use Connect-PnPOnline https://tenant.sharepoint.com -UseWebLogin I am not receiving the exception.
As the next steps I try to run following command: Apply-PnPTenantTemplate -Path starterkit.pnp -Parameters @{"SiteUrlPrefix"="demo"} and receiving following error:

Apply-PnPTenantTemplate : The remote server returned an error: (401) Unauthorized.
At line:1 char:1

  • Apply-PnPTenantTemplate -Path starterkit.pnp -Parameters @{"SiteUrlPr ...
  • ~~~~~~~~~~~~~~~~~

    • CategoryInfo : NotSpecified: (:) [Apply-PnPTenantTemplate], WebException

    • FullyQualifiedErrorId : System.Net.WebException,SharePointPnP.PowerShell.Commands.Provisioning.Tenant.ApplyTenan

      tTemplate

Please help,
Fabske411

Author Feedback

Most helpful comment

Has this issue been resolved? I am having a similar issue.

All 11 comments

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

Has this issue been resolved? I am having a similar issue.

Connect-PNPOnline is also broken for me.

Same here.
I use Windows Authentication manager with a generic authentication. This authentication is stored under the name "OrganisationName", and possesses account's email and password.

I am using the following code :
$orgName='OrganisationName' $modelURL = 'https://TenantName.sharepoint.com/sites/TemplateSite' Connect-PnPOnline -Url $modelURL -Credentials $orgName

And I get the following exception :

Connect-PnPOnline : Une exception a 茅t茅 lev茅e par la cible d'un appel.
Au caract猫re Ligne:1 : 1

  • Connect-PnPOnline -Url $modelURL -Credentials $orgName
  • ~~~~~~~~~~~~~~

    • CategoryInfo : NotSpecified: (:) [Connect-PnPOnline], TargetInvocationException

    • FullyQualifiedErrorId : System.Reflection.TargetInvocationException,SharePointPnP.PowerShell.Commands.Base.Conne

      ctOnline

It is quite urgent and blocking.

Do you have any news on this behavior ?

I was having the same issue with SharePointPnPPowerShellOnline 3.15.1911.0. I tried it in both PowerShell window and SPO Management Shell window, with the same result. Nothing remarkable about my environment, just a standard Dev subscription/tenant.

But this worked: Connect-PnPOnline -Url https://contoso.sharepoint.com -SPOManagementShell

If you are having an issue with PnP PowerShell, please try the PnP PowerShell issues list.

https://github.com/SharePoint/PnP-PowerShell/issues

Since you are having issues with Connect-PnPOnline, this is a prior step to the actual provisioning of the kit.

Do your users have MFA enabled perhaps?

This issue has been automatically marked as stale because it has marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within next 7 days of this comment. Thank you for your contributions to SharePoint Developer activities.

Closing issue due no response from original author. If this issue is still occurring, please open a new issue with additional details. Notice that if you have included another related issue as additional comment on this, please open that also as separate issue, so that we can track it independently.

Just ran into the issue. It's a GCC environment with MFA enabled.

@goodjohnscott this sounds as though a similar MFA issue related to: https://github.com/pnp/sp-starter-kit/issues/417. MFA currently does not appear supported by PnP Provisioning when attempting to add SPFx solutions to that app catalog, thus the kit install fails.

Was this page helpful?
0 / 5 - 0 ratings