Set-AzRedisCache
Modifies an Azure Cache for Redis.
Note
This is the previous version of our documentation. Please consult the most recent version for up-to-date information.
Syntax
Set-AzRedisCache
[-ResourceGroupName <String>]
-Name <String>
[-Size <String>]
[-Sku <String>]
[-RedisConfiguration <Hashtable>]
[-EnableNonSslPort <Boolean>]
[-TenantSettings <Hashtable>]
[-ShardCount <Int32>]
[-MinimumTlsVersion <String>]
[-RedisVersion <String>]
[-Tag <Hashtable>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Set-AzRedisCache cmdlet modifies an Azure Cache for Redis.
Examples
Example 1: Modify Azure Cache for Redis
PS C:\>Set-AzRedisCache -ResourceGroupName "MyGroup" -Name "MyCache" -RedisConfiguration @{"maxmemory-policy" = "allkeys-random"}
PrimaryKey : pJ+jruGKPHDKsEC8kmoybobH3TZx2njBR3ipEsquZFo=
SecondaryKey : sJ+jruGKPHDKsEC8kmoybobH3TZx2njBR3ipEsquZFo=
ResourceGroupName : mygroup
Id : /subscriptions/a559b6fd-3a84-40bb-a450-b0db5ed37dfe/resourceGroups/mygroup/providers/Microsoft.Cache/Redis/myCache
Location : North Central US
Name : MyCache
Type : Microsoft.Cache/Redis
HostName : mycache.redis.cache.windows.net
Port : 6379
ProvisioningState : creating
SslPort : 6380
RedisConfiguration : {[maxmemory-policy, allkeys-random]}
EnableNonSslPort : False
RedisVersion : 2.8
Size : 250MB
Sku : Standard
Tag : {}
Zone : []
This command updates the maxmemory-policy for your Azure Cache fo Redis named MyCache.
Example 2: Modify Azure Cache for Redis - If you want to Disable RDB or AOF Data Persistence.
PS C:\>Set-AzRedisCache -Name "MyCache" -RedisConfiguration @{"rdb-backup-enabled" = "false"}
PrimaryKey : pJ+jruGKPHDKsEC8kmoybobH3TZx2njBR3ipEsquZFo=
SecondaryKey : sJ+jruGKPHDKsEC8kmoybobH3TZx2njBR3ipEsquZFo=
ResourceGroupName : MyGroup
Id : /subscriptions/a559b6fd-3a84-40bb-a450-b0db5ed37dfe/resourceGroups/mygroup/providers/Microsoft.Cache/Redis/MyCache
Location : Central US
Name : mycache
Type : Microsoft.Cache/Redis
HostName : mycache.redis.cache.windows.net
Port : 6379
ProvisioningState : Succeeded
SslPort : 6380
RedisConfiguration : {[maxmemory-policy, allkeys-random], [maxclients, 7500], [maxmemory-reserved, 200],
[maxfragmentationmemory-reserved, 300], [rdb-backup-enabled, false]...}
EnableNonSslPort : False
RedisVersion : 4.0.14
Size : 6GB
Sku : Premium
Tag : {}
Zone : []
This cmdlet disables RDB backup data persistence for Azure Cache for Redis. You can also disable AOF backup persistent cache.
Example 3: Modify Azure Cache for Redis - If you want to add data persistence after azure redis cache created.
PS C:\>Set-AzRedisCache -Name "MyCache" -RedisConfiguration @{"rdb-backup-enabled" = "true"; "rdb-storage-connection-string" = "DefaultEndpointsProtocol=https;AccountName=mystorageaccount;AccountKey=pJ+jruGKPHDKsEC8kmoybobH3TZx2njBR3ipEsquZFo=;EndpointSuffix=core.windows.net"; "rdb-backup-frequency" = "30"}
PrimaryKey : pJ+jruGKPHDKsEC8kmoybobH3TZx2njBR3ipEsquZFo=
SecondaryKey : sJ+jruGKPHDKsEC8kmoybobH3TZx2njBR3ipEsquZFo=
ResourceGroupName : MyGroup
Id : /subscriptions/a559b6fd-3a84-40bb-a450-b0db5ed37dfe/resourceGroups/mygroup/providers/Microsoft.Cache/Redis/MyCache
Location : Central US
Name : mycache
Type : Microsoft.Cache/Redis
HostName : mycache.redis.cache.windows.net
Port : 6379
ProvisioningState : Succeeded
SslPort : 6380
RedisConfiguration : {[maxmemory-policy, allkeys-random], [maxclients, 7500], [maxmemory-reserved, 200],
[maxfragmentationmemory-reserved, 300], [rdb-backup-enabled, true]....}
EnableNonSslPort : False
RedisVersion : 4.0.14
Size : 6GB
Sku : Premium
Tag : {}
Zone : []
This cmdlet enables rdb-backup persistence on an already existing cache. You can also enable aof-backup persistence.
Example 4: Modify Azure Cache for Redis - If you want to change rdb back up frequency.
For example - Currently you are taking RDB snapshot in every 30 minute, but you want to change to take snapshot 15 minutes.
PS C:\>Set-AzRedisCache -Name "MyCache" -RedisConfiguration @{"rdb-backup-frequency" = "15"}
PrimaryKey : pJ+jruGKPHDKsEC8kmoybobH3TZx2njBR3ipEsquZFo=
SecondaryKey : sJ+jruGKPHDKsEC8kmoybobH3TZx2njBR3ipEsquZFo=
ResourceGroupName : MyGroup
Id : /subscriptions/a559b6fd-3a84-40bb-a450-b0db5ed37dfe/resourceGroups/mygroup/providers/Microsoft.Cache/Redis/MyCache
Location : Central US
Name : mycache
Type : Microsoft.Cache/Redis
HostName : mycache.redis.cache.windows.net
Port : 6379
ProvisioningState : Succeeded
SslPort : 6380
RedisConfiguration : {[maxmemory-policy, allkeys-random], [maxclients, 7500], [maxmemory-reserved, 200],
[maxfragmentationmemory-reserved, 300], [rdb-backup-enabled, true]....}
EnableNonSslPort : False
RedisVersion : 4.0.14
Size : 6GB
Sku : Premium
Tag : {}
Zone : []
Example 5: Modify Azure Cache for Redis - If you want to change AOF back up data persistence to RDB back up.
PS C:\>Set-AzRedisCache -Name "MyCache" -RedisConfiguration @{"aof-backup-enabled"= "false"; "rdb-backup-enabled" = "true"; "rdb-storage-connection-string" = "DefaultEndpointsProtocol=https;AccountName=mystorageaccount;AccountKey=pJ+jruGKPHDKsEC8kmoybobH3TZx2njBR3ipEsquZFo=;EndpointSuffix=core.windows.net"; "rdb-backup-frequency" = "30"}
PrimaryKey : pJ+jruGKPHDKsEC8kmoybobH3TZx2njBR3ipEsquZFo=
SecondaryKey : sJ+jruGKPHDKsEC8kmoybobH3TZx2njBR3ipEsquZFo=
ResourceGroupName : MyGroup
Id : /subscriptions/a559b6fd-3a84-40bb-a450-b0db5ed37dfe/resourceGroups/mygroup/providers/Microsoft.Cache/Redis/MyCache
Location : Central US
Name : mycache
Type : Microsoft.Cache/Redis
HostName : mycache.redis.cache.windows.net
Port : 6379
ProvisioningState : Succeeded
SslPort : 6380
RedisConfiguration : {[maxmemory-policy, allkeys-random], [maxclients, 7500], [maxmemory-reserved, 200],
[maxfragmentationmemory-reserved, 300], [rdb-backup-enabled, true]....}
EnableNonSslPort : False
RedisVersion : 4.0.14
Size : 6GB
Sku : Premium
Tag : {}
Zone : []
This cmdlet helps in changing persistence method.
Example 6: Scale an Azure Cache for Redis Instance - Update to different size.
PS C:\>Set-AzRedisCache -Name "MyCache" -Size "P2" -Sku "Premium"
PrimaryKey : pJ+jruGKPHDKsEC8kmoybobH3TZx2njBR3ipEsquZFo=
SecondaryKey : sJ+jruGKPHDKsEC8kmoybobH3TZx2njBR3ipEsquZFo=
ResourceGroupName : MyGroup
Id : /subscriptions/a559b6fd-3a84-40bb-a450-b0db5ed37dfe/resourceGroups/mygroup/providers/Microsoft.Cache/Redis/MyCache
Location : Central US
Name : mycache
Type : Microsoft.Cache/Redis
HostName : mycache.redis.cache.windows.net
Port : 6379
ProvisioningState : Scaling
SslPort : 6380
RedisConfiguration : {[maxmemory-policy, allkeys-random], [maxclients, 7500], [maxmemory-reserved, 200],
[maxfragmentationmemory-reserved, 300]....}
EnableNonSslPort : False
RedisVersion : 4.0.14
Size : 6GB
Sku : Premium
Tag : {}
Zone : []
This command increases or decreases the memory size of your instance.
Example 7: Scale an Azure Cache for Redis Instance - Update to different tier.
PS C:\>Set-AzRedisCache -Name "MyCache" -Size "P1" -Sku "Premium"
PrimaryKey : pJ+jruGKPHDKsEC8kmoybobH3TZx2njBR3ipEsquZFo=
SecondaryKey : sJ+jruGKPHDKsEC8kmoybobH3TZx2njBR3ipEsquZFo=
ResourceGroupName : MyGroup
Id : /subscriptions/a559b6fd-3a84-40bb-a450-b0db5ed37dfe/resourceGroups/mygroup/providers/Microsoft.Cache/Redis/MyCache
Location : Central US
Name : mycache
Type : Microsoft.Cache/Redis
HostName : mycache.redis.cache.windows.net
Port : 6379
ProvisioningState : Scaling
SslPort : 6380
RedisConfiguration : {[maxmemory-policy, allkeys-random], [maxclients, 7500], [maxmemory-reserved, 200],
[maxfragmentationmemory-reserved, 300]....}
EnableNonSslPort : False
RedisVersion : 4.0.14
Size : 1GB
Sku : Standard
Tag : {}
Zone : []
This command helps you change the tier of your cache. You can change from Basic to Standard, or Standard to Premium.
Example 8: Scale an Azure Cache for Redis Instance - Enable Redis Clustering.
PS C:\>Set-AzRedisCache -Name "MyCache" -ShardCount 1
PrimaryKey : pJ+jruGKPHDKsEC8kmoybobH3TZx2njBR3ipEsquZFo=
SecondaryKey : sJ+jruGKPHDKsEC8kmoybobH3TZx2njBR3ipEsquZFo=
ResourceGroupName : MyGroup
Id : /subscriptions/a559b6fd-3a84-40bb-a450-b0db5ed37dfe/resourceGroups/mygroup/providers/Microsoft.Cache/Redis/MyCache
Location : Central US
Name : mycache
Type : Microsoft.Cache/Redis
HostName : mycache.redis.cache.windows.net
Port : 6379
ProvisioningState : Scaling
SslPort : 6380
RedisConfiguration : {[maxmemory-policy, allkeys-random], [maxclients, 7500], [maxmemory-reserved, 200],
[maxfragmentationmemory-reserved, 300]....}
EnableNonSslPort : False
RedisVersion : 4.0.14
Size : 6GB
Sku : Premium
ShardCount :
Tag : {}
Zone : []
This cmdlet helps you in enable clustering for your Azure Cache for Redis instance. For increasing the shard count, must enable clustering first.
Example 9: Scale an Azure Cache for Redis Instance - Use Redis Cluster to scale in/out.
PS C:\>Set-AzRedisCache -Name "MyCache" -ShardCount 2
PrimaryKey : pJ+jruGKPHDKsEC8kmoybobH3TZx2njBR3ipEsquZFo=
SecondaryKey : sJ+jruGKPHDKsEC8kmoybobH3TZx2njBR3ipEsquZFo=
ResourceGroupName : MyGroup
Id : /subscriptions/a559b6fd-3a84-40bb-a450-b0db5ed37dfe/resourceGroups/mygroup/providers/Microsoft.Cache/Redis/MyCache
Location : Central US
Name : mycache
Type : Microsoft.Cache/Redis
HostName : mycache.redis.cache.windows.net
Port : 6379
ProvisioningState : Scaling
SslPort : 6380
RedisConfiguration : {[maxmemory-policy, allkeys-random], [maxclients, 7500], [maxmemory-reserved, 200],
[maxfragmentationmemory-reserved, 300]....}
EnableNonSslPort : False
RedisVersion : 4.0.14
Size : 6GB
Sku : Premium
ShardCount : 1
Tag : {}
Zone : []
This command increases or decreases the cluster size.
Parameters
Prompts you for confirmation before running the cmdlet.
| Type: | SwitchParameter |
| Aliases: | cf |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The credentials, account, tenant, and subscription used for communication with azure.
| Type: | IAzureContextContainer |
| Aliases: | AzContext, AzureRmContext, AzureCredential |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Indicates whether the non-SSL port is enabled. The default value is $False (the non-SSL port is disabled).
| Type: | Nullable<T>[Boolean] |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
Specify the TLS version required by clients to connect to cache.
| Type: | String |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
Specifies the name of the Azure Cache for Redis to update.
| Type: | String |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
Specifies Redis configuration settings. The acceptable values for this parameter are:
- rdb-backup-enabled. Specifies that Redis data persistence is enabled. Premium tier only.
- rdb-storage-connection-string. Specifies the connection string to the Storage account for Redis data persistence. Premium tier only.
- rdb-backup-frequency. Specifies the backup frequency for Redis data persistence. Premium tier only.
- maxmemory-reserved. Configures the memory reserved for non-cache processes. Standard and Premium tiers.
- maxmemory-policy. Configures the eviction policy for the cache. All pricing tiers.
- notify-keyspace-events. Configures keyspace notifications. Standard and premium tiers.
- hash-max-ziplist-entries. Configures memory optimization for small aggregate data types. Standard and Premium tiers.
- hash-max-ziplist-value. Configures memory optimization for small aggregate data types. Standard and Premium tiers.
- set-max-intset-entries. Configures memory optimization for small aggregate data types. Standard and Premium tiers.
- zset-max-ziplist-entries. Configures memory optimization for small aggregate data types. Standard and Premium tiers.
- zset-max-ziplist-value. Configures memory optimization for small aggregate data types. Standard and Premium tiers.
- databases. Configures the number of databases. This property can be configured only at cache creation. Standard and Premium tiers. For more information, see Manage Azure Redis Cache with Azure PowerShellhttp://go.microsoft.com/fwlink/?LinkId=800051 (http://go.microsoft.com/fwlink/?LinkId=800051).
| Type: | Hashtable |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
Redis version. Valid values: 4, 6
| Type: | String |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
Specifies the name of the resource group that contains the Redis Cache.
| Type: | String |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
Specifies the number of shards to create on a Premium cluster cache.
| Type: | Nullable<T>[Int32] |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
Specifies the size of the Redis Cache. Valid values are:
- P1
- P2
- P3
- P4
- P5
- C0
- C1
- C2
- C3
- C4
- C5
- C6
- 250MB
- 1GB
- 2.5GB
- 6GB
- 13GB
- 26GB
- 53GB
- 120GB The default value is 1GB or C1.
| Type: | String |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
Specifies the SKU of the Redis Cache to create. Valid values are:
- Basic
- Standard
- Premium The default value is Standard.
| Type: | String |
| Accepted values: | Basic, Standard, Premium |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
A hash table which represents tags.
| Type: | Hashtable |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
This parameter has been deprecated.
| Type: | Hashtable |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
Shows what would happen if the cmdlet runs. The cmdlet is not run.
| Type: | SwitchParameter |
| Aliases: | wi |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Inputs
Nullable<T>[[System.Boolean, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]
Nullable<T>[[System.Int32, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]
Outputs
RedisCacheAttributesWithAccessKeys