Create an Azure Cache for Redis

In this scenario, you learn how to create an Azure Cache for Redis.

To run this sample, install the latest version of the Azure CLI. To start, run az login to create a connection with Azure.

Samples for the Azure CLI are written for the bash shell. To run this sample in Windows PowerShell or Command Prompt, you may need to change elements of the script.

Sample script

#/bin/bash

# Creates a Resource Group named contosoGroup, and creates a Redis Cache in that group named contosoCache

# Create a Resource Group 
az group create --name contosoGroup --location eastus

# Create a Basic C0 (256 MB) Redis Cache
az redis create --name contosoCache --resource-group contosoGroup --location eastus --sku Basic --vm-size C0

Clean up deployment

After the script sample has been run, the follow command can be used to remove the resource group, Azure Cache for Redis instance, and any related resources in the resource group.

az group delete --name contosoGroup

Script explanation

This script uses the following commands to create a resource group and an Azure Cache for Redis. Each command in the table links to command specific documentation.

Command Notes
az group create Creates a resource group in which all resources are stored.
az redis create Create Azure Cache for Redis instance.

Next steps

For more information on the Azure CLI, see Azure CLI documentation.

Additional Azure Cache for Redis CLI script samples can be found in the Azure Cache for Redis documentation.