Actions8
Create Database
AI-generatedSummary
Operation: createDatabase. Creates a new Azure Cosmos DB database if it does not already exist. Uses newDatabaseName as the database ID and optionally sets provisioned throughput if >= 400 RU/s; otherwise leaves throughput to serverless or container-level. Returns success status, HTTP status code, database ID, effective throughput, and a message indicating whether the database was newly created or already existed.
Inputs
- newDatabaseName (required) — The name of the database to create.
- databaseThroughput — Provisioned throughput in Request Units per second (minimum 400). Set to 0 for serverless accounts or container-level throughput.
- authenticationType — The authentication method to use.
Output shape
object
The operation always returns success: true. If statusCode is 201 the message indicates new creation; otherwise the database already exists. throughput reflects the provided value or 'serverless/container-level'.
Examples
Example 1: Create a database with named throughput
newDatabaseName: my-db, databaseThroughput: 400 → creates database with 400 RU/s throughput, returns success and message 'Database 'my-db' created successfully'.
Example 2: Create database with serverless settings
newDatabaseName: my-db, databaseThroughput: 0 → creates database in serverless mode, returns success and message 'Database 'my-db' created successfully'.
Example 3: Idempotent re-run
newDatabaseName: my-db, databaseThroughput: 0 → database already exists, returns success with message 'Database 'my-db' already exists' and statusCode reflecting that outcome.