Redis cache should use Availability zones in supported regions

March 21, 2025 ยท View on GitHub

SYNOPSIS

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:

{
  "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:

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'
  ]
}

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: []