microsoft / microsoft/simplechat

Gov Cloud Redis Login

Open
#696 2 comments 0 reactions 0 assignees View on GitHub
documentation
Dominant language
Python
Stars
152
Forks
116
Avg merge
7h 7m
Merged PRs (30d)
122

Description

When Logging into redis in the file app_settings_cache.py on Azure Gov the following line throws an error preventing startup

`token = credential.get_token(cache_endpoint)`

In the code it is the following line:
``` python
def configure_app_cache(settings, redis_cache_endpoint=None):
global _settings, update_settings_cache, get_settings_cache, APP_SETTINGS_CACHE, app_cache_is_using_redis
_settings = settings
use_redis = _settings.get('enable_redis_cache', False)

if use_redis:
app_cache_is_using_redis = True
redis_url = settings.get('redis_url', '').strip()
redis_auth_type = settings.get('redis_auth_type', 'key').strip().lower()
if redis_auth_type == 'managed_identity':
print("[ASC] Redis enabled using Managed Identity")
credential = DefaultAzureCredential()
redis_hostname = redis_url.split('.')[0]
cache_endpoint = redis_cache_endpoint
token = credential.get_token(cache_endpoint)
redis_client = Redis(
host=redis_url,
port=6380,
db=0,
password=token.token,
ssl=True
)
```
Recommended Fix:

Add the Authority component to the default credential on the `credential = DefaultAzureCredential()` line.

Contributor guide

Open the contributing guide

Research direction

Start in app_settings_cache.py at configure_app_cache, especially the managed_identity branch and its DefaultAzureCredential() call. Check the Azure Gov credential configuration and verify the application can start with Redis managed-identity authentication without the get_token error.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, python, redis
Domain
authentication, backend, cloud
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.