You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Create, query, and delete an Azure Redis cache - Azure CLI
3
-
description: This Azure CLI code sample shows how to create an Azure Managed Redis instance using the command az redisenterprise create. It then gets details of an Azure Managed Redis instance, including provisioning status, the hostname, ports, and keys for an Azure Redis instance. Finally, it deletes the cache.
2
+
title: Create, query, and delete a cache using Azure CLI
3
+
description: These Azure CLI code samples show how to create an Azure Managed Redis or Azure Cache for Redis instance, get cache details like status, hostname, ports, and keys, and delete the cache.
4
4
5
5
6
6
ms.devlang: azurecli
7
7
ms.topic: sample
8
-
ms.date: 03/11/2022
8
+
ms.date: 05/05/2025
9
9
zone_pivot_groups: redis-type
10
10
ms.custom: devx-track-azurecli, ignite-2024
11
11
appliesto:
@@ -15,41 +15,50 @@ appliesto:
15
15
16
16
# Create an Azure Redis cache using the Azure CLI
17
17
18
-
In this scenario, you learn how to create an Azure Redis cache instance. You then learn to get details of the cache, including provisioning status, the hostname, ports, and keys for the cache. Finally, you learn to delete the cache.
18
+
This article describes how how to create or delete an Azure Redis cache instance by using the Azure CLI. The article also shows how to use the CLI to get cache details including provisioning status, hostname, ports, and keys.
The following script deletes an Azure Managed Redis cache, and then deletes the resource group that contains all cache resources.
101
109
102
110
```azurecli
103
-
az group delete --resource-group $resourceGroup
104
-
```
105
-
106
-
## Sample reference
111
+
# Delete a redis cache
112
+
echo "Deleting $cache"
113
+
az redisenterprise delete --name "$cache" --resource-group $resourceGroup -y
107
114
108
-
This script uses the following commands to create a resource group and an Azure Managed Redis. Each command in the table links to command specific documentation.
115
+
# echo "Deleting all resources"
116
+
az group delete --resource-group $resourceGroup -y
109
117
110
-
| Command | Notes |
111
-
|---|---|
112
-
|[az group create](/cli/azure/group)| Creates a resource group in which all resources are stored. |
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.
188
-
189
-
| Command | Notes |
190
-
|---|---|
191
-
|[az group create](/cli/azure/group)| Creates a resource group in which all resources are stored. |
For more information on the Azure CLI, see [Azure CLI documentation](/cli/azure).
194
+
## Related content
202
195
203
-
For an Azure Managed Redis CLI script sample that creates a Azure Managed Redis with clustering, see [Azure Managed Redis with Clustering](../../azure-cache-for-redis/scripts/create-manage-premium-cache-cluster.md)
196
+
- For more information about the Azure CLI, see the [Azure CLI documentation](/cli/azure).
197
+
- For an Azure Managed Redis CLI script sample that creates an Azure Managed Redis cache with clustering, see [Azure Managed Redis with clustering](../../azure-cache-for-redis/scripts/create-manage-premium-cache-cluster.md).
0 commit comments