Last active
October 3, 2021 15:49
-
-
Save cdennig/de95d6f614e607fcbbffcdd0d0b5842e to your computer and use it in GitHub Desktop.
Cosmos RBAC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var location = resourceGroup().location | |
var dbName = 'rbacsample' | |
var containerName = 'data' | |
// Cosmos DB Account | |
resource cosmosDbAccount 'Microsoft.DocumentDB/databaseAccounts@2021-06-15' = { | |
name: 'cosmos-${uniqueString(resourceGroup().id)}' | |
location: location | |
kind: 'GlobalDocumentDB' | |
properties: { | |
consistencyPolicy: { | |
defaultConsistencyLevel: 'Session' | |
} | |
locations: [ | |
{ | |
locationName: location | |
failoverPriority: 0 | |
} | |
] | |
capabilities: [ | |
{ | |
name: 'EnableServerless' | |
} | |
] | |
disableLocalAuth: true | |
databaseAccountOfferType: 'Standard' | |
enableAutomaticFailover: true | |
publicNetworkAccess: 'Enabled' | |
} | |
} | |
// Cosmos DB | |
resource cosmosDbDatabase 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases@2021-06-15' = { | |
name: '${cosmosDbAccount.name}/${dbName}' | |
location: location | |
properties: { | |
resource: { | |
id: dbName | |
} | |
} | |
} | |
// Data Container | |
resource containerData 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers@2021-06-15' = { | |
name: '${cosmosDbDatabase.name}/${containerName}' | |
location: location | |
properties: { | |
resource: { | |
id: containerName | |
partitionKey: { | |
paths: [ | |
'/partitionKey' | |
] | |
kind: 'Hash' | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment