Lesson 1 of 3 Azure Managed Redis for AI Solutions

Understanding Azure Managed Redis

This lesson explains what Azure Managed Redis provides, its tiers, clustering policies and modules, and how clients connect and authenticate.

Learning outcomes

After completing this lesson, you will be able to:

  • Compare the Azure Managed Redis tiers.
  • Distinguish the OSS and Enterprise clustering policies.
  • Explain the constraints on modules such as RediSearch.
  • Describe keyless connections with Microsoft Entra ID.

What Azure Managed Redis provides

Redis is an in-memory data store that answers reads and writes in well under a millisecond. Applications use it as a cache in front of slower stores, for session state, for counters and leaderboards, for lightweight queues and, with the search module, as a vector database for semantic caching and fast retrieval. Azure Managed Redis runs Redis Enterprise software as a managed service, currently compatible with Redis 7.4, with Microsoft operating the infrastructure, patching, scaling and replication.

Azure Managed Redis is the service to choose for new deployments. The older Azure Cache for Redis Basic, Standard and Premium tiers are closed to new customers and retire on 30 September 2028, and its Enterprise tiers are being migrated to Azure Managed Redis. Exam answers that create a new cache should therefore use Azure Managed Redis.

True or false

Azure Managed Redis

Exam skills 2.3.1

Decide whether each statement about Azure Managed Redis is true.

Log in to try this activity Interactive activities are free with an account.

Tiers and sizes

Azure Managed Redis has four tiers. Three keep all data in memory and differ in their ratio of memory to vCPUs; the fourth moves less-used data to fast NVMe storage.

Memory Optimized
Memory to vCPU8:1
StrengthLarge data at lower cost per GB
Search and vector moduleYes
Choose when Large caches with modest throughput, dev and test
Balanced
Memory to vCPU4:1
StrengthGeneral purpose
Search and vector moduleYes
Choose when Most workloads
Compute Optimized
Memory to vCPU2:1
StrengthHighest throughput
Search and vector moduleYes
Choose when Very high request rates
Flash Optimized
Memory to vCPUMemory plus NVMe flash
StrengthVery large datasets at lowest cost
Search and vector moduleNo
Choose when Hundreds of GB of mostly cold data

Sizes range from 0.5 GB (Balanced B0) to several terabytes. High availability, which places replica shards on separate nodes and across availability zones where available, is enabled by default and can be disabled only for development. Optional data persistence writes snapshots or an append-only log to disk for recovery, and active geo-replication links caches in several regions in an active-active configuration.

Sort into groups

Which Redis tier?

Exam skills 2.3.1

Choose the Azure Managed Redis tier for each workload.

Log in to try this activity Interactive activities are free with an account.

Clustering policies and modules

Each cache stores data across shards, and the clustering policy decides how clients see them. The OSS policy exposes the Redis Cluster protocol, so a cluster-aware client connects to shards directly, which gives the best performance. The Enterprise policy presents a single endpoint through a proxy, so any client works without cluster awareness. A non-clustered option suits small caches.

Modules extend Redis with additional data structures: RediSearch for secondary indexing, full-text and vector search; RedisJSON for JSON documents; RedisBloom for probabilistic structures such as Bloom filters; and RedisTimeSeries for time series. Modules must be chosen when the cache is created; they cannot be added later. RediSearch also requires the Enterprise clustering policy and the NoEviction eviction policy, and only RediSearch and RedisJSON can be used with active geo-replication.

The following diagram maps each requirement of a semantic cache to the Azure Managed Redis setting that meets it.

Requirements for the semantic cache mapped to Azure Managed Redis settings. Vector search needs the RediSearch module, which requires the Enterprise clustering policy and NoEviction, all chosen at creation. The Balanced tier at a size above 4 GB holds the data, Microsoft Entra ID through an access policy assignment replaces access keys, and high availability keeps the cache running during a zone failure.
Modules and the clustering policy cannot be added after creation.

Decide modules at creation

A cache created without RediSearch cannot be given vector search later, and a cache with the OSS clustering policy cannot use RediSearch. If a scenario needs vector search in Redis, the cache must be created with RediSearch, Enterprise clustering and NoEviction from the start.

Match the pairs

Policies and modules

Exam skills 2.3.1 · 2.3.2

Match each clustering policy or module with what it provides.

Log in to try this activity Interactive activities are free with an account.

Connecting and authenticating

Clients connect to the cache's host name, NAME.REGION.redis.azure.net, on port 10000 over TLS. Network access can be public or through a private endpoint. For authentication, Microsoft Entra ID is the recommended method: the application's identity is given data access to the cache through an access policy assignment, and the client presents an Entra token instead of a password. Access keys remain available but can be disabled, which removes shared secrets entirely.

In Python, the redis-py library connects to Redis, and the redis-entraid package supplies a credential provider that obtains and refreshes Entra tokens through Azure Identity.

import redis
from redis_entraid.cred_provider import create_from_default_azure_credential

provider = create_from_default_azure_credential(("https://redis.azure.com/.default",))
cache = redis.Redis(host="CACHE.REGION.redis.azure.net", port=10000, ssl=True,
                    credential_provider=provider, decode_responses=True)
cache.set("health", "ok", ex=60)
print(cache.get("health"))

A single client object manages a pool of connections and should be created once and reused, like database clients. With the OSS clustering policy, the application uses redis.cluster.RedisCluster, which routes each key to its shard.

Spot the bug

A Redis client that will not connect

Exam skills 2.3.1

Find the lines that stop this client from connecting securely to Azure Managed Redis.

Log in to try this activity Interactive activities are free with an account.
Worked example

Creating a cache for semantic caching

A team needs a cache in front of its chat API that stores ordinary cached responses and also performs vector similarity search over cached prompt embeddings. Data will be under 4 GB. The application must not use access keys, and the cache must stay available during a zone failure.

The team should create an Azure Managed Redis cache in the Balanced tier at a size above 4 GB, with the RediSearch module, the Enterprise clustering policy and NoEviction, all chosen at creation. High availability stays enabled for zone resilience. The application connects on port 10000 over TLS with Microsoft Entra ID through an access policy assignment, and access keys are disabled.

Azure Cache for Redis Standard is closed to new customers and lacks the search module. Flash Optimized does not support RediSearch. Creating the cache first and adding RediSearch later is not possible.

Check yourself

Which two cache settings does the RediSearch module require, and when must the module be chosen?

Show answer

The Enterprise clustering policy and the NoEviction eviction policy. The module must be selected when the cache is created.

Exam Tips

Remember for the exam

  • New caches use Azure Managed Redis; Azure Cache for Redis B/S/P is closed to new customers.
  • Tiers: Memory Optimized 8:1, Balanced 4:1, Compute Optimized 2:1, Flash Optimized (no RediSearch).
  • Modules are chosen at creation; RediSearch needs Enterprise clustering and NoEviction.
  • Connect on port 10000 with TLS, preferably with Microsoft Entra ID instead of access keys.