Intermitten "Failed to apply web template." when using ApplyProvisioningTemplate

%3CLINGO-SUB%20id%3D%22lingo-sub-826588%22%20slang%3D%22en-US%22%3EIntermitten%20%22Failed%20to%20apply%20web%20template.%22%20when%20using%20ApplyProvisioningTemplate%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-826588%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20using%20a%20Azure%20Function%20together%20with%20a%20Logic%20App%20to%20provision%20new%20SiteCollections.%20Intermittenly%20I%20get%3A%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EFailed%20to%20apply%20web%20template.%3CBR%20%2F%3ESite%3A%20%7Burl%7D%3CBR%20%2F%3ETemplate%3A%20D%3A%5Chome%5Csite%5Cwwwroot%5CFiles%5CTemplate%5Cweb-template.xml%3CBR%20%2F%3EOperation%20is%20not%20valid%20due%20to%20the%20current%20state%20of%20the%20object.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20able%20to%20apply%20the%20template%20using%20PowerShell%26nbsp%3B%3CSPAN%3EApply-PnPProvisioningTemplate%20afterwards.%20What%20are%20the%20likely%20culprits%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20am%20checking%20that%20the%20sitecollection%20exists%20prior%20to%20adding%20the%20template.%20For%20the%20most%20part%20everything%20works%20fine%2C%20but%20sometimes%20it%20fails.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EP%C3%A5l%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

Hi,

 

I am using a Azure Function together with a Logic App to provision new SiteCollections. Intermittenly I get:


Failed to apply web template.
Site: {url}
Template: D:\home\site\wwwroot\Files\Template\web-template.xml
Operation is not valid due to the current state of the object.

 

I am able to apply the template using PowerShell Apply-PnPProvisioningTemplate afterwards. What are the likely culprits?

 

I am checking that the sitecollection exists prior to adding the template. For the most part everything works fine, but sometimes it fails.

 

Pål

 

0 Replies