Skip to content

Redis cache should use Availability zones in supported regions#

Reliability · Azure Cache for Redis · Rule · 2021_12 · Important

Premium Redis cache should be deployed with availability zones for high availability.

Description#

Redis Cache using availability zones improve reliability and ensure availability during failure scenarios affecting a data center within a region. Nodes in one availability zone are physically separated from nodes defined in another availability zone. By spreading node pools across multiple zones, nodes in one node pool will continue running even if another zone has gone down.

Recommendation#

Consider using availability zones for Premium Redis Cache deployed in supported regions.

Examples#

Configure with Azure template#

To set availability zones for Premium SKU Redis Cache:

  • Set zones to a minimum of two zones from ["1", "2", "3"].
  • Set Properties.replicasPerMaster to number of zones - 1, to ensure you have at least as many nodes as zones you are replicating to.
  • Set Properties.sku.name to Premium.
  • Set Properties.sku.family to P.
  • Set Properties.sku.capacity to one of [1, 2, 3, 4, 5], depending on the SKU you picked:
    • P1 - 6 GB
    • P2 - 13 GB
    • P3 - 26 GB
    • P4 - 53 GB
    • P5 - 120 GB

For example:

Azure Template snippet
{
  "type": "Microsoft.Cache/redis",
  "apiVersion": "2024-03-01",
  "name": "[parameters('name')]",
  "location": "[parameters('location')]",
  "properties": {
    "redisVersion": "6",
    "sku": {
      "name": "Premium",
      "family": "P",
      "capacity": 1
    },
    "redisConfiguration": {
      "aad-enabled": "True",
      "maxmemory-reserved": "615"
    },
    "enableNonSslPort": false,
    "publicNetworkAccess": "Disabled"
  },
  "zones": [
    "1",
    "2",
    "3"
  ]
}

Configure with Bicep#

To set availability zones for Premium SKU Redis Cache:

  • Set zones to a minimum of two zones from ["1", "2", "3"].
  • Set Properties.replicasPerMaster to number of zones - 1, to ensure you have at least as many nodes as zones you are replicating to.
  • Set Properties.sku.name to Premium.
  • Set Properties.sku.family to P.
  • Set Properties.sku.capacity to one of [1, 2, 3, 4, 5], depending on the SKU you picked:
    • P1 - 6 GB
    • P2 - 13 GB
    • P3 - 26 GB
    • P4 - 53 GB
    • P5 - 120 GB

For example:

Azure Bicep snippet
resource cache 'Microsoft.Cache/redis@2024-03-01' = {
  name: name
  location: location
  properties: {
    redisVersion: '6'
    sku: {
      name: 'Premium'
      family: 'P'
      capacity: 1
    }
    redisConfiguration: {
      'aad-enabled': 'True'
      'maxmemory-reserved': '615'
    }
    enableNonSslPort: false
    publicNetworkAccess: 'Disabled'
  }
  zones: [
    '1'
    '2'
    '3'
  ]
}

Configure with Azure Verified Modules

A pre-validated module supported by Microsoft is available from the Azure Bicep public registry. To reference the module, please use the following syntax:

br/public:avm/res/cache/redis:<version>

To use the latest version:

br/public:avm/res/cache/redis:0.8.0

Notes#

This rule applies when analyzing resources deployed to Azure using pre-flight and in-flight data.

This rule fails when "zones" is null, [] or less than two zones are used when there are availability zones for the given region.

This rule fails when cache is not zone redundant(1, 2 and 3) when there are availability zones for the given region.

Configure AZURE_REDISCACHE_ADDITIONAL_REGION_AVAILABILITY_ZONE_LIST to set additional availability zones that need to be supported which are not in the existing providers for namespace Microsoft.Cache and resource type Redis.

# YAML: The default AZURE_REDISCACHE_ADDITIONAL_REGION_AVAILABILITY_ZONE_LIST configuration option
configuration:
  AZURE_REDISCACHE_ADDITIONAL_REGION_AVAILABILITY_ZONE_LIST: []

Comments