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
Container Apps for microservices
📖 Scenario: You are building a simple microservices architecture using Azure Container Apps. Each microservice will run in its own container and communicate internally. This setup helps your app scale easily and stay reliable.
🎯 Goal: Create an Azure Container Apps environment, define two container apps representing microservices, and configure them to communicate internally.
📋 What You'll Learn
Create an Azure Container Apps environment named microservices-env
Create a container app named frontend-app with image mcr.microsoft.com/azuredocs/containerapps-helloworld:latest
Create a container app named backend-app with image mcr.microsoft.com/azuredocs/containerapps-helloworld:latest
Configure frontend-app to call backend-app internally using the internal FQDN
Set CPU to 0.5 and memory to 1Gi for both container apps
💡 Why This Matters
🌍 Real World
Microservices architectures are common in cloud applications to improve scalability and maintainability. Azure Container Apps provide a simple way to deploy and manage these microservices.
💼 Career
Cloud engineers and developers use container apps to deploy microservices efficiently. Knowing how to configure environments, container apps, and internal communication is essential for modern cloud infrastructure roles.
Progress0 / 4 steps
1
Create the Container Apps environment
Create an Azure Container Apps environment named microservices-env in resource group myResourceGroup in location eastus. Use the Azure CLI command az containerapp env create with the exact parameters.
Azure
Hint
Use az containerapp env create with --name, --resource-group, and --location options.
2
Create the frontend container app
Create a container app named frontend-app in resource group myResourceGroup inside environment microservices-env. Use image mcr.microsoft.com/azuredocs/containerapps-helloworld:latest. Set CPU to 0.5 and memory to 1Gi. Use the Azure CLI command az containerapp create with the exact parameters.
Azure
Hint
Use az containerapp create with --name frontend-app, --environment microservices-env, and resource group.
3
Create the backend container app
Create a container app named backend-app in resource group myResourceGroup inside environment microservices-env. Use image mcr.microsoft.com/azuredocs/containerapps-helloworld:latest. Set CPU to 0.5 and memory to 1Gi. Use the Azure CLI command az containerapp create with the exact parameters.
Azure
Hint
Use az containerapp create with --name backend-app, --environment microservices-env, and resource group.
4
Configure frontend to call backend internally
Update the frontend-app container app to set an environment variable named BACKEND_URL with the internal FQDN of backend-app. Use the Azure CLI command az containerapp update with the exact parameters. The internal FQDN format is http://backend-app.microservices-env.
Azure
Hint
Use az containerapp update with --set-env-vars BACKEND_URL=http://backend-app.microservices-env.
Practice
(1/5)
1. What is the main benefit of using Azure Container Apps for microservices?
easy
A. They let you run small parts of an app separately and scale them easily.
B. They require you to manage all the servers manually.
C. They combine all app parts into one big container.
D. They only work for apps without any updates.
Solution
Step 1: Understand microservices in Azure Container Apps
Azure Container Apps allow running small, separate parts of an app independently.
Step 2: Identify the benefit of scaling and updating
This setup lets you scale and update parts without affecting the whole app, and Azure manages the servers.
Final Answer:
They let you run small parts of an app separately and scale them easily. -> Option A
Quick Check:
Microservices = separate, scalable parts [OK]
Hint: Microservices run small parts separately for easy scaling [OK]
Common Mistakes:
Thinking you must manage servers yourself
Believing all parts run in one container
Assuming no updates are possible
2. Which of the following is the correct way to define a container app in Azure CLI?
easy
A. az container create --name myapp --resource-group mygroup --image myimage:latest
B. az containerapp deploy --name myapp --resource-group mygroup --image myimage:latest
C. az appcontainer create --name myapp --resource-group mygroup --image myimage:latest
D. az containerapp create --name myapp --resource-group mygroup --image myimage:latest
Solution
Step 1: Identify the correct Azure CLI command for Container Apps
The correct command to create a container app is az containerapp create.
Step 2: Check the command syntax
The command includes the app name, resource group, and image, matching az containerapp create --name myapp --resource-group mygroup --image myimage:latest exactly.
Final Answer:
az containerapp create --name myapp --resource-group mygroup --image myimage:latest -> Option D
Quick Check:
Container Apps use 'az containerapp create' [OK]
Hint: Use 'az containerapp create' to define container apps [OK]
Common Mistakes:
Using 'az container create' which is for regular containers
What resource limits are set for this container app?
medium
A. 0.5 CPU cores and 1.0 GB memory
B. 1 CPU core and 0.5 GB memory
C. 0.5 CPU cores and 0.5 GB memory
D. 1 CPU core and 1.0 GB memory
Solution
Step 1: Read the CPU and memory flags in the command
The command sets --cpu 0.5 and --memory 1.0.
Step 2: Interpret the values
CPU is 0.5 cores, memory is 1.0 GB as per the flags.
Final Answer:
0.5 CPU cores and 1.0 GB memory -> Option A
Quick Check:
CPU=0.5, Memory=1.0 GB [OK]
Hint: Match --cpu and --memory values exactly [OK]
Common Mistakes:
Swapping CPU and memory values
Assuming units are in MB instead of GB
Ignoring the flags and guessing defaults
4. You tried to deploy a container app with this command:
az containerapp create --name paymentapp --resource-group payrg --image pay/image:latest --cpu two --memory 1.5
What is the likely problem?
medium
A. The memory value 1.5 is too low; it must be at least 2 GB.
B. The CPU value 'two' is invalid; it should be a number like 2 or 0.5.
C. The image tag 'latest' is not allowed in Azure Container Apps.
D. The resource group name 'payrg' is invalid.
Solution
Step 1: Check the CPU parameter format
The CPU value must be a number (like 0.5 or 2), not a word.
Step 2: Identify the error in the command
Using 'two' instead of a numeric value causes a syntax error.
Final Answer:
The CPU value 'two' is invalid; it should be a number like 2 or 0.5. -> Option B
Quick Check:
CPU must be numeric [OK]
Hint: CPU must be a number, not a word [OK]
Common Mistakes:
Using words instead of numbers for CPU
Assuming 'latest' tag is invalid
Thinking resource group name is the problem
5. You want to deploy a microservice architecture using Azure Container Apps with three services: frontend, backend, and database. You want each to scale independently and update without downtime. Which approach is best?
hard
A. Deploy only the frontend as a container app and run backend and database on VMs.
B. Combine all services into one container app to simplify management.
C. Deploy each service as a separate container app with its own scaling rules.
D. Use Azure Container Instances for all services instead of Container Apps.
Solution
Step 1: Understand microservice deployment goals
Each service should scale independently and update without downtime.
Step 2: Evaluate deployment options
Deploying each service as a separate container app allows independent scaling and updates.