Skip to content

Latest commit

 

History

History
84 lines (54 loc) · 2.21 KB

File metadata and controls

84 lines (54 loc) · 2.21 KB

Insert an item into a SQL container

cosmosdb/insert-item-into-sql-container/README.md

Prerequisites

This example assumes you have previously completed the following examples:

  1. Create an Azure Resource Group
  2. Create an Azure Cosmos DB
  3. Create a SQL database
  4. Create a SQL container

Insert the item into the SQL container

First build using the following command line:

  mvn clean install

Second setup the environment variable needed for access:

  export COSMOSDB_ENDPOINT=$(az cosmosdb show --resource-group $RESOURCE_GROUP \
    --name $COSMOSDB_ACCOUNT_NAME --output tsv --query documentEndpoint)

  export COSMOSDB_MASTER_KEY=$(az cosmosdb keys list --name $COSMOSDB_ACCOUNT_NAME \
    --resource-group $RESOURCE_GROUP --output tsv --query primaryMasterKey)

Then execute the following command line:

  java -jar target/insert-item.jar

Cleanup

Do NOT forget to remove the resources once you are done running the example.

Additional documentation

  1. Azure Cosmos DB documentation

1m