A function app works locally with settings in local.settings.json. After deployment to a Flex Consumption plan, it fails because those settings are missing. What should you do?
- Exam domain
- Connect to and consume Azure services20–25% of the exam
- Difficulty
- Medium
- In this mock
- 13 questions on this domainPractise this domain
Why the exam asks this
Connect to and consume Azure services: Develop and implement Azure Functions.
Objective in the exam guide: Configure and deploy function apps.
"Works on my machine" failures after deployment are common with Functions. The exam checks you know where settings live.
Why D is the answer
Add the settings as application settings on the function app in Azure
local.settings.json is only for local development and is not deployed. In Azure, settings come from the function app's application settings.
Remember: Local settings stay local; Azure needs app settings.
How it works
local.settings.json holds settings for local runs with Core Tools and is not published.
In Azure, application settings provide configuration and connection details to the function app as environment variables.
Flex Consumption deploys a ready-to-run package to a storage container and runs from it; tools such as Core Tools, VS Code and the Azure CLI pick the right deployment method.
Clues in the question
The words that point to the answer, and what each one tells you.
- Works locally
- Local settings file.
- Settings missing after deployment
- App settings not configured.
In detail
- Flex Consumption uses package deployment and runs from the package by default; do not set WEBSITE_RUN_FROM_PACKAGE.
- Secrets in app settings can be Key Vault references.
Side by side with look-alikes
| Where | Used by |
|---|---|
| local.settings.json | Local runs only |
| Function app application settings | The app in Azure |
| Key Vault reference in a setting | Secrets in Azure |
Every option, checked
Knowing why each wrong option fails is how you rule it out on exam day.
A. Include local.settings.json in the deployment packageWrongMost tempting
The file is excluded from publishing by design.
Why it tempts: It would carry the settings across. But the file is excluded on purpose because it often holds secrets, and the platform does not read it.
B. Set WEBSITE_RUN_FROM_PACKAGE to 1Wrong
That setting is not used on Flex Consumption, and it does not supply settings.
C. Redeploy with a larger instance memory sizeWrong
Memory does not create missing settings.
D. Add the settings as application settings on the function app in AzureRight
Local settings stay local; Azure needs app settings.
In practice
- Define app settings in Bicep or ARM with the app, so every environment gets them.
Use case
An illustrative scenario, not a real incident.
A team adds the Cosmos DB endpoint and queue name as app settings, and the deployed function starts working.
See how it works
flowchart LR L["Local run"] --> F1["local.settings.json"] D["Deploy package"] --> A["Function app in Azure"] A --> S["Application settings"] S --> K["Key Vault references for secrets"]
How to read this chart
- Read it in order: Local run, then local.settings.json.