Exercise 1: Provisioning Azure Cache for Redis
In the following steps, you will see how to provision your Azure Cache for Redis instance and retrieve the connection keys for the connection.
The code can also be found at https://packt.link/EzRQx.
Note
The commands should be run in Azure Cloud Shell, Bash, or Bash terminal, with the Azure CLI installed locally.
- First, create a resource group:
az group create --location eastus2 --name AzureCache-RG
- To avoid name collisions, generate a unique name for your account:
account=azurecache$RANDOM
- Next, create a Basic SKU instance:
az redis create --location eastus2 --name $account --resource-group AzureCache-RG --sku Basic --vm-size C0
- Finally, retrieve the key and address:
$key=$(az redis list-keys --name $account --resource-group AzureCache-RG --query primaryKey -o tsv)
echo $key
echo $account.redis.cache.windows.net
The list of commands can be found at https://packt.link/RXtfF.
If you ran the previous commands...