Skip to content

Gov Cloud Redis Login #696

@Patrick-Davis-MSFT

Description

@Patrick-Davis-MSFT

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:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    Projects

    Status

    Pending Assignment

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions