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
+27-69Lines changed: 27 additions & 69 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,67 +17,42 @@ appliesto:
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
-
The scripts in this article use the following commands. Select the links in the table to access command documentation.
21
-
22
-
::: zone pivot="azure-managed-redis"
23
-
24
-
>[!NOTE]
25
-
>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.
26
-
27
-
| Command | Description |
28
-
|---|---|
29
-
|[az group create](/cli/azure/group)| Creates a resource group to store all resources in. |
- Make sure you're signed in to Azure with the subscription you want to create your cache under. To use a different subscription than the one you're signed in with, run `az account set -s <subscriptionId>`, replacing `<subscriptionId>` with the subscription ID you want to use.
This sample is broken. When it is fixed, we can fix this include.
61
31
-->
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.
62
35
63
-
The cache `name` must be a string of 1-63 characters that's unique in the region. The name can contain only numbers, letters, and hyphens, must start and end with a number or letter, and can't contain consecutive hyphens.
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.
64
37
65
-
The `location` should be an [Azure region](https://azure.microsoft.com/regions/) near other services that use your cache. Use a cache [sku](https://azure.microsoft.com/pricing/details/cache/) and `size` that have the appropriate features and performance for your cache.
38
+
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.
39
+
40
+
>[!IMPORTANT]
41
+
>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).
42
+
43
+
::: zone pivot="azure-managed-redis"
66
44
67
45
>[!IMPORTANT]
68
-
>The following settings can be enabled or configured only at cache creation time. Gather the information you need to configure these settings before you create your cache.
69
-
>
46
+
>The following settings can be enabled or configured only at cache creation time. Gather the information you need to configure these settings and make sure to configure them correctly during cache creation.
70
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.
71
48
>- Managed Redis supports two clustering policies: Enterprise or OSS. You can't change the clustering policy after you create the cache.
72
49
>- If you're using the cache in a geo-replication group, you can't change eviction policies after the cache is created.
73
-
>-If you're using the [RediSearch](../redis-modules.md#redisearch) module, the Enterprise cluster policy is required, and No Eviction is the only eviction policy supported.
50
+
>-The [RediSearch](../redis-modules.md#redisearch) module requires the Enterprise cluster policy and No Eviction eviction policy.
74
51
75
-
For security reasons, Microsoft Entra authentication and Transport Layer Security (TLS) encryption are enabled by default for new caches. Access keys authentication is disabled. You can choose to to enable access key authentication or non-TLS connections during or after cache creation.
52
+
The following script sets variables, 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 and create a Balanced B1 Azure Managed Redis cache in the resource group.
76
53
77
-
>[!IMPORTANT]
78
-
>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).
79
-
80
-
The following example script sets variables, then creates a resource group and an Azure Managed Redis cache in the resource group. Putting all your app resources in the same resource group lets you easily manage or delete them together.
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.
The following script gets and displays details such as name, hostname, ports, and keys for an Azure Managed Redis cache.
78
+
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 name, hostname, ports, and keys details for an Azure Managed Redis cache.
The following script deletes an Azure Managed Redis cache, and then deletes the resource group that contains all cache resources.
103
+
The following script uses the [az group delete](/cli/azure/group) and [az redisenterprise delete](/cli/azure/redisenterprise#az-redisenterprise-delete) commands to delete an Azure Managed Redis cache, and then delete the resource group that contains all cache resources.
This sample is broken. When it is fixed, we can fix this include.
149
-
-->
150
-
151
-
The cache `name` must be a string of 1-63 characters that's unique in the region. It can contain only numbers, letters, and hyphens, must start and end with a number or letter, and can't contain consecutive hyphens.
152
-
153
-
The `location` should be an [Azure region](https://azure.microsoft.com/regions/) near other services that use your cache. Use a cache [sku](https://azure.microsoft.com/pricing/details/cache/) and `size` that have the appropriate features and performance for your cache.
154
-
155
-
For security reasons, Microsoft Entra Authentication and TLS encryption are enabled by default for new caches. You can choose to enable access key authentication or non-TLS connections during or after cache creation.
156
-
157
-
>[!IMPORTANT]
158
-
>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).
159
-
160
-
The following example script sets variables, then creates a resource group and an Azure Cache for Redis cache in the resource group. Putting all your app resources in the same resource group lets you easily manage or delete them together.
118
+
The following script sets variables, then 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.
161
119
162
120
```azurecli
163
121
@@ -174,25 +132,25 @@ size="C0"
174
132
echo "Creating $resourceGroup in "$location"..."
175
133
az group create --resource-group $resourceGroup --location "$location" --tags $tag
The following script gets and displays details such as name, hostname, ports, and keys for an Azure Cache for Redis cache.
142
+
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 for an Azure Cache for Redis cache.
185
143
186
144
```azurecli
187
145
188
-
# Get details of an Azure Cache for Redis
146
+
# Get details of an Azure Cache for Redis cache
189
147
echo "Showing details of $cache"
190
148
az redis show --name "$cache" --resource-group $resourceGroup
191
149
192
-
# Retrieve the hostname and ports for an Azure Redis Cache instance
150
+
# Retrieve the hostname and ports for an Azure Redis instance
The following script deletes an Azure Cache for Redis cache, and then deletes the resource group that contains all cache resources.
167
+
The following script uses the [az group delete](/cli/azure/group) and [az redis delete](/cli/azure/redis#az-redis-delete) commands to delete an Azure Cache for Redis cache, and then delete the resource group that contains all cache resources.
210
168
211
169
```azurecli
212
-
# Delete a redis cache
170
+
# Delete an Azure Redis cache
213
171
echo "Deleting $cache"
214
172
az redis delete --name "$cache" --resource-group $resourceGroup -y
0 commit comments