5
votes

When creating an Azure Function blob trigger template that uses an App Service plan for hosting, the function triggers correctly when configured as "Always on". I have tested by running the app in the Azure console, and by adding a file though the Microsoft Azure Storage Explorer. The logs of these triggers can be found when viewing the Monitor screen for the function.

When creating the same function using the Blob Storage template but this time choosing "Consumption" instead of App Service plan, nothing is displaying under monitor. When I run a test in the Azure console or add a file to the target Blob container, these trigger logs do not display on the monitor screen.

What can be done to ensure that this trigger template is firing when a new file is added to the Blob container?

2
Can you add your template. Because its all working as expected on consumption planVova Bilyachat
Hi crayden, monitor result may be delayed for up to 5 minutes, so you can wait for a moment and refresh it. If still do not show the logs, could you please share some more details of your function(as I test in my side it's ok), and I will help you to fix it.Hury Shen
Hi crayden, may I know if your problem was solved ? If the answers provided by Mohit and me help your problem, could you please mark one of the answers as "accepeted". If your problem hasn't been solved, please share some more details and I will try to help you.Hury Shen

2 Answers

1
votes

You can run Azure Functions in two different modes: Consumption plan and App Service plan. You must choose the type of hosting plan during the creation of the function app. You can’t change it afterward.

Consumption Plan

The consumption plan automatically allocates compute power when your code is running, scales out as necessary to handle load, and then scales down when code is not running. You don’t have to pay for idle VMs and don’t have to reserve capacity in advance. This is the serverless app model. The magic behind a consumption plan is all done via the scale controller. The scale controller automatically scales CPU and memory resources by adding additional function app instances. Scaling is based on the number of events that its functions are triggered on.

App Service Plan

In the App Service plan, your function apps run on dedicated VMs on Basic, Standard, Premium, and Isolated SKUs. You can scale up by choosing a different App Service plan, but the function app is always running. Scaling is done manually or you can enable autoscale.

Because of the difference in nature, App service plans are always available if enabled so it triggered almost immediately. And in Consumption based plan it goes in a idle mode if it is not being used.

Additional reference:

https://stackoverflow.com/a/54094025/6049604

Hope it helps.

1
votes

The explanation provided by Mohit is right, but I want to add some information about it after my testing.

I test it in my side again, when I test it first time, the function was triggered successfully by the blob storage. Second time, I left the function there for a moment and then upload a file to blob storage. It was almost 13 minutes before I saw the log in "Monitor" screen.

I think there are two reasons to cause it, one is mentioned by Mohit, the consumption plan will lead to the function idle for a few moment. As far as I know, if we leave the function there for about 20 minutes, it will fall asleep(not hot start). So when the file was uploaded to blob storage, it needs a few minutes to start. And then the "Monitor" also needs about 5 minutes to show the log in screen.

Because of the two reasons above, I wait about 13 minutes to see the log in "Monitor". So maybe you didn't see the log because it appears too later. For this problem, I think you can choose an app service plan if you don't care about the cost or choose a consumption plan it you don't care the waiting time.(or choose an app service plan which is F1: Free).

Hope it would be helpful to your problem~