Skip to content

Latest commit

 

History

History
35 lines (24 loc) · 1.77 KB

File metadata and controls

35 lines (24 loc) · 1.77 KB

CosmosDB RBAC Demo

This sample is used in the following blog entries to elaborate interaction with RBAC configured Cosmos DB.

How to use

Functions

  • Create Azure function app before deployment.
  • Modify pom-ro.xml and pom-rw.xml following your environment.
  • Build read-only app and read-write app.
mvn clean package azure-functions:deploy -f pom-ro.xml
mvn clean package azure-functions:deploy -f pom-rw.xml
  • Enable system assigned identity in each Function app.

Cosmos DB

ROprincipalId='<Principal ID for ReadOnly app>'
az cosmosdb sql role assignment create -a $accountName -g $resourceGroupName -s "/" -p $ROprincipalId -d $builtInReadOnlyRoleDefinitionId

RWprincipalId='<Principal ID for ReadWrite app>'
az cosmosdb sql role assignment create -a $accountName -g $resourceGroupName -s "/" -p $RWprincipalId -d $builtInReadWriteRoleDefinitionId