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
Copy file name to clipboardExpand all lines: articles/redis/scripts/create-manage-cache.md
+40-21Lines changed: 40 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,18 +5,25 @@ description: Use the Azure CLI to create an Azure Redis instance, get cache deta
5
5
6
6
ms.devlang: azurecli
7
7
ms.topic: sample
8
-
ms.date: 05/05/2025
8
+
ms.date: 05/06/2025
9
9
zone_pivot_groups: redis-type
10
10
ms.custom: devx-track-azurecli, ignite-2024
11
11
appliesto:
12
12
- ✅ Azure Managed Redis
13
13
- ✅ Azure Cache for Redis
14
14
---
15
15
16
-
# Create an Azure Redis cache using the Azure CLI
16
+
# Manage an Azure Redis cache using the Azure CLI
17
17
18
18
This article describes how to create or delete an Azure Redis cache instance by using the Azure CLI. The article also shows how to use the Azure CLI to get cache details including provisioning status, hostname, ports, and keys.
19
19
20
+
>[!NOTE]
21
+
>Azure Cache for Redis Basic, Standard, and Premium tiers use the Azure CLI [az redis](/cli/azure/redis) commands. To manage Azure Cache for Redis Basic, Standard, or Premium instances, select the **Azure Cache for Redis** option at the top of this article and use the `az redis` commands.
22
+
>
23
+
>Azure Cache for Redis Enterprise tiers and Azure Managed Redis use the [az redisenterprise](/cli/azure/redisenterprise) commands. The commands are part of the `redisenterprise` extension for Azure CLI version 2.61.0 or higher, which automatically installs the first time you run an `az redisenterprise` command.
24
+
>
25
+
>To manage Azure Cache for Redis Enterprise or Azure Managed Redis instances, select the **Azure Managed Redis** option at the top of this article and use the `az redisenterprise` commands.
This sample is broken. When it is fixed, we can fix this include.
31
38
-->
32
-
The cache `name` must be a string of 1-63 characters that's unique in the [Azure region](https://azure.microsoft.com/regions/). The name can contain only numbers, letters, and hyphens, must start and end with a number or letter, and can't contain consecutive hyphens.
33
-
34
-
The `location` should be an Azure region near other services that use your cache. Use a [sku](https://azure.microsoft.com/pricing/details/cache/) and `size` that have the appropriate features and performance for your cache.
35
-
36
-
Microsoft Entra authentication is enabled by default for new caches, and access keys authentication is disabled. You can enable access key authentication during or after cache creation, but for security and ease of use, Microsoft Entra authentication is recommended.
39
+
Microsoft Entra authentication is enabled by default for new caches, and access keys authentication is disabled. You can enable access key authentication during or after cache creation, but Microsoft Entra authentication is recommended for better security.
37
40
38
41
>[!IMPORTANT]
39
42
>Use Microsoft Entra ID with managed identities to authorize requests against your cache if possible. Authorization using Microsoft Entra ID and managed identity provides better security and is easier to use than shared access key authorization. For more information about using managed identities with your cache, see [Use Microsoft Entra ID for cache authentication](../../azure-cache-for-redis/cache-azure-active-directory-for-authentication.md).
40
43
41
44
Transport Layer Security (TLS) 1.2-1.3 encryption is enabled by default for new caches. You can enable the non-TLS port and connections during or after cache creation, but for security reasons, disabling TLS isn't recommended.
42
45
46
+
The cache `name` must be a string of 1-63 characters that's unique in the [Azure region](https://azure.microsoft.com/regions/). The name can contain only numbers, letters, and hyphens, must start and end with a number or letter, and can't contain consecutive hyphens.
47
+
48
+
The `location` should be an Azure region near other services that use your cache. Choose a [sku](https://azure.microsoft.com/pricing/details/cache/) that has the appropriate features and performance for your cache.
49
+
43
50
::: zone pivot="azure-managed-redis"
44
51
52
+
You can use the following Azure CLI script to create an Azure Managed Redis or Azure Cache for Redis Enterprise cache. You can also use the following methods to create a cache:
>You can enable or configure the following settings only at Azure Managed Redis cache creation time. Gather the information you need to configure these settings before you begin, and make sure to configure them correctly during cache creation.
47
-
>- You must enable modules at the time you create the cache instance. You can't change modules or enable module configuration after you create a cache.
48
-
>- Azure Managed Redis supports two clustering policies: Enterprise or OSS. You can't change the clustering policy after you create the cache.
61
+
>You can enable or configure the following settings only at cache creation time. Gather the information you need to configure these settings in advance, and make sure to configure them correctly during cache creation.
62
+
>- You can enable modules only at the time you create the cache. You can't change modules or enable module configuration after you create a cache.
63
+
>- Azure Managed Redis and Azure Cache for Redis Enterprise tiers support two clustering policies: Enterprise or OSS. You can't change the clustering policy after you create the cache.
49
64
>- If you're using the cache in a geo-replication group, you can't change eviction policies after the cache is created.
50
65
>- The [RediSearch](../redis-modules.md#redisearch) module requires the Enterprise cluster policy and No Eviction eviction policy.
51
66
52
-
The following script uses the [az group create](/cli/azure/group) and [az redisenterprise create](/cli/azure/redisenterprise#az-redisenterprise-create) commands to create a resource group and create an Azure Managed Redis Balanced B1 cache in the resource group.
53
-
54
-
>[!NOTE]
55
-
>The [az redisenterprise](/cli/azure/redisenterprise) commands are part of the `redisenterprise` extension for the Azure CLI, version 2.61.0 or higher. The extension automatically installs the first time you run an `az redisenterprise` command.
67
+
This script sets variables, and then uses the [az group create](/cli/azure/group) and [az redisenterprise create](/cli/azure/redisenterprise#az-redisenterprise-create) commands to create a resource group with an Azure Managed Redis Balanced B1 cache in it.
The following script uses the [az redisenterprise show](/cli/azure/redisenterprise#az-redisenterprise-show) and [az redisenterprise list-keys](/cli/azure/redisenterprise#az-redisenterprise-list-keys) commands to get and display cache name, hostname, ports, and keys details.
90
+
The following script uses the [az redisenterprise show](/cli/azure/redisenterprise#az-redisenterprise-show) and [az redisenterprise list-keys](/cli/azure/redisenterprise#az-redisenterprise-list-keys) commands to get and display the name, hostname, ports, and keys details for the preceding cache.
The following script uses the [az group delete](/cli/azure/group) and [az redisenterprise delete](/cli/azure/redisenterprise#az-redisenterprise-delete) commands to delete a cache, and then delete the resource group that contains all cache resources.
115
+
The following script uses the [az group delete](/cli/azure/group) and [az redisenterprise delete](/cli/azure/redisenterprise#az-redisenterprise-delete) commands to delete the preceding cache, and then delete its resource group.
104
116
105
117
```azurecli
106
118
# Delete a redis cache
@@ -115,7 +127,15 @@ az group delete --resource-group $resourceGroup -y
115
127
116
128
::: zone pivot="azure-cache-redis"
117
129
118
-
The following script uses the [az group create](/cli/azure/group) and [az redis create](/cli/azure/redis#az-redis-create) commands to create a resource group and create an Azure Cache for Redis Basic C0 cache in the resource group.
130
+
You can use the following Azure CLI script to create an Azure Cache for Redis Basic, Standard, or Premium-tier cache. To create an Enterprise-tier cache, use the [Azure Managed Redis](create-managed-cache.md?pivots=azure-managed-redis) script. You can also use the following methods to create a cache:
131
+
132
+
-[Azure portal (Basic, Standard, or Premium)](../../azure-cache-for-redis/quickstart-create-redis.md)
The following script uses the [az group create](/cli/azure/group) and [az redis create](/cli/azure/redis#az-redis-create) commands to create a resource group with an Azure Cache for Redis Basic C0 cache in it.
The following script uses the [az redis show](/cli/azure/redis#az-redis-show) and [az redis list-keys](/cli/azure/redis#az-redis-list-keys) commands to get and display name, hostname, ports, and keys details.
162
+
The following script uses the [az redis show](/cli/azure/redis#az-redis-show) and [az redis list-keys](/cli/azure/redis#az-redis-list-keys) commands to get and display the name, hostname, ports, and keys details for the preceding cache.
The following script uses the [az group delete](/cli/azure/group) and [az redis delete](/cli/azure/redis#az-redis-delete) commands to delete a cache, and then delete the resource group that contains all cache resources.
187
+
The following script uses the [az group delete](/cli/azure/group) and [az redis delete](/cli/azure/redis#az-redis-delete) commands to delete the preceding cache, and then delete its resource group.
az group delete --resource-group $resourceGroup -y
176
-
177
196
```
178
197
179
198
::: zone-end
180
199
181
200
## Related content
182
201
183
202
- For more information about the Azure CLI, see the [Azure CLI documentation](/cli/azure).
184
-
- 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).
203
+
- For an Azure CLI script sample that creates an Azure Cache for Redis Premium cache with clustering, see [Create a Premium Azure Cache for Redis with clustering](../../azure-cache-for-redis/scripts/create-manage-premium-cache-cluster.md).
0 commit comments