Step 3 - Add secrets in Key Vault
    • PDF

    Step 3 - Add secrets in Key Vault

    • PDF

    Article summary

    Cosmos DB Connection Details

    To enable Constellations to access Cosmos DB, the connection string of the Cosmos DB should be created in the KeyVault

    • You can retrieve the connection string of the Cosmos DB (Cosmos DB compatible) through the Azure Portal or via the Azure CLI as shown in the example below. Just remember to enter your Cosmos DB account name and resource group. The command will provide a list of 4 connection strings. You may use any one of the first 2 connections strings. You cannot use the Read-Only connection strings.
    az cosmosdb keys list --type connection-strings --name "${cosmos_name}" -g "${rgp}"
    

    • Enter your connection string by replacing ${CosmosDB_connstring}, and enter your Key Vault by replacing ${kvname} (as below).
    az keyvault secret set --name "azure-cosmosdb-connectionstring" --vault-name "${kvname}" --value "${CosmosDB_connstring}"
    
    • Enter the Cosmos DB endpoint which is AccountEndpoint value from the connection string by replacing ${CosmosDB_endpoint}, and enter your Key Vault by replacing ${kvname} (as below).
    az keyvault secret set --name "azure-cosmosdb-accountendpoint" --vault-name "${kvname}" --value "${CosmosDB_endpoint}"
    
    • Enter the Cosmos DB name byreplacing ${cosmos_db_name}, and enter your Key Vault by replacing ${kvname} (as below).
    az keyvault secret set --name "azure-cosmosdb-databasename" --vault-name "${kvname}" --value "${cosmos_db_name}"
    
    • Enter the Cosmos DB private key which is AccountKey value from the connection string by replacing ${CosmosDB_primarykey}, and enter your Key Vault by replacing ${kvname} (as below).
    az keyvault secret set --name "azure-cosmosdb-primarykey" --vault-name "${kvname}" --value "${CosmosDB_primarykey}"
    


     


    Was this article helpful?