Skip to content

Entra ID credentials provider implementation for Redis-py client

Notifications You must be signed in to change notification settings

redis-developer/redis-py-entraid

Repository files navigation

Installation

pip install redis-entraid

Usage

First you have to configure IdentityProvider, for this purpose there's 2 factory methods:

def create_provider_from_managed_identity(
        identity_type: ManagedIdentityType,
        resource: str,
        id_type: Optional[ManagedIdentityIdType] = None,
        id_value: Optional[str] = '',
        **kwargs
) -> EntraIDIdentityProvider

def create_provider_from_service_principal(
        client_credential,
        client_id: str,
        scopes: list = [],
        timeout: Optional[float] = None,
        token_kwargs: dict = {},
        **app_kwargs
) -> EntraIDIdentityProvider

This credential provider is running a scheduled background tasks to renew tokens, the specifics might be configured as well:

auth_config = TokenAuthConfig(idp)
cred_provider = EntraIdCredentialsProvider(auth_config)

To obtain token and run background task simply call:

# Sync
cred_provider.get_credentials()

# Async
await cred_provider.get_credentials_async()

About

Entra ID credentials provider implementation for Redis-py client

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages