Bird
Raised Fist0
Azurecloud~20 mins

Function App creation in Azure - Practice Problems & Coding Challenges

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Challenge - 5 Problems
🎖️
Azure Function App Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Architecture
intermediate
2:00remaining
Choosing the right hosting plan for an Azure Function App

You want to deploy an Azure Function App that must scale automatically based on demand and you want to minimize costs when idle. Which hosting plan should you choose?

AConsumption Plan that scales automatically and charges per execution
BDedicated VM hosting with manual scaling
CPremium Plan with pre-warmed instances and fixed cost
DApp Service Plan with fixed VM size and manual scaling
Attempts:
2 left
💡 Hint

Think about a plan that charges only when your function runs and can scale automatically.

❓ Configuration
intermediate
2:00remaining
Configuring environment variables for an Azure Function App

You want to securely store a database connection string for your Azure Function App. Where should you store this value to follow best practices?

AIn a plain text file uploaded with the function code
BDirectly in the function code as a constant string
CHardcoded in the function.json file
DIn the Application Settings of the Function App in Azure Portal
Attempts:
2 left
💡 Hint

Consider where Azure recommends storing secrets and configuration values for apps.

❓ service_behavior
advanced
2:00remaining
Understanding cold start behavior in Azure Function Apps

You notice your Azure Function App takes longer to respond after being idle for some time. What causes this delay?

AThe function app has a syntax error causing slow execution
BThe function app is experiencing a cold start due to the Consumption Plan scaling down to zero instances
CThe function app is running on a Premium Plan with pre-warmed instances
DThe function app is deployed in a region with high latency
Attempts:
2 left
💡 Hint

Think about what happens when a function app is not running and a new request arrives.

❓ security
advanced
2:00remaining
Securing access to an Azure Function App with HTTP trigger

You want to restrict access to your HTTP-triggered Azure Function App so only authorized clients can call it. Which method provides the best security?

ADisable authentication and rely on HTTPS encryption only
BMake the function public and rely on client IP filtering
CUse Azure Active Directory (AAD) authentication to require user sign-in
DUse function-level authorization keys and share them with clients
Attempts:
2 left
💡 Hint

Consider a method that integrates with identity providers for secure access.

✅ Best Practice
expert
3:00remaining
Optimizing deployment slots for zero downtime in Azure Function Apps

You want to deploy a new version of your Azure Function App without downtime and be able to quickly roll back if needed. What is the best deployment strategy?

AUse deployment slots to deploy to a staging slot, test, then swap with production slot
BDeploy directly to the production slot and restart the app after deployment
CDeploy to a separate Function App and update DNS to point to the new app
DStop the production app, deploy the new version, then start the app
Attempts:
2 left
💡 Hint

Think about how to deploy safely with minimal impact on users.

Practice

(1/5)
1. What is the main purpose of an Azure Function App?
easy
A. To run small pieces of code in the cloud without managing servers
B. To store large amounts of data in the cloud
C. To create virtual machines for hosting websites
D. To manage user identities and access

Solution

  1. Step 1: Understand Azure Function App purpose

    Azure Function Apps are designed to run code triggered by events without needing to manage servers.
  2. Step 2: Compare options

    Options A, B, and D describe other Azure services like virtual machines, storage, and identity management, not Function Apps.
  3. Final Answer:

    To run small pieces of code in the cloud without managing servers -> Option A
  4. Quick Check:

    Function Apps run code serverlessly [OK]
Hint: Function Apps run code without servers [OK]
Common Mistakes:
  • Confusing Function Apps with storage services
  • Thinking Function Apps create virtual machines
  • Mixing up Function Apps with identity services
2. Which Azure CLI command correctly creates a Function App named myfuncapp in resource group mygroup with a storage account mystorage and runtime python?
easy
A. az function create --resource mygroup --name myfuncapp --storage-account mystorage --runtime python
B. az functionapp new --group mygroup --app-name myfuncapp --storage mystorage --runtime python
C. az create functionapp --resource-group mygroup --name myfuncapp --storage mystorage --runtime python
D. az functionapp create --resource-group mygroup --name myfuncapp --storage-account mystorage --runtime python

Solution

  1. Step 1: Identify correct Azure CLI syntax

    The correct command to create a Function App is az functionapp create with parameters --resource-group, --name, --storage-account, and --runtime.
  2. Step 2: Compare options

    az functionapp create --resource-group mygroup --name myfuncapp --storage-account mystorage --runtime python matches the correct syntax. Options B, C, and D use incorrect commands or parameter names.
  3. Final Answer:

    az functionapp create --resource-group mygroup --name myfuncapp --storage-account mystorage --runtime python -> Option D
  4. Quick Check:

    Use az functionapp create with correct flags [OK]
Hint: Use 'az functionapp create' with correct flags [OK]
Common Mistakes:
  • Using wrong command like 'az functionapp new'
  • Mixing parameter names like '--group' instead of '--resource-group'
  • Omitting required parameters
3. What will happen if you run this Azure CLI command?
az functionapp create --resource-group mygroup --name myfuncapp --storage-account mystorage --runtime node --runtime-version 14
medium
A. Fails because --runtime-version is not a valid parameter
B. Creates a Function App named myfuncapp with Node.js runtime version 14
C. Creates a Function App but ignores the runtime version
D. Creates a Function App with default runtime version

Solution

  1. Step 1: Understand parameters in the command

    The command uses --runtime node and specifies --runtime-version 14, which is valid to set Node.js version 14.
  2. Step 2: Check Azure CLI behavior

    Azure CLI supports --runtime-version to specify the runtime version, so the Function App will be created with Node.js 14.
  3. Final Answer:

    Creates a Function App named myfuncapp with Node.js runtime version 14 -> Option B
  4. Quick Check:

    Runtime and version flags create correct environment [OK]
Hint: Use --runtime and --runtime-version to specify environment [OK]
Common Mistakes:
  • Thinking --runtime-version is invalid
  • Assuming runtime version is ignored
  • Confusing runtime with storage account
4. You tried to create a Function App with this command:
az functionapp create --resource-group mygroup --name myfuncapp --storage mystorage --runtime python

But it failed. What is the most likely cause?
medium
A. The parameter --storage is incorrect; it should be --storage-account
B. The runtime python is not supported
C. Resource group mygroup does not exist
D. Function App name myfuncapp is invalid

Solution

  1. Step 1: Check command parameters

    The parameter for storage account must be --storage-account, not --storage.
  2. Step 2: Validate other options

    Python runtime is supported, resource group existence is not confirmed but the error is about parameter, and the name looks valid.
  3. Final Answer:

    The parameter --storage is incorrect; it should be --storage-account -> Option A
  4. Quick Check:

    Use correct parameter names in CLI commands [OK]
Hint: Use --storage-account, not --storage [OK]
Common Mistakes:
  • Using wrong parameter names
  • Assuming runtime unsupported without checking
  • Ignoring error messages about parameters
5. You want to create a Function App that runs Python code triggered every hour. Which two Azure services must you configure together to achieve this?
hard
A. Function App and Azure SQL Database
B. Function App and Azure Blob Storage
C. Function App and Timer Trigger
D. Function App and Azure Virtual Machine

Solution

  1. Step 1: Identify the trigger for scheduled execution

    Azure Function Apps use triggers to start code. For hourly runs, a Timer Trigger is used.
  2. Step 2: Understand service roles

    Blob Storage, Virtual Machines, and SQL Database are not used to schedule function runs but serve other purposes.
  3. Final Answer:

    Function App and Timer Trigger -> Option C
  4. Quick Check:

    Timer Trigger schedules Function App runs [OK]
Hint: Use Timer Trigger for scheduled Function Apps [OK]
Common Mistakes:
  • Confusing storage or database with scheduling
  • Thinking VM is needed for Function Apps
  • Ignoring triggers in Function Apps