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
Step followed:
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.
--- 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.
--- 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.
--- 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.
--- 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.
--- 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!
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.