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 for Cosmos DB enables developers to easily connect and integrate with Cosmos DB. We have seen several connected services including Application Insights, Azure Storage and also for Mobile services. Similarly, you can connect Azure Cosmos DB accounts from Visual Studio using the Visual Studio Connected Services for Cosmos DB. Visual Studio Connected Services allows adding Cosmos DB account to your project and start building an application quickly.

Visual Studio Connected Services for Cosmos DB

Through the connected service, you can quickly create and query document. Also, you can create an Azure Cosmos DB account in Connected Service tool. First of all, 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
Visual Studio Connected Services for Cosmos DB

Cosmos DB Connected Services

At this point, 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 in the Azure subscription you are signed in for.

 

Visual Studio Connected Services for Cosmos DB

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” 

Exploring Connected Services Comos DB 

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

Visual Studio Connected Services for Cosmos DB : 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.

Visual Studio Connected Services for Azure Cosmos DB 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.

3 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

  3. Pingback: Azure key vault connected service in Visual Studio 2017

Comments are closed.