Sp-starter-kit: Apply-PnPProvisioningHierarchy : Access denied. You do not have permission to perform this action or access this resource.

Created on 30 Oct 2018  ·  6Comments  ·  Source: pnp/sp-starter-kit

Issue: Getting Access Denied while running "Apply-PnPProvisioningHierarchy" command.

Error Message: Apply-PnPProvisioningHierarchy : Access denied. You do not have permission to perform this action or access this

capture3

Step followed:

  1. Import-Module "C:KaushalStuff DataspfxStarter KitPowerShellGet-developmentsrcPowerShellGetPowerShellGet"
  2. Install-Module SharePointPnPPowerShellOnline
  3. Connect-PnPOnline https://tenent.sharepoint.com/
  4. cd "C:KaushalStuff DataspfxStarter Kitsp-starter-kit-masterprovisioning"
  5. Apply-PnPProvisioningHierarchy -Path .starterkit.pnp -Parameters @{"Company"="CompanyName";"SiteUrlPrefix"="Company";"WeatherCity"="City"}

Most helpful comment

Okay, in my case it was because I was not administrator of the term store (which is odd, but still) as explained in your troubleshooting guide.
Found using Set-PnPTraceLog -On -Level Debug which helped to identify that it crashed here:
powershell.exe Information: 0 : 2018-11-06 13:11:59.8878 [Term Groups] [10] [Debug] Code execution scope started 0ms 002ce31d-ae04-4854-bc5d-bd57993dfc5a
powershell.exe Information: 0 : 2018-11-06 13:12:01.7631 [_Term Groups_] [10] [Debug] Code execution scope ended 1871ms 002ce31d-ae04-4854-bc5d-bd57993dfc5a
powershell.exe Information: 0 : 2018-11-06 13:12:01.7631 [Provisioning] [10] [Debug] Code execution scope ended 12813ms 002ce31d-ae04-4854-bc5d-bd57993dfc5a
Apply-PnPProvisioningHierarchy : Accès refusé. Vous n’êtes pas autorisé à effectuer cette action ou à accéder à cette
ressource.

All 6 comments

Hi!

The moment this error occurs, can you execute:

Get-PnPException

and include output here?

Same error here. Output is:
Message : Accès refusé. Vous n’êtes pas autorisé à effectuer cette action ou à accéder à cette ressource.
Stacktrace : à Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
à Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
à Microsoft.SharePoint.Client.ClientRequest.d__4.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a
été levée ---
à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à Microsoft.SharePoint.Client.ClientRequest.d__0.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a
été levée ---
à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à Microsoft.SharePoint.Client.ClientRuntimeContext.d__0.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a
été levée ---
à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à Microsoft.SharePoint.Client.ClientContext.d__4.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a
été levée ---
à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à Microsoft.SharePoint.Client.ClientContextExtensions.d__7.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a
été levée ---
à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à Microsoft.SharePoint.Client.ClientContextExtensions.ExecuteQueryRetry(ClientRuntimeContext
clientContext, Int32 retryCount, Int32 delay, String userAgent)
à OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.TokenDefinitions.SiteCollectionTermGrou
pNameToken.GetReplaceValue()
à OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.Utilities.TermGroupHelper.ProcessGroup(
ClientContext context, TaxonomySession session, TermStore termStore, TermGroup modelTermGroup,
TermGroup siteCollectionTermGroup, TokenParser parser, PnPMonitoredScope scope)
à OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.ObjectHierarchySequenceTermGroups.Provi
sionObjects(Tenant tenant, ProvisioningHierarchy hierarchy, String sequenceId, TokenParser parser,
ProvisioningTemplateApplyingInformation applyingInformation)
à OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.SiteToTemplateConversion.ApplyProvision
ingHierarchy(Tenant tenant, ProvisioningHierarchy hierarchy, String sequenceId,
ProvisioningTemplateApplyingInformation provisioningInfo)
à SharePointPnP.PowerShell.Commands.Provisioning.ApplyProvisioningHierarchy.ExecuteCmdlet()
à SharePointPnP.PowerShell.Commands.PnPCmdlet.ProcessRecord()
ScriptLineNumber : 1

Okay, in my case it was because I was not administrator of the term store (which is odd, but still) as explained in your troubleshooting guide.
Found using Set-PnPTraceLog -On -Level Debug which helped to identify that it crashed here:
powershell.exe Information: 0 : 2018-11-06 13:11:59.8878 [Term Groups] [10] [Debug] Code execution scope started 0ms 002ce31d-ae04-4854-bc5d-bd57993dfc5a
powershell.exe Information: 0 : 2018-11-06 13:12:01.7631 [_Term Groups_] [10] [Debug] Code execution scope ended 1871ms 002ce31d-ae04-4854-bc5d-bd57993dfc5a
powershell.exe Information: 0 : 2018-11-06 13:12:01.7631 [Provisioning] [10] [Debug] Code execution scope ended 12813ms 002ce31d-ae04-4854-bc5d-bd57993dfc5a
Apply-PnPProvisioningHierarchy : Accès refusé. Vous n’êtes pas autorisé à effectuer cette action ou à accéder à cette
ressource.

yes, that was it.

thanks... :)

Thank you, I had the same problem.
For a fresh Tenant, nobody is administrator of the term store.

Hi, we are working on cleaning up the issues list. I realize this ticket is about 1.5 years old. If this still applies to you, could you please open up a new issue in the issues list? Thanks!

Was this page helpful?
0 / 5 - 0 ratings