Skip to content

Latest commit

 

History

History
55 lines (39 loc) · 5.13 KB

Challenge-04.md

File metadata and controls

55 lines (39 loc) · 5.13 KB

Challenge 04 - Creating A Deployment Environment

< Previous Challenge - Home - Next Challenge >

Introduction

With the application updated, the shelter is ready to begin configuring deployment! They have elected to use Azure to host the application. The website will be hosted on Azure Container Apps, and the database on Azure Cosmos DB for MongoDB. The first step of the process will be creating and configuring the environment on Azure. In a later challenge you'll configure continuous deployment for the project.

Description

For this challenge, you will create a GitHub workflow which uses an Azure Bicep file to configure the necessary resources on Azure. You will create a resource group to house the Azure resources, configure a service identity to grant permissions to the Action, and run the Action to create the resources.

Configuration as Code (CaC), or config as code, is an approach to managing system configuration which involves defining configuration settings in machine-readable files or scripts. This allows for more efficient, automated, and consistent management of system configuration, as changes can be made and deployed more easily and with greater control. With config as code, configuration settings are stored in version-controlled files, often using a declarative syntax such as YAML, JSON, or HCL. These files can be stored alongside application code, making it easier to manage the entire software development life cycle.

This challenge uses Azure Bicep, which is a domain specific language for defining Azure infrastructure. A Bicep file has already been created for you to use and will be provided by your coach. The Bicep file will:

  • create a serverless instance of Azure Cosmos DB for MongoDB.
  • create the resources to support an Azure Container App.
  • create the Azure Container App with a default image.
  • configure the Azure Container App with the connection string for the Azure Cosmos DB for MongoDB database.

The Bicep file accepts one parameter named prefixName, which is to be set to 5 random alphanumeric characters. This will ensure all resources created have a unique name.

As you go through the challenge, you will need to utilize the following pieces of information, and store them in the repository as appropriate:

Name Description
location Use westus for the location/region of the resource group
prefixName 5 characters alphanumeric characters you will create
AZURE_CREDENTIALS The credentials to use for managing Azure resources in the workflow
AZURE_SUBSCRIPTION The ID of your Azure subscription
AZURE_RG The name of the Azure resource group you create
AZURE_PREFIX The prefix you created earlier

Success Criteria

  • Demonstrate that you created the resource group on Azure for the cloud resources for the application
  • Demonstrate that you properly stored the values necessary for the workflow in the repository, encrypting the values which are sensitive
  • Demonstrate that you created a new GitHub workflow named create-azure-resources.yml with the following options:
    • Workflow can be run manually
    • Reads the prefix and other parameters from secrets and variables
  • Demonstrate that navigating to the URL for the Azure Container App displays a screen with the message Welcome to Azure Container Apps

IMPORTANT: The default image configured in the Bicep file has the appropriate message configured. No code needs to be updated in the application. You will deploy the application in a later challenge.

Learning Resources