Skip to content

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

@bigpix2000

Description

@bigpix2000

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions