Forum Discussion
Intermittent "403 - Forbidden" error while running web.ApplyProvisioningTemplate on SPO sites.
Absolutely familiar, in a scenario where I create a site with New-SPOTenantSite and then apply a .pnp (so not an .xml, but I don't think it matters) template in the same script. When I run into this problem, the same happens with other PnP commands I use on the new site in my script, even though I'm able to connect to that new site with Connect-SPOnline, and the new site is accessible through a browser with the same user for which I got the "403: Forbidden" error for the PnP commands.
The solution (more precisely, the workaround) is to wait for a while, and then try to run again these previously failed PnP commands - after a waiting period they work properly.
Thanks Zoltan!
Do you have an estimate of how long the wait should be? We are using the PnP code in an automated solution, so trying to come up with a more precise algorithm...
Also, were you able to determine any pattern to this issue through your observations, or does it appear to be completely random?
- Zoltan BagyonNov 16, 2016Steel Contributor
I'm not using it often, I accepted that it works this way and I can live with it, so I have not ever measured, but as far as I remember, it was about 10 mins or so. My feeling is that it's somewhat random, at least I remember cases where it worked fine, while in other cases it ran into error 403.