Skip to content

Commit 66268ce

Browse files
authored
Merge pull request #91210 from simorenoh/patch-1
[Cosmos] Update how-to-setup-rbac.md for Python
2 parents 77e78da + 47bc4b0 commit 66268ce

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

articles/cosmos-db/how-to-setup-rbac.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ The way you create a `TokenCredential` instance is beyond the scope of this arti
350350
- [In .NET](/dotnet/api/overview/azure/identity-readme#credential-classes)
351351
- [In Java](/java/api/overview/azure/identity-readme#credential-classes)
352352
- [In JavaScript](/javascript/api/overview/azure/identity-readme#credential-classes)
353+
- [In Python](/python/api/overview/azure/identity-readme?view=azure-python#credential-classes)
353354

354355
The examples below use a service principal with a `ClientSecretCredential` instance.
355356

@@ -397,6 +398,18 @@ const client = new CosmosClient({
397398
});
398399
```
399400

401+
### In Python
402+
403+
The Azure Cosmos DB RBAC is supported in the [Python SDK versions 4.3.0b4](sql-api-sdk-python.md) and higher.
404+
405+
```python
406+
aad_credentials = ClientSecretCredential(
407+
tenant_id="<azure-ad-tenant-id>",
408+
client_id="<client-application-id>",
409+
client_secret="<client-application-secret>")
410+
client = CosmosClient("<account-endpoint>", aad_credentials)
411+
```
412+
400413
## Authenticate requests on the REST API
401414

402415
When constructing the [REST API authorization header](/rest/api/cosmos-db/access-control-on-cosmosdb-resources), set the **type** parameter to **aad** and the hash signature **(sig)** to the **oauth token** as shown in the following example:

0 commit comments

Comments
 (0)