Azure Function and SharePoint PnP PowerShell are mixing up the client context

%3CLINGO-SUB%20id%3D%22lingo-sub-155006%22%20slang%3D%22en-US%22%3EAzure%20Function%20and%20SharePoint%20PnP%20PowerShell%20are%20mixing%20up%20the%20client%20context%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-155006%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3EI'm%20experimenting%20with%20Azure%20Function%2C%20Logic%20apps%2FFlow%20to%20replace%20an%20existing%20SharePoint%20Workflow.%3C%2FP%3E%0A%3CP%3EI've%20found%20a%20weird%20issue%20where%20the%20client%20context%20get%20mixed%20up%20when%20multiple%20flows%20are%20running%20in%20parallel%20and%20try%20to%20call%20the%20azure%20function.%20I've%20found%20a%20workaround%20to%20overcome%20this%20issue%20by%20allowing%20only%20one%20job%26nbsp%3Bon%20the%20azure%20function%20environment.%20It's%20not%20a%20good%20solution%2C%20therefor%20I%20want%20to%20find%20the%20root%20cause%26nbsp%3Bof%20the%20following%20error%20message%20%3A%3C%2FP%3E%0A%3CPRE%3EException%20calling%20%22Load%22%20with%20%221%22%20argument(s)%3A%20%22The%20object%20is%20used%20in%20the%20context%20different%20from%20the%20one%20associated%20with%20the%20object.%22%3C%2FPRE%3E%0A%3CP%3EHas%20someone%20encounter%20a%20similar%20issue%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECheers%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBernd%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-155006%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFunctions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPnP%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-155022%22%20slang%3D%22en-US%22%3ERe%3A%20Azure%20Function%20and%20SharePoint%20PnP%20PowerShell%20are%20mixing%20up%20the%20client%20context%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-155022%22%20slang%3D%22en-US%22%3ESame%20issue%3A%20%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fsocial.msdn.microsoft.com%2FForums%2Fazure%2Fen-US%2F28bff860-e990-4b89-bf67-e6af4efef442%2Fpnp-powershell-in-azure-function-fails-when-to-fast-triggerd-in-a-time-intervall%3Fforum%3DAzureFunctions%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsocial.msdn.microsoft.com%2FForums%2Fazure%2Fen-US%2F28bff860-e990-4b89-bf67-e6af4efef442%2Fpnp-powershell-in-azure-function-fails-when-to-fast-triggerd-in-a-time-intervall%3Fforum%3DAzureFunctions%3C%2FA%3E%3C%2FLINGO-BODY%3E
Highlighted
Contributor

Hi,

I'm experimenting with Azure Function, Logic apps/Flow to replace an existing SharePoint Workflow.

I've found a weird issue where the client context get mixed up when multiple flows are running in parallel and try to call the azure function. I've found a workaround to overcome this issue by allowing only one job on the azure function environment. It's not a good solution, therefor I want to find the root cause of the following error message :

Exception calling "Load" with "1" argument(s): "The object is used in the context different from the one associated with the object."

Has someone encounter a similar issue?

 

Cheers 

Bernd

 

 

1 Reply