Skip to content

Commit 70861f2

Browse files
authored
Update how-to-setup-rbac.md
Adding Cosmos Python ClientSecretCredential implementation now that it is live
1 parent 7d03a29 commit 70861f2

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 currently supported in the [Python SDK V4.3.0b4](sql-api-sdk-python.md).
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)