Skip to content

FIELDENG-593 Adding EntraID explainer to README #688

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,7 @@ validator
validators
virtualenv
http
AMR
EntraID
entraid
metamodel
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,36 @@ You can run these modules in your self-hosted Redis deployment, or you can use [

To learn more, read [our documentation](docs/redis_modules.md).

## Connecting to Azure Managed Redis with EntraID

Once you have EntraID setup for your Azure Managed Redis (AMR) deployment, you can use Redis OM Python with it by leveraging the [redis-py-entraid](https://github.com/redis/redis-py-entraid) library.
Simply install the library with:

```
pip install redis-entraid
```

Then you'll initialize your credentials provider, connect to redis, and pass the database object into your metamodel:

```python

from redis import Redis
from redis_entraid.cred_provider import create_from_default_azure_credential
from redis_om import HashModel, Field
credential_provider = create_from_default_azure_credential(
("https://redis.azure.com/.default",),
)

db = Redis(host="cluster-name.region.redis.azure.net", port=10000, ssl=True, ssl_cert_reqs=None, credential_provider=credential_provider)
db.flushdb()
class User(HashModel):
first_name: str
last_name: str = Field(index=True)

class Meta:
database = db
```

## ❤️ Contributing

We'd love your contributions!
Expand Down