How to use the Redis command-line tool with Azure Cache for Redis

redis-cli.exe is a popular command-line tool for interacting with an Azure Cache for Redis as a client. This tool is also available for use with Azure Cache for Redis.

The tool is available for Windows platforms by downloading the Redis command-line tools for Windows.

If you want to run the command-line tool on another platform, download Azure Cache for Redis from

Gather cache access information


This article has been updated to use the new Azure PowerShell Az module. You can still use the AzureRM module, which will continue to receive bug fixes until at least December 2020. To learn more about the new Az module and AzureRM compatibility, see Introducing the new Azure PowerShell Az module. For Az module installation instructions, see Install Azure PowerShell.

You can gather the information needed to access the cache using three methods:

  1. Azure CLI using az redis list-keys
  2. Azure PowerShell using Get-AzRedisCacheKey
  3. Using the Azure portal.

In this section, you will retrieve the keys from the Azure portal.

Retrieve host name, ports, and access keys by using the Azure portal

When connecting to an Azure Cache for Redis instance, cache clients need the host name, ports, and a key for the cache. Some clients might refer to these items by slightly different names. You can retrieve this information in the Azure portal.

To retrieve the access keys and host name

  1. To retrieve the access keys by using the Azure portal, go to your cache and select Access keys.

    Azure Cache for Redis keys

  2. To retrieve the host name and ports, select Properties.

    Azure Cache for Redis properties

Enable access for redis-cli.exe

With Azure Cache for Redis, only the SSL port (6380) is enabled by default. The redis-cli.exe command-line tool doesn't support SSL. You have two configuration choices to use it:

  1. Enable the non-SSL port (6379) - This configuration is not recommended because in this configuration, the access keys are sent via TCP in clear text. This change can compromise access to your cache. The only scenario where you might consider this configuration is when you are just accessing a test cache.

  2. Download and install stunnel.

    Run stunnel GUI Start to start the server.

    Right-click the taskbar icon for the stunnel server and click Show Log Window.

    On the stunnel Log Window menu, click Configuration > Edit Configuration to open the current configuration file.

    Add the following entry for redis-cli.exe under the Service definitions section. Insert your actual cache name in place of yourcachename.

    client = yes
    accept =
    connect =

    Save and close the configuration file.

    On the stunnel Log Window menu, click Configuration > Reload Configuration.

Connect using the Redis command-line tool.

When using stunnel, run redis-cli.exe, and pass only your port, and access key (primary or secondary) to connect to the cache.

redis-cli.exe -p 6380 -a YourAccessKey

stunnel with redis-cli

If you're using a test cache with the unsecure non-SSL port, run redis-cli.exe and pass your host name, port, and access key (primary or secondary) to connect to the test cache.

redis-cli.exe -h -p 6379 -a YourAccessKey

stunnel with redis-cli

Next steps

Learn more about using the Redis Console to issue commands.