Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question - Provisioning Engine and Azure Functions Best Practice #102

Closed
Nibushi opened this issue Jan 19, 2021 · 3 comments
Closed

Question - Provisioning Engine and Azure Functions Best Practice #102

Nibushi opened this issue Jan 19, 2021 · 3 comments
Assignees
Labels
area: provisioning ⚙ Provisioning engine issue or pull request question Further information is requested

Comments

@Nibushi
Copy link

Nibushi commented Jan 19, 2021

Hi

I was wondering if you had any resources you could point to which outline best practices and configurations for using the PnP Provisioning engine with Azure Function Apps?

I have came across a problem where depending on the complexity of the provisioning template being applied it can take up to 10 minutes. There is a built in time out for Azure Functions of 230 seconds if the function has not returned any data. (There are many posts that cover this including Azure/Azure-Functions#1053 ). This timeout is different than the Azure Function timeout limit and can not be changed or avoided.

When using the inbuilt Azure function test tools in the browser you will see the function being run a second time while the first thread is still running. If you use Postman, you will get a 500 error but checking the Azure function logs you see that the function itself is still executing.

Are there any recommendations around using Azure Durable Functions or Storage queues to avoid this timeout? Also, are there any configuration best practices for the Azure Function App itself for concurrency or performance?

Thanks
Simon

@jansenbe
Copy link
Contributor

@Nibushi ,

The easiest solution is running your function in a Premium or App Service plan, see https://docs.microsoft.com/en-us/azure/azure-functions/functions-scale?WT.mc_id=AZ-MVP-4021705 for more details.

This blog from Tobias Zimmergren provides some good advice as well: https://zimmergren.net/best-practices-for-building-and-designing-azure-functions/

@jansenbe jansenbe self-assigned this Jan 21, 2021
@jansenbe jansenbe added question Further information is requested area: provisioning ⚙ Provisioning engine issue or pull request labels Jan 21, 2021
@Nibushi
Copy link
Author

Nibushi commented Jan 22, 2021

Hi @jansenbe , I'm only starting out with Azure Function so I might be wrong, but the Premium or App service plan wouldn't help in this situation as the 230 second time out still applies if no data is being sent back and forth. The Azure Function will still continue to run in the background however the client calling the Azure Function will receive an error message saying that the Function has timed out.

I am aware that there is a timeout of the functions in the consumption model of 5 minutes which can be extended to 10 minutes which I have already done. As I say this 230 second timeout is different from that and is related to the Azure Function not returning a status code within that time, which happens when applying a large provisioning template.

I've been looking into Durable Functions a lot of examples are in C#. I am open to using C# instead of PowerShell as I was a developer in the past. However, it's been a while and a lot of the examples I have found seem to require some implied knowledge.

Do you know if the are performance benefits in using C# over PowerShell in an Azure Function?

I am hoping that some others might read this post and explain how they handle applying long running templates using Azure Functions.

@jansenbe
Copy link
Contributor

Durable functions can handle this. I'm going to transfer this one to the GitHub discussions as this is not really an issue

@pnp pnp locked and limited conversation to collaborators Jan 25, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
area: provisioning ⚙ Provisioning engine issue or pull request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants