Creating, reading, updating, and deleting data using the appropriate APIs
Before we can create, read, update, and delete data using the APIs, first, we need to create a Cosmos DB in Azure. We will do this in the following subsection.
Creating a Cosmos DB
You can create a Cosmos DB using the Azure portal, PowerShell, the CLI, or ARM templates. In this demonstration, we are going to create a Cosmos DB server, database, and container from the Azure portal. To do this, perform the following steps:
- Navigate to the Azure portal by going to https://portal.azure.com.
- Click Create a resource, type Azure Cosmos DB into the search bar, and create a new database server.
- Add the following values:
a) Subscription: Pick a subscription.
b) Resource group: Create a new one and call it
PacktCosmosResourceGroup
.c) Account name:
packtsqlapi
.d) API: Core (SQL).
e) Notebooks (preview): Off.
f) Location: East US.
g) Capacity mode: Provisioned throughput.
h) Apply Free Tier...