Quickly connect Azure Cosmos DB with your applications using Visual Studio Connected Services

By | February 21, 2018

Add Connected Services for Cosmos DB

Visual Studio Connected Services enables developers to easily connect and integrate with several services. We have seen several connected services including Application Insights, Azure Storage, Mobile services etc. Similarly, you can connect Azure Cosmos DB accounts from Visual Studio using the connected services. Visual Studio Connected Services allows adding Cosmos DB account to your project and start building application quickly.

Through the connected service, you can quickly create and query document. You can also create an Azure Cosmos DB account in Connected Service tool.  To connect Azure Cosmos DB with your Visual Studio project

  • Create a new project / open an existing project in Visual Studio.
  • Select the Connected Services option by right clicking on References -> Connected Services
Cosmos DB Connected Services

Cosmos DB Connected Services

If you don’t find the Azure Cosmos DB Connected services, search & Install it in Visual Studio Marketplace. You can achieve that through either via clicking “find more services” options or navigating to “Extension & Updates” option from the Tools Menu.

Related Post : Connecting Azure Storage Using Add Connected Services in Visual Studio 2015

Once you have the “Azure Cosmos DB” service installed / available, select it.  You will find your all Azure Cosmos DB services are listed for the Azure subscription your are signed in for.


Azure Cosmos DB Services

Azure Cosmos DB Services

Choose the specific Azure Cosmos DB account to add to your project and select the “Add” button.

You can also add a new Cosmos DB Account from this wizard by selecting “Create a New Cosmos DB Account” 

 Visual Studio will now add all the necessary files in your project and download all the required NuGet packages to work with.  

Added Cosmos DB in Projects

Visual Studio also updates the Cosmos DB connection URI’s and key’s to the project’s App.config file


App Config for Cosmos DB

App Config for Cosmos DB

That’s it. And with that, your project is ready to connect and work with Cosmos DB. You can include the Microsoft.Azure.Documents.Client namespace in your application and start working your Cosmos DB API’s


We will explore more on programming with Cosmos DB API in a separate post.

Azure Cosmos DB Connected services tools provide some additional features including creating new documents and work with Azure CosmosDB resources.  Go ahead, install and start exploring this tool.

Other Tips Related to Azure Cosmos DB:

Hope this helps.


Author: Abhijit Jana

Abhijit runs the Daily .NET Tips. He started this site with a vision to have a single knowledge base of .NET tips and tricks and share post that can quickly help any developers . He is a Former Microsoft ASP.NET MVP, CodeProject MVP, Mentor, Speaker, Author, Technology Evangelist and presently working as a .NET Consultant. He blogs at http://abhijitjana.net , you can follow him @AbhijitJana . He is the author of book Kinect for Windows SDK Programming Guide.

2 thoughts on “Quickly connect Azure Cosmos DB with your applications using Visual Studio Connected Services

  1. Pingback: Dew Drop - February 21, 2018 (#2669) - Morning Dew

  2. Pingback: Azure Weekly: Feb. 26, 2018 – Build Azure

Leave a Reply