If SharePoint on-premises, what's exact CU version:
Any / does not matter
Expected or Desired Behavior
If using PnP-Powershell against SharePoint OnPremises using Windows Authentication against a WebApp that has multiple authentication providers active (for example Windows Auth and Custom Claims Provider), authentication fails if the following request header is not provided:
"X-FORMS_BASED_AUTH_ACCEPTED": "f"
This seems to be caused by the code of the Provisioning Template cmdlets that clones the ClientSideContext object without copying the eventhandlers too.
// In case of existing Event Handlers
clonedClientContext.ExecutingWebRequest += (sender, webRequestEventArgs) =>
{
// Call the ExecutingWebRequest delegate method from the original ClientContext object, but pass along the webRequestEventArgs of
// the new delegate method
MethodInfo methodInfo = clientContext.GetType().GetMethod("OnExecutingWebRequest", BindingFlags.Instance | BindingFlags.NonPublic);
object[] parametersArray = new object[] { webRequestEventArgs };
methodInfo.Invoke(clientContext, parametersArray);
};
Observed Behavior
When using the current version of the PnP-Powershell module against a OnPremises SharePoint with Windows Auth and a WebApp with multiple authentication providers, all cmdlets work apart from all *-PnPProvisioningTemplate cmdlets.
Steps to Reproduce
Run a *-PnPProvisioningTemplate cmdlet against a OnPremises SharePoint farm with a webapp with multiple authentication providers and windows auth.
Category
[x] Bug [ ] Enhancement
Environment
[ ] Office 365 / SharePoint Online [ ] SharePoint 2016 [x] SharePoint 2013
If SharePoint on-premises, what's exact CU version: Any / does not matter
Expected or Desired Behavior
If using PnP-Powershell against SharePoint OnPremises using Windows Authentication against a WebApp that has multiple authentication providers active (for example Windows Auth and Custom Claims Provider), authentication fails if the following request header is not provided: "X-FORMS_BASED_AUTH_ACCEPTED": "f"
This issue has been fixed in PnP-Powershell in the following issue/PR using a eventhandler that injects the header into every request: https://github.com/pnp/PnP-PowerShell/issues/2570 https://github.com/pnp/PnP-PowerShell/pull/2571 The fix in this PR works well, unless you try to use any *-PnPProvisioningTemplate cmdlets.
This seems to be caused by the code of the Provisioning Template cmdlets that clones the ClientSideContext object without copying the eventhandlers too.
This issue can be fixed by reattaching any available eventhandlers to the newly cloned object: https://github.com/pnp/PnP-Sites-Core/blob/c09e0f0590aada578d6b958b532b396e044ffcd4/Core/OfficeDevPnP.Core/Extensions/ClientContextExtensions.cs#L317
Observed Behavior
When using the current version of the PnP-Powershell module against a OnPremises SharePoint with Windows Auth and a WebApp with multiple authentication providers, all cmdlets work apart from all *-PnPProvisioningTemplate cmdlets.
Steps to Reproduce
Run a *-PnPProvisioningTemplate cmdlet against a OnPremises SharePoint farm with a webapp with multiple authentication providers and windows auth.