Connecting to Azure Cache for Redis and Azure Managed Redis
Note: This runbook covers both legacy Azure Cache for Redis and Azure Managed Redis during the transition period. HMCTS is migrating to Azure Managed Redis. This documentation will be updated once migration is complete.
Overview
Quick guide on how to connect to Redis services using the redis-cli command line tool. Connection methods differ between legacy Azure Cache for Redis and Azure Managed Redis.
Azure Cache for Redis (Legacy)
Test Connection
Test connection from your local terminal session:
telnet <service>.redis.cache.windows.net 6380
# Example:
telnet adoption-web-session-storage-prod.redis.cache.windows.net 6380
Access Redis CLI
Run the following command from your local terminal session to access the Redis CLI:
redis-cli --tls -u 'rediss://%%access key@<service>.redis.cache.windows.net:6380'
# Example:
redis-cli --tls -u 'rediss://%%access key@adoption-web-session-storage-prod.redis.cache.windows.net:6380'
Alternative format using separate flags:
redis-cli -h <service>.redis.cache.windows.net -p 6380 --tls -a "<access-key>"
# Example:
redis-cli -h adoption-web-session-storage-prod.redis.cache.windows.net -p 6380 --tls -a "your-access-key-here"
Azure Managed Redis
Test Connection
Test connection from your local terminal session:
telnet <service>.<region>.redis.azure.net 10000
# Example:
telnet adoption-web-session-storage-prod.uksouth.redis.azure.net 10000
Access Redis CLI
Run the following command from your local terminal session to access the Redis CLI:
# Example:
redis-cli -h adoption-web-session-storage-prod.uksouth.redis.azure.net -p 10000 --tls \
--user default -a "your-access-key-here"
Verify Connection
Once connected to Redis, you can verify the connection and check for keys:
# Check for all keys
KEYS *