Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply-PnPTenantTemplate : Your template contains artifacts that require an access token. Please provide consent to the PnP Management Shell application first by executing: Register-PnPManagementShellAccess #18

Open
bigpix2000 opened this issue Oct 19, 2020 · 21 comments
Assignees
Labels
bug Something isn't working in progress

Comments

@bigpix2000
Copy link

The Full Error appears as noted in the tweet: Apply-PnPTenantTemplate : Your template contains artifacts that require an access token. Please provide consent to the
PnP Management Shell application first by executing: Register-PnPManagementShellAccess
At line:1 char:1

  • Apply-PnPTenantTemplate -Path .\SiteDesignsStudio.pnp -Parameter @{Te ...
  •   + CategoryInfo          : WriteError: (:) [Apply-PnPTenantTemplate], PSInvalidOperationException
      + FullyQualifiedErrorId : EXCEPTION,PnP.PowerShell.Commands.Provisioning.Tenant.ApplyTenantTemplate
    
    

In effect, it is complaining about something in the PnP package itself that it needs access to.

I can confirm that when the package was manually dropped into the App catalog, it was given tenant wide access and it informed me that we needed to go to API management to grant access to which in the pending area, we found the request and approved it hours ago. It is not clear if there is a time factor for that access assuming it is related to this problem

Steps to confirm

  1. cloned from Github
  2. directly dropped pre-created package into App Catalog (note that we also did a full build and also ran publishing in an attempt at a separate dev tenant to get the same results)
  3. Checked the box for access tenant wide
  4. visited SharePoint Admin site, Advanced, API Access Management
  5. Found Pending request for MS Graph access - approved it
  6. Created Team site SiteDesignsStudio (same as the "default")
  7. Updated the powershell script with parameter -UseWebLogin because MFA is enabled on all dev tenants (security is not allowing us to disable this right now)
  8. Ran Setup.ps1 -tenantName {tenant name also tried tenantname-admin} - challenged for log in (subsequent attempts only ask for confirmation of which login among many to choose) and waited for result as above

Lookup on similar issues where the fix was to update the PnP package XML header and footer info albeit they do not appear to be related to this package. cc: @ypcode

@sympmarc
Copy link

Related: pnp/PnP-Sites-Core#2750

@bigpix2000
Copy link
Author

Ah yes I forgot to mention @ypcode That I saw pnp/PnP-Sites-Core #2750 which implied there was something in the PnP XML that may be an issue ... recalling you did not change anything as you tweeted, there was a lot there to "unbundle" and some attempts to mess around with it cause the package to fail for other reasons ... hopefully that note from @sympmarc can help isolate the issue and I don't mind making changes on this end to confirm it. Thank you!

@Oegl
Copy link

Oegl commented Oct 22, 2020

Which concrete Admin-Permissions are needed to exceute the command: Register-PnPManagementShellAccess

@bigpix2000
Copy link
Author

Right now it's not clear what it wants for permissions and hoping @ypcode might know off hand ... have not had a chance to get back on the dev VM I am using for this to capture the error which might reveal the issue. Technically we were able to reproduce this problem in three separate dev tenants so it feels like the setup is "broken" right now (don't think it affects any installed instances)

@ypcode ypcode self-assigned this Oct 23, 2020
@ypcode ypcode added in progress bug Something isn't working labels Oct 23, 2020
@ypcode
Copy link
Collaborator

ypcode commented Oct 23, 2020

Hello friends,

I will have a look at it this weekend and hopefully provide a fixed version of the setup script.

Regards,
Yannick

@bigpix2000
Copy link
Author

@ypcode - on my end, I got stuck trying to get around Register-PnPManagementShellAccess to do anything without kicking off the need to interactively log in. The main thing for CI\CD is not to require interactive login in an MFA environment. Will you address this in your fix or should I consider that a separate issue? Thanks!

@afinn-tech
Copy link

afinn-tech commented Oct 31, 2020

same issue , any update or work around

@johndpalm
Copy link

johndpalm commented Nov 9, 2020

Same issue. We use MFA. Tried adding -UserWebLogin to Connect-PnPOnline but still get error:

Apply-PnPTenantTemplate : Your template contains artifacts that require an access token. Please provide consent to the PnP Management Shell application first by executing: Register-PnPManagementShellAccess

I ran Register-PnPManagementShellAccess successfully with no change to error.

@rachaelsingleton
Copy link

Same issue.

@ypcode
Copy link
Collaborator

ypcode commented Nov 15, 2020

Hello friends,

Really sorry for the delay. Quite a lot of things hood me back from taking care of this as I planned to.
Will try to address it ASAP!

If anyone is eager to contribute, it is also more than welcome!

Best regards,
Yannick

@afinn-tech
Copy link

@ypcode it seems to related to mfa if that helps .

@james-dellow
Copy link

james-dellow commented Nov 25, 2020

Have the same issue and using MFA, but with Apply-PnPProvisioningTemplate, although not using Site Designs Studio. Looks similar to this issue? pnp/PnP-Sites-Core#2750

@Matej4386
Copy link

Same bug here :-(

@bigpix2000
Copy link
Author

@ypcode , hoping your adventures recently blogged are giving a leg up on this? ;-)

@DDog80sRocked
Copy link

Same issue here after upgrading to the latest SharePoint Online Powershell module. I can't recall the previous version I was using but it had an unrelated error so I thought updating would help. I was wrong. :)

@J0rtIT
Copy link

J0rtIT commented Jan 26, 2021

Register-PnPManagementShellAccess -SiteUrl $SourceSite
#Connect to the target site
Connect-PnPOnline -Url $TargetSite -UseWebLogin
Apply-PnPProvisioningTemplate -Path “D:\MyApplications.xml”

image

@NPrice99
Copy link

Hi

Where are we on this one ?

I am getting this error and I cannot get round it.

Thanks

Nigel

@bigpix2000
Copy link
Author

Confirming the error is still there ... looks like it got busy and hoping others in the community can help out ...

@Oegl
Copy link

Oegl commented Apr 22, 2021

For me it worked by removing <pnp:Header Layout="Standard" /> and <pnp:Footer... as well from the template.

See workaround here: [https://github.com/pnp/PnP-Sites-Core/issues/2750#issuecomment-736082217]

@janekk97
Copy link

janekk97 commented Sep 1, 2021

@ypcode any update on this?

@miguelisidoro
Copy link

Any news on this issue?

Getting the same problem and unable to install...

After consenting, it gets stuck.

Tried to unzip the .pnp file and install the web part using the 0e7cfd77-096e-4046-acb5-9c6d698f8f85.sppkg directly in the App Catalog but no new web parts are made available.

I was able in the past to use this and from what I remember I had a SiteDesignsStudio SP site where I could manage site designs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working in progress
Projects
None yet
Development

No branches or pull requests