title: How to setup Celery to talk ssl to Azure Redis Instance
body: <p>Using the great answer to "<a href="https://stackoverflow.com/questions/39616701/how-to-configure-celery-redis-in-django-project-on-microsoft-azure">How to configure celery-redis in django project on microsoft azure?</a>", I can configure Celery to use Azure Redis Cache using the <strong>non-ssl port, 6379</strong>, using the following Python code:</p>
  
  <pre><code>from celery import Celery
  # This one works
  url = 'redis://:&lt;access key&gt;@&lt;my server&gt;.redis.cache.windows.net:6379/0'
  # I want to use a url that specifies ssl like one of the following:
  # url = 'redis://:&lt;my key&gt;=@&lt;my server&gt;.redis.cache.windows.net:6380/0'
  # url = 'redis://:&lt;my key&gt;@&lt;my server&gt;.redis.cache.windows.net:6380/0?ssl=True'
  app = Celery('tasks', broker=url)
  
  @app.task
  def add(x, y):
      return x + y
  </code></pre>
  
  <p>However, I would like to have celery use ssl and communicate on <strong>port 3380 using ssl</strong> to the Azure Redis Cache.  If I change the port to 6380, I get an "Error while reading from socket" after a few minutes of waiting after running the following command:</p>
  
  <p><code>celery -A tasks worker --loglevel=INFO -Q "celery" -Ofair</code></p>
  
  <p>Does anyone know how to configure this, on the Celery or Azure side, so that I can have celery communicate on the default <strong>3380</strong> port on Azure Redis Cache using <strong>ssl</strong>?</p>
  
  <p>I am using the latest version of Celery (4.0.2)</p>
  
  <p>Note that code like the following works with no problem when connecting directly from a <strong>Linux client</strong> (on Azure) using port 3380 and ssl using Python's redis library:</p>
  
  <pre><code>import redis
  redis.StrictRedis(host='&lt;my host&gt;.redis.cache.windows.net', port=6380, db=0, password='&lt;my key&gt;', ssl=True)
  </code></pre>