Unable to Connect to Azure Managed Redis – Frequent Disconnections from VM

Manish Kumar 0 Reputation points
2025-07-07T16:34:46.81+00:00

Redis connection from our Azure Virtual Machine to Azure Managed Redis is frequently failing. The VM is unable to maintain a stable connection—either timing out or getting disconnected shortly after connecting. All credentials and configurations appear to be correct.

Steps to Reproduce:

Connect to Azure VM (Linux/Windows).

Use redis-cli or application to connect to Azure Managed Redis:

Host: <your-redis-name>.redis.cache.windows.net

  Port: 6380 (TLS)
  
     Password: (Access key from Azure portal)
     
     Run any Redis command or keep the connection idle.
     

Expected Result: A stable and persistent connection to the Redis instance, allowing commands to be executed normally.

Actual Result: Connection either:

Fails immediately with error:

(error) WRONGPASS invalid username-password pair

  `Could not connect to Redis at <host>:6379: Connection refused`
  
  Or disconnects after a short time
  

Environment Details:

Azure VM OS: [e.g., Ubuntu 20.04 / Windows Server 2022]

Redis Client: redis-cli / StackExchange.Redis / custom app

Redis Hostname: <your-redis-host>.redis.cache.windows.net

Port: 6380

TLS: Enabled

Network Security Group: Port 6380 outbound allowed

DNS Resolution: Working from VM

Troubleshooting Done:

Verified Redis credentials from Azure portal

Ensured VM outbound rules allow port 6380

Tested with and without TLS

Attempted from different VMs

Possible Suspicions:

Network-level restrictions (e.g., DNS, NSG, firewall)

Redis Private Endpoint misconfiguration

  • Incorrect TLS setupRedis connection from our Azure Virtual Machine to Azure Managed Redis is frequently failing. The VM is unable to maintain a stable connection—either timing out or getting disconnected shortly after connecting. All credentials and configurations appear to be correct. Steps to Reproduce:
    1. Connect to Azure VM (Linux/Windows).
    2. Use redis-cli or application to connect to Azure Managed Redis:
      • Host: <your-redis-name>.redis.cache.windows.net
      • Port: 6380 (TLS)
      • Password: (Access key from Azure portal)
    3. Run any Redis command or keep the connection idle.
    Expected Result:
    A stable and persistent connection to the Redis instance, allowing commands to be executed normally. Actual Result:
    Connection either:
    • Fails immediately with error:
      • (error) WRONGPASS invalid username-password pair
      • Could not connect to Redis at <host>:6379: Connection refused
    • Or disconnects after a short time
    Environment Details:
    • Azure VM OS: [e.g., Ubuntu 20.04 / Windows Server 2022]
    • Redis Client: redis-cli / StackExchange.Redis / custom app
    • Redis Hostname: <your-redis-host>.redis.cache.windows.net
    • Port: 6380
    • TLS: Enabled
    • Network Security Group: Port 6380 outbound allowed
    • DNS Resolution: Working from VM
    Troubleshooting Done:
    • Verified Redis credentials from Azure portal
    • Ensured VM outbound rules allow port 6380
    • Tested with and without TLS
    • Attempted from different VMs
    Possible Suspicions:
    • Network-level restrictions (e.g., DNS, NSG, firewall)
    • Redis Private Endpoint misconfiguration
    • Incorrect TLS setup
Azure Cache for Redis
Azure Cache for Redis
An Azure service that provides access to a secure, dedicated Redis cache, managed by Microsoft.
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.