This is a sample To Do API written as .NET 6 Azure Function that uses the "v2" Cosmos DB bindings.
Coming soon...
Run the following script to assign your own Entra ID user principal (i.e., the one currently logged on to the Azure CLI) read and write privileges for Cosmos DB.
cosmos_contributor='00000000-0000-0000-0000-000000000002'
resource_group='<your-rg>'
cosmos_account='<your-cosmos-account>'
principal_id=$(az ad signed-in-user show --query id -o tsv)
az cosmosdb sql role assignment create \
--account-name "$cosmos_account" \
--resource-group "$resource_group \
--scope "/" \
--principal-id "$principal_id" \
--role-definition-id "$cosmos_contributor"
This script uses the predefined role Cosmos DB Built-in Data Contributor
.
See the documentation
for using a different or custom role to access Cosmos DB.
Coming soon...