Develop application with Azure Redis cache in local

11 Feb 2023

Azure Redis Cache offers distributed, in-memory cache for faster data access for applications that run from multiple machines but depend on shared data. It avoids repeated data fetch from slow external sources like APIs or databases by storing it on the super-fast, low latency, in-memory cache source.


When multiple developers are working from their local machines connecting to a shared Redis cache, it can lead to strange data fetch-related errors. e.g., one of the developers may suddenly decide to flush all keys to test his feature or introduce a structural change to the cached data. This dependency requires the developers to repeatedly communicate with others before any cache-related changes or flush operation which causes unnecessary productivity hurdles. 

Other Azure resources like Azure Files, Blobs, Table, Queues, CosmosDB, etc., are provided with local emulators that address such issues. If you are expecting a similar local emulator for Azure Cache - you'll be disappointed to see there is none provided by Microsoft. Also, you can see Microsoft's official stance in the following document;

Microsoft has suggested an alternative option in the above FAQ page using MSOpenTech version of redis-server.exe. But that project seems pretty old, unmaintained - probably has multiple outstanding security & functionality bugs that keep piling-up as it remains Outdated. 

If you are happy with the above warnings and want a quick way to run Redis server locally, then MsOpenTech redis server exe might be your preferred solution. But if you are part of organisation that requires the development tools to be regularly updated with security patches and tested, then you won't be allowed to run that old executable file.

Another option would be to shell out additional cost for purchasing other commercial services for offline development seats, that would solve the problem. 

If you are not ready with the above options, then read through the rest of the article to run local in a recommended and cost-effective way.


Redis is an Open-Source project that is built to run on Linux machines. Hold on! I'm not recommending you to switch from windows-based IDE tool chain to Linux 😄

Windows offers WSL (Windows Subsystem for Linux) that allows you to run Linux packages within a Windows machine. It is much smaller in size and achieves virtualization with less-overhead compared to typical full-fledged Virtual machines image. WSL, WSLg is enough for most of our development needs that involve running Linux based packages/tools. 

Let me take through quick steps in setting it up in your local windows machine

1. Search for Turn Windows feature on or off and select the following highlighted features in the dialog

enable wsl2 dependent features on

2. Open command prompt in administrator mode, and run following script to make sure dependent packages are installed and updated to latest WSL version by running 

wsl --install
wsl --update

Above command will install the latest default Ubuntu within your WSL environment.  You can also check for other distributions, install them, and set them as default later.

 3. Now search and launch the Ubuntu terminal from the windows start

4. Try to ping some external domain from the Ubuntu terminal using ping

If you see an issue resolving the specified domain or see unknown host.
Then find "/etc/resolv.conf" and specify the nameserver for DNS resolution as (Cloudflare) or (Google). This should address the DNS issue.

Warning: Don't try to modify any files within WSL from File explorer, as this can corrupt the underlying LSXX filesystem. So, edit the file from the editors within Ubuntu terminal.

# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false


5. Now, it's time to setup our Linux based Redis server package. Run following script from the Ubuntu terminal

curl -fsSL | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg

echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list

sudo apt-get update
sudo apt-get install redis

The above script just adds a package source verified by the keyring, downloads the package, and finally installs it.

6. You can start the Redis server by running following

sudo service redis-server start

7. Verify the Redis installation by launching the "redis-cli" from the Ubuntu terminal.
Type "Ping" and on enter it should echo "Pong"

That's all, now you can configure the local redis( in your application connection strings. 

Happy Hacking!!! ✨


Install Redis on Windows | Redis