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
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.
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.
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 also updates the Cosmos DB connection URI’s and key’s to the project’s App.config file
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:
- Working with Azure Storage Explorer for Azure Cosmos DB
- Connecting Azure Cosmos DB with Azure Storage Explorer by using Connection String
- Working with Azure Cosmos DB using Visual Studio Code
- Add an Azure Cosmos DB trigger to an existing Azure Function app from Azure Cosmos DB Portal
- Setting up global replication of your Azure Cosmos DB database using the Azure portal
- Setting up Failover Priorities for Azure Cosmos DB from Azure Portal
Hope this helps.