Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Prepare applications for Azure deployment by generating infrastructure code, Dockerfiles, and config files.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/services/cosmos-db/bicep.md
1# Cosmos DB Bicep Patterns23## Account45```bicep6resource cosmosAccount 'Microsoft.DocumentDB/databaseAccounts@2023-04-15' = {7name: '${resourcePrefix}-cosmos-${uniqueHash}'8location: location9kind: 'GlobalDocumentDB'10properties: {11databaseAccountOfferType: 'Standard'12locations: [13{14locationName: location15failoverPriority: 016isZoneRedundant: false17}18]19consistencyPolicy: {20defaultConsistencyLevel: 'Session'21}22capabilities: [23{24name: 'EnableServerless'25}26]27}28}29```3031## Database3233```bicep34resource cosmosDatabase 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases@2023-04-15' = {35parent: cosmosAccount36name: 'appdb'37properties: {38resource: {39id: 'appdb'40}41}42}43```4445## Container4647```bicep48resource cosmosContainer 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers@2023-04-15' = {49parent: cosmosDatabase50name: 'items'51properties: {52resource: {53id: 'items'54partitionKey: {55paths: ['/partitionKey']56kind: 'Hash'57}58indexingPolicy: {59indexingMode: 'consistent'60includedPaths: [61{ path: '/*' }62]63}64}65}66}67```6869## Autoscale Container7071```bicep72resource cosmosContainer 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers@2023-04-15' = {73parent: cosmosDatabase74name: 'items'75properties: {76resource: {77id: 'items'78partitionKey: {79paths: ['/partitionKey']80kind: 'Hash'81}82}83options: {84autoscaleSettings: {85maxThroughput: 400086}87}88}89}90```9192## Global Distribution9394```bicep95properties: {96locations: [97{98locationName: 'East US'99failoverPriority: 0100}101{102locationName: 'West US'103failoverPriority: 1104}105]106enableMultipleWriteLocations: true107}108```109