| title | Create, query, and delete a Premium Azure Cache for Redis with clustering - Azure CLI |
|---|---|
| description | This Azure CLI code sample shows how to create a 6 GB Premium tier Azure Cache for Redis with clustering enabled and two shards. It then gets details of an Azure Cache for Redis instance, including provisioning status, the hostname, ports, and keys for an Azure Cache for Redis instance. Finally, it deletes the cache. |
| ms.devlang | azurecli |
| ms.topic | sample |
| ms.date | 03/11/2022 |
| ms.custom | devx-track-azurecli |
In this scenario, you learn how to create a 6 GB Premium tier Azure Cache for Redis with clustering enabled and two shards. You then learn to get details of an Azure Cache for Redis instance, including provisioning status, the hostname, ports, and keys for an Azure Cache for Redis instance. Finally, you learn to delete the cache.
[!INCLUDE quickstarts-free-trial-note]
[!INCLUDE azure-cli-prepare-your-environment.md]
[!INCLUDE cli-launch-cloud-shell-sign-in.md]
:::code language="azurecli" source="~/azure_cli_scripts/redis-cache/create-premium-cache-cluster/create-manage-premium-cache-cluster.sh" id="FullScript":::
[!INCLUDE cli-clean-up-resources.md]
az group delete --name $resourceGroup
This script uses the following commands to create a resource group and a Premium tier Azure Cache for Redis with clustering enable. 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. |
| az redis show | Retrieve details of an Azure Cache for Redis instance. |
| az redis list-keys | Retrieve access keys for an Azure Cache for Redis instance. |
| az redis delete | Delete Azure Cache for Redis instance. |
For more information on the Azure CLI, see Azure CLI documentation.
For an Azure Cache for Redis CLI script sample that creates a managed cache, see Azure Managed Redis.