Skip to content

Commit 277ed25

Browse files
slorello89abrookinsCopilot
authored
FIELDENG-593 Adding EntraID explainer to README (#688)
* Adding EntraID explainer to README --------- Co-authored-by: Andrew Brookins <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 233615b commit 277ed25

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

.github/wordlist.txt

+4
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,7 @@ validator
5656
validators
5757
virtualenv
5858
http
59+
AMR
60+
EntraID
61+
entraid
62+
metamodel

README.md

+30
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,36 @@ You can run these modules in your self-hosted Redis deployment, or you can use [
370370

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

373+
## Connecting to Azure Managed Redis with EntraID
374+
375+
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.
376+
Simply install the library with:
377+
378+
```
379+
pip install redis-entraid
380+
```
381+
382+
Then you'll initialize your credentials provider, connect to redis, and pass the database object into your metamodel:
383+
384+
```python
385+
386+
from redis import Redis
387+
from redis_entraid.cred_provider import create_from_default_azure_credential
388+
from redis_om import HashModel, Field
389+
credential_provider = create_from_default_azure_credential(
390+
("https://redis.azure.com/.default",),
391+
)
392+
393+
db = Redis(host="cluster-name.region.redis.azure.net", port=10000, ssl=True, ssl_cert_reqs=None, credential_provider=credential_provider)
394+
db.flushdb()
395+
class User(HashModel):
396+
first_name: str
397+
last_name: str = Field(index=True)
398+
399+
class Meta:
400+
database = db
401+
```
402+
373403
## ❤️ Contributing
374404

375405
We'd love your contributions!

0 commit comments

Comments
 (0)