Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Task 03 - Add support for Azure Cache for Redis (30 minutes)

Introduction

The Munson’s Pickles and Preserves development team has learned a considerable amount from you. They are running into one more problem they would like your assistance with. At certain points of the day, users overwhelm the Team Messaging System, causing performance issues at critical points in the day. They would like your assistance in deploying a caching tier to reduce some of the load on their databases. They would like to make this deployment in a way that supports their new infrastructure as code mode of operation. Their developers will handle making code changes to support this new caching layer.

The actual Team Messaging System that we have used in this demo operates on a built-in memory cache on the web server. For that reason, this task is more in line with a standard database-driven web application than the one you have worked with so far.

Description

In this task, you will update the infrastructure as code Bicep script and create an instance of Azure Cache for Redis for the Team Messaging System web application.

  1. Create an Issue and a feature branch associated with your infrastructure as code changes.
  2. Use GitHub Copilot to add support for the Basic SKU (C0) of Azure Cache for Redis.
  3. Check in your changes and have GitHub Copilot assist on creating the commit message.
  4. Create a pull request to the main branch, using GitHub Copilot Enterprise to create a pull request summary. Have another team member review and approve your code before you merge the code into the main branch.
  5. Ensure that the deployment completes (including a manual execution of the Azure Bicep workflow) and review your resource group in the Azure Portal to ensure that Azure Cache for Redis exists.

Success Criteria

  • In GitHub, you should see a successful execution of the Azure Bicep GitHub Actions workflow.
  • In the Azure Portal, you should see your Azure Cache for Redis instance.

Learning Resources

Tips

  • If you receive an error message like the following:

    The subscription is not registered to use namespace ‘Microsoft.Cache’. See https://aka.ms/rps-not-found for how to register subscriptions.

    Be sure to enable the Microsoft.Cache namespace in the Azure Portal.

Solution

Expand this section to view the solution

This is an abbreviated solution. Read the Description section above for all of the steps to perform. This solution will not include tasks that you have performed already, such as creating GitHub Issues, commit messages, or pull requests.

  • The final Bicep script is in the solution folder. Before looking at this script, try to use GitHub Copilot to generate the changes to your existing /src/InfrastructureAsCode/main.bicep file. You may wish to use a prompt such as “Please add in a Basic C0 instance of Azure Cache for Redis.” Then, you may wish to compare what GitHub Copilot generated.