Hello Mahmoud Mahajna,
Greetings! Thanks for raising this question in the Q&A forum.
What you are describing matches a known gap in Flex Consumption between a successful deployment and the trigger metadata actually being synced to the external Scale Controller. The Scale Controller that wakes your app from zero for non HTTP triggers (queue, Service Bus, Event Hubs, Cosmos) does not read your code directly. It relies on a separate sync step that registers each trigger's binding metadata with the platform after deployment. When that sync does not happen cleanly, the host itself starts up fine, Cosmos and Durable and timer triggers keep working because some of those paths use different scaling signals, but the Scale Controller has no record of the queue trigger and never polls it. Pinning the function with always ready forces an instance to stay warm, and once warm the in-process WebJobs SDK listener takes over and polls the queue directly, which is exactly why pinning "fixes" it without any code change. This has been seen with other Flex Consumption deployment paths as well, not just yours, so it is not something specific to your binding or connection string configuration.
- Confirm this is a trigger sync issue rather than a code issue Since pinning already proves your code, connection string, and permissions are correct, you can treat this purely as a deployment and platform sync problem rather than re-checking the function itself. Force a remote build instead of relying only on isFlexConsumption in the pipeline task Flex Consumption strictly needs a server side (Kudu/SCM) build so the platform can correctly extract and sync trigger metadata as part of deployment. With
dotnet publish then zip then AzureFunctionApp@2, confirm the task is actually performing a One Deploy remote build and not just uploading a prebuilt zip as a package reference. Explicitly set the app setting below so the SCM site performs the build and sync step server side:
- task: AzureFunctionApp@2
inputs:
azureSubscription: '<your-service-connection>'
appType: 'functionAppLinux'
appName: '<your-function-app>'
package: '$(Build.ArtifactStagingDirectory)/**/*.zip'
isFlexConsumption: true
deploymentMethod: 'zipDeploy'
And on the function app itself, confirm SCM_DO_BUILD_DURING_DEPLOYMENT is not set to false, since that would skip the remote build path that performs trigger registration.
Add an explicit SyncTriggers call right after the deploy step
Even with a correct remote build, add a pipeline step that explicitly forces a trigger sync after deployment so the Scale Controller is guaranteed to have current metadata:
az rest --method post \
--url "https://management.azure.com/subscriptions/<subId>/resourceGroups/<rg>/providers/Microsoft.Web/sites/<appName>/syncfunctiontriggers?api-version=2023-12-01"
Verify trigger registration after deploy using Kudu
After a deployment, browse to https://<appName>.scm.azurewebsites.net/api/functions and confirm the queue triggered function is listed with its binding type and connection details populated. If it is missing or shows an empty bindings array right after a deploy that later fails to scale, that confirms the sync did not complete, and a manual call to step 3 should immediately restore scale from zero without needing to pin.
Watch for the regression returning after each deployment
Since you noted the issue tends to come back after a new deploy, build the SyncTriggers call into the pipeline permanently as in step 3 rather than only running it manually, until this is resolved at the platform level.
Escalate to Azure Support with a deployment timestamp and resource ID
This is a confirmed pattern affecting non HTTP triggers specifically in Flex Consumption after One Deploy, so if the explicit SyncTriggers workaround does not fully and permanently resolve it for you, open a support case referencing trigger sync failures between One Deploy and the Scale Controller, and include a deployment timestamp plus your function app resource ID so the team can correlate it against the Scale Controller logs on their side.
For reference on scaling behavior and per-function scaling groups in Flex Consumption, see:
https://learn.microsoft.com/en-us/azure/azure-functions/event-driven-scaling
https://learn.microsoft.com/en-us/azure/azure-functions/flex-consumption-plan
If this answer helps you kindly accept the answer which will help others who have similar questions.
Best Regards,
Jerald Felix.