Skip to main content

Infrastructure

How to enable Redis for Next Auth

If you wish to use Redis for authentication, please ensure that the variables within ~/build/azDevOps/azure/pipeline-vars.yml relating to redis have been populated; see below for more details:

- name: create_redis
value: true
- name: redis_resource_group_name
value: yourRGName
- name: maxmemory_policy
value: allkeys-lru
- name: sku_name
value: Basic

To enable redis, create_redis must always be true. redis_resource_group_name should be an existing resource group that you wish for redis to be created in. maxmemory_policy and sku_name should be populated with your specific values, these values can be:

OptionDescriptionTypeAccepted ValuesDefaultComment
sku_nameThe SKU Redis will use, and the features includedstringThe provider to be installedBasicView all available options here
maxmemory_policyPolicy redis will enforce on data storedstring
  • volatile-lru: The default eviction policy. It removes the least recently used key out of all the keys with an expiration set.
  • allkeys-lru: Removes the least recently used key.
  • volatile-random: Removes a random key that has an expiration set.
  • allkeys-random: Removes a random key.
  • volatile-ttl: Removes the key with the shortest time to live based on the expiration set for it.
  • noeviction: No eviction policy. Returns an error message if you attempt to insert data.
  • volatile-lfu: Evicts the least frequently used keys out of all keys with an expire field set.
  • allkeys-lfu: Evicts the least frequently used keys out of all keys.
allkeys-lru