Published on

Troubleshooting Redis SSL Connection in Azure

Authors
  • avatar
    Name
    Alexander Arana Escobedo
    Twitter

Prerequisites

  • Before troubleshooting the Redis SSL connection, make sure you have redis-tools installed in your environment. This package provides the redis-cli command-line tool used to connect to Azure Redis.
    •   sudo apt-get update
        sudo apt-get install redis-tools
      

Intro

Recently, I encountered an issue where I needed to confirm that my pod on the cluster was able to connect to Azure Redis.

I ran the command:

redis-cli -h "redis-demo-test-we-01.redis.cache.windows.net" -p 6380 -a <REDIS_KEY>

Command Flags Explanation

  • -h: Specifies the hostname of the Redis server.
  • -p: Defines the port number to connect to.
  • -a: Provides the authentication password for the Redis instance.

It seemed like I had successfully connected to Azure Redis. However, when I tried to run KEYS *, it just kept loading, making it feel like there was no real connection to Azure Redis.

The issue turned out to be related to SSL. I had enabled the "Allow access only via SSL" option in the Redis settings.

redis-troubleshooting-ssl-connection

After some troubleshooting, I found a small but crucial detail in the Microsoft documentation: when connecting to Azure Redis, you need to use the --tls flag for secure connections.

redis-troubleshooting-ssl-connection

As soon as I added the --tls flag to my redis-cli command, everything started working as expected. Success! 🤓

Here’s the corrected command:

redis-cli --tls -h "redis-demo-test-we-01.redis.cache.windows.net" -p 6380 -a <REDIS_KEY>

I hope this guide helps you out! If you have any questions, don't hesitate to reach out.

Alexander Arana.E