az redis

Manage dedicated Redis caches for your Azure applications.

Commands

az redis create

Create new Redis Cache instance.

az redis delete

Deletes a Redis cache.

az redis export

Export data stored in a Redis cache.

az redis firewall-rules

Manage Redis firewall rules.

az redis firewall-rules create

Create a redis cache firewall rule.

az redis firewall-rules delete

Deletes a single firewall rule in a specified redis cache.

az redis firewall-rules list

Gets all firewall rules in the specified redis cache.

az redis firewall-rules show

Gets a single firewall rule in a specified redis cache.

az redis firewall-rules update

Update a redis cache firewall rule.

az redis force-reboot

Reboot specified Redis node(s).

az redis identity

Manage identity assigned to Azure cache for Redis.

az redis identity assign

Assign identity for Azure cache for Redis.

az redis identity remove

Remove the identity already assigned for Azure cache for Redis.

az redis identity show

Show the identity assigned for Azure cache for Redis.

az redis import

Import data into a Redis cache.

az redis import-method

Import data into Redis cache.

az redis list

List Redis Caches.

az redis list-keys

Retrieve a Redis cache's access keys.

az redis patch-schedule

Manage Redis patch schedules.

az redis patch-schedule create

Create patching schedule for Redis cache.

az redis patch-schedule delete

Deletes the patching schedule of a redis cache.

az redis patch-schedule show

Gets the patching schedule of a redis cache.

az redis patch-schedule update

Update the patching schedule for Redis cache.

az redis regenerate-keys

Regenerate Redis cache's access keys.

az redis server-link

Manage Redis server links.

az redis server-link create

Adds a server link to the Redis cache (requires Premium SKU).

az redis server-link delete

Deletes the linked server from a redis cache (requires Premium SKU).

az redis server-link list

Gets the list of linked servers associated with this redis cache (requires Premium SKU).

az redis server-link show

Gets the detailed information about a linked server of a redis cache (requires Premium SKU).

az redis show

Gets a Redis cache (resource description).

az redis update

Update a Redis cache.

az redis create

Create new Redis Cache instance.

az redis create --location
                --name
                --resource-group
                --sku {Basic, Premium, Standard}
                --vm-size {c0, c1, c2, c3, c4, c5, c6, p1, p2, p3, p4, p5}
                [--enable-non-ssl-port]
                [--mi-system-assigned]
                [--mi-user-assigned]
                [--minimum-tls-version {1.0, 1.1, 1.2}]
                [--redis-configuration]
                [--redis-version]
                [--replicas-per-master]
                [--shard-count]
                [--static-ip]
                [--subnet-id]
                [--tags]
                [--tenant-settings]
                [--zones {1, 2, 3}]

Examples

Create new Redis Cache instance. (autogenerated)

az redis create --location westus2 --name MyRedisCache --resource-group MyResourceGroup --sku Basic --vm-size c0

Configure the multiple zones for new Premium Azure Cache for Redis

az redis create --location westus2 --name MyRedisCache --resource-group MyResourceGroup --sku Premium --vm-size p1 --zones 1 2

Configure the memory policies for the cache.

az redis create --resource-group resourceGroupName --name cacheName --location westus2 --sku Standard --vm-size c0 --redis-configuration @"config_max-memory.json"

Configure and enable the RDB back up data persistence for new Premium Azure Cache for Redis.

az redis create --location westus2 --name MyRedisCache --resource-group MyResourceGroup --sku Premium --vm-size p1 --redis-configuration @"config_rdb.json"

Configure and enable the AOF back up data persistence for new Premium Azure Cache for Redis

az redis create --location westus2 --name MyRedisCache --resource-group MyResourceGroup --sku Premium --vm-size p1 --redis-configuration @"config_aof.json"

Create a Premium Azure Cache for Redis with clustering enabled

az redis create --location westus2 --name MyRedisCache --resource-group MyResourceGroup --sku Premium --vm-size p1 --shard-count 2

Deploying a Premium Azure Cache for Redis inside an existing Azure Virtual Network

az redis create --location westus2 --name MyRedisCache --resource-group MyResourceGroup --sku Premium --vm-size p1 --subnet-id "/subscriptions/{subid}/resourceGroups/{resourceGroupName}/providers/Microsoft.{Network|ClassicNetwork}/virtualNetworks/vnet1/subnets/subnet1"

Required Parameters

--location -l

Location. Values from: az account list-locations. You can configure the default location using az configure --defaults location=<location>.

--name -n

Name of the Redis cache.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--sku

Type of Redis cache.

accepted values: Basic, Premium, Standard
--vm-size

Size of Redis cache to deploy. Basic and Standard Cache sizes start with C. Premium Cache sizes start with P.

accepted values: c0, c1, c2, c3, c4, c5, c6, p1, p2, p3, p4, p5

Optional Parameters

--enable-non-ssl-port

If specified, then the non-ssl redis server port (6379) will be enabled.

--mi-system-assigned

Flag to specify system assigned identity.

--mi-user-assigned

One or more space separated resource IDs of user assigned identities.

--minimum-tls-version

Specifies the TLS version required by clients to connect to cache.

accepted values: 1.0, 1.1, 1.2
--redis-configuration

A json file used to set redis-configuration settings. You may encounter parse errors if the json file is invalid.

--redis-version

Redis version. Only major version will be used in create/update request with current valid values: (4, 6).

--replicas-per-master

The number of replicas to be created per master.

--shard-count

The number of shards to be created on a Premium Cluster Cache.

--static-ip

Specify a static ip if required for the VNET. If you do not specify a static IP then an IP address is chosen automatically.

--subnet-id

The full resource ID of a subnet in a virtual network to deploy the redis cache in. Example format /subscriptions/{subid}/resourceGroups/{resourceGroupName}/providers/Microsoft.{Network|ClassicNetwork}/virtualNetworks/vnet1/subnets/subnet1.

--tags

Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.

--tenant-settings

Space-separated tenant settings in key[=value] format.

--zones -z

Space-separated list of availability zones into which to provision the resource.

accepted values: 1, 2, 3

az redis delete

Deletes a Redis cache.

az redis delete [--ids]
                [--name]
                [--resource-group]
                [--yes]

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the Redis cache.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--yes -y

Do not prompt for confirmation.

az redis export

Export data stored in a Redis cache.

az redis export --container
                --prefix
                [--file-format]
                [--ids]
                [--name]
                [--resource-group]

Required Parameters

--container

SAS url for container where data needs to be exported to.

--prefix

Prefix to use for exported files.

Optional Parameters

--file-format

Format of the blob (Currently rdb is the only supported format, with other formats expected in the future).

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the Redis cache.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

az redis force-reboot

Reboot specified Redis node(s).

Usage example - az redis force-reboot --name testCacheName --resource-group testResourceGroup --reboot-type {AllNodes, PrimaryNode, SecondaryNode} [--shard-id].

az redis force-reboot --reboot-type {AllNodes, PrimaryNode, SecondaryNode}
                      [--ids]
                      [--name]
                      [--resource-group]
                      [--shard-id]

Required Parameters

--reboot-type

Which Redis node(s) to reboot. Depending on this value data loss is possible.

accepted values: AllNodes, PrimaryNode, SecondaryNode

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the Redis cache.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--shard-id

If clustering is enabled, the ID of the shard to be rebooted.

az redis import

Import data into a Redis cache.

az redis import --files
                [--file-format]
                [--ids]
                [--name]
                [--resource-group]

Required Parameters

--files

SAS url for blobs that needs to be imported.

Optional Parameters

--file-format

Format of the blob (Currently rdb is the only supported format, with other formats expected in the future).

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the Redis cache.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

az redis import-method

Import data into Redis cache.

Usage example - az redis import-method --name testCacheName --resource-group testResourceGroup --files [--file-format].

az redis import-method --files
                       [--file-format]
                       [--ids]
                       [--name]
                       [--resource-group]

Required Parameters

--files

SAS url for blobs that needs to be imported.

Optional Parameters

--file-format

Format of the blob (Currently rdb is the only supported format, with other formats expected in the future).

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the Redis cache.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

az redis list

List Redis Caches.

Lists details about all caches within current Subscription or provided Resource Group.

az redis list [--resource-group]

Optional Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

az redis list-keys

Retrieve a Redis cache's access keys.

This operation requires write permission to the cache resource.

az redis list-keys [--ids]
                   [--name]
                   [--resource-group]

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the Redis cache.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

az redis regenerate-keys

Regenerate Redis cache's access keys.

Usage example - az redis regenerate-keys --name testCacheName --resource-group testResourceGroup --key-type {Primary, Secondary}.

az redis regenerate-keys --key-type {Primary, Secondary}
                         [--ids]
                         [--name]
                         [--resource-group]

Required Parameters

--key-type

The Redis access key to regenerate.

accepted values: Primary, Secondary

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the Redis cache.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

az redis show

Gets a Redis cache (resource description).

az redis show [--ids]
              [--name]
              [--resource-group]

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the Redis cache.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

az redis update

Update a Redis cache.

Scale or update settings of a Redis cache.

az redis update [--add]
                [--force-string]
                [--ids]
                [--name]
                [--remove]
                [--resource-group]
                [--set]
                [--sku {Basic, Premium, Standard}]
                [--vm-size {c0, c1, c2, c3, c4, c5, c6, p1, p2, p3, p4, p5}]

Examples

Update the maxmemory-policy for your Azure Cache for Redis named MyRedisCache

az redis update --name MyRedisCache --resource-group MyResourceGroup --set "redisConfiguration.maxmemory-policy"="allkeys-lru"

Disable the RDB back up data persistence for Premium Azure Cache for Redis

az redis update --name MyRedisCache --resource-group MyResourceGroup --set "redisConfiguration.rdb-backup-enabled"="false"

Configure the RDB back up enabled data persistence for already created Premium Azure Cache for Redis

az redis update --name MyRedisCache --resource-group MyResourceGroup --set "redisConfiguration.rdb-storage-connection-string"="DefaultEndpointsProtocol=https;AccountName=mystorageaccount;AccountKey=myAccountKey;EndpointSuffix=core.windows.net" "redisConfiguration.rdb-backup-enabled"="true" "redisConfiguration.rdb-backup-frequency"="15" "redisConfiguration.rdb-backup-max-snapshot-count"="1"

Scale an Azure Cache for Redis Instance - Update to different size (An example to scale from c0 to c1).

az redis update --name MyRedisCache --resource-group MyResourceGroup --set "sku.capacity"="2"

Scale an Azure Cache for Redis Instance - Update to different tier (From Basic to Standard or Standard to Premium).

az redis update --name MyRedisCache --resource-group MyResourceGroup --set "sku.name"="Premium" "sku.capacity"="1" "sku.family"="P"

Scale an Azure Cache for Redis Instance - Enable Clustering.

az redis update --name MyRedisCache --resource-group MyResourceGroup --set shardCount=1

Scale an Azure Cache for Redis Instance in/out using Redis Cluster.

az redis update --name MyRedisCache --resource-group MyResourceGroup --set shardCount=2

Optional Parameters

--add

Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.

--force-string

When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the Redis cache.

--remove

Remove a property or an element from a list. Example: --remove property.list OR --remove propertyToRemove.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--set

Update an object by specifying a property path and value to set. Example: --set property1.property2=.

--sku

Type of Redis cache.

accepted values: Basic, Premium, Standard
--vm-size

Size of Redis cache to deploy. Basic and Standard Cache sizes start with C. Premium Cache sizes start with P.

accepted values: c0, c1, c2, c3, c4, c5, c6, p1, p2, p3, p4, p5