Challenge 03 - Run the app on Azure
< Previous Challenge - Home - Next Challenge >
Introduction
In a previous challenge, we updated the app to use an Azure SQL Database, but the app is still running locally. Now with this challenge you will provision an Azure Web App for Containers to host your Rock Paper Scissors Boom app.
Description
Note: You should use an Infrastructure as Code language (Azure CLI, Bicep, Terraform, etc) to provision your Azure services. You could also use the Azure Portal to provision your Azure services, but it’s not recommended.
- Provision an Azure Container Registry (ACR) to push your container in it.
- Push your local Docker image to your ACR.
- Provision an Azure Web App Service for Containers & deploy the app in your Azure Web App Service for Containers by pulling the Docker image from your ACR previously created, test it as an end-user, and play a game once deployed there.
Success Criteria
To complete this challenge successfully, you should be able to:
- Validate that you can create an Azure Container Registry (ACR)
- Validate that you can push your local Docker image to the ACR
- Validate that you can deploy the app in an Azure Web App for Containers.
- In your web browser, navigate to the app and play a game, make sure it’s working without any error.
Learning Resources
Tips
- You can either provision a managed identity & grant it RBAC access to the ACR or use the ACR admin credentials to pull the Docker image from the ACR into App Service.
- Using a managed identity is the recommended approach in production, but is more complex to set up initially (since you must have Owner access to your Resource Group)
- Use the ACR admin account &
DOCKER_REGISTRY_SERVER_*
environment variables to pull the Docker image from the ACR into App Service.
- Set environment variables in App Service to configure the app to connect to the Azure SQL Database (similar to what you did in the
docker-compose.yaml
file). Values you set in the App Service Configuration section will override the values from the appsettings.json
file.
- You may have to enable Azure services to communicate with your Azure SQL database