How to Write NoSQL Queries with Copilot for Azure Cosmos DB

This post has been republished via RSS; it originally appeared at: Microsoft Tech Community - Latest Blogs - .

If you are a student or an entrepreneurial developer who wants to build modern data applications using Azure Cosmos DB, you might be wondering how to write NoSQL queries to access your data. NoSQL queries are different from SQL queries in that they use a document-based structure instead of a relational schema. This can make them more flexible and scalable, but also more challenging to learn and write.


That’s why Microsoft has introduced Copilot for Azure Cosmos DB, an AI companion that simplifies how you work with Azure Cosmos DB. Copilot is an amazing AI-powered capability that can create Azure Cosmos DB NoSQL queries based on your natural language questions about your data.

Try Copilot.png

With Copilot, you don’t have to worry about the syntax or the structure of your NoSQL queries. Just type in your English-language question about your data and items in your Azure Cosmos DB collection, and Copilot will generate a query suggestion for you.


Every generated query suggestion also contains a natural language explanation of the query, which can help you to understand and validate the query generated by Copilot. This empowers you to quickly and easily access your data stored in Azure Cosmos DB, and also learn how to write NoSQL queries better.


Copilot is integrated with the Data Explorer’s query editor in the Azure portal. You can use it with any of your databases and collections that you have access to in Azure Cosmos DB, or you can use a sample database CopilotSampleDb from the SAMPLE DATA section to try it out. You can also provide feedback to the Copilot team by clicking on the thumbs up or thumbs down icons next to the suggestion. This will help inform the product team where the Copilot is performing well, and where there are opportunities for improvement.

Copilot is currently in public preview, which means you need to enable it by your Azure subscription’s administrator in the Subscription’s preview features control.


You can learn how to set up preview features in an Azure subscription here. Once you have enabled Copilot, you can follow these steps to use it:

  • Open the Azure portal and navigate to your Azure Cosmos DB NoSQL resource.
  • Navigate to the features blade under Settings and enable Copilot.
  • Navigate to the Data Explorer query editor within the NoSQL API.
  • Select the database and collection you’d like to query.
  • Click on the Copilot icon and start asking questions about your data. Copilot will enter query suggestions into the query editor pane where you can also copy, edit, or execute them.

That’s how you can use Copilot to query your data using natural language and learn how to write queries faster. Microsoft Copilot for Azure is an AI companion that unlocks the full power of Azure. We hope that Copilot will make your data querying experience more enjoyable and productive.

Azure Cosmos DB is a fully managed and serverless distributed database for modern app development, with SLA-backed speed and availability, automatic and instant scalability, and support for open-source PostgreSQL, MongoDB, and Apache Cassandra.

You can try Azure Cosmos DB for free here.

Discover Microsoft Copilot for Azure, an AI companion that simplifies how you work with Azure Cosmos DB. Learn how to write NoSQL queries using natural language and get query suggestions with explanations.

Try it now!

The following table lists the limits for the Try Azure Cosmos DB for Free trial.
Try Azure Cosmos DB free | Microsoft Learn

Resource Limit
Duration of the trial 30 days¹²
Maximum containers per subscription 1
Maximum throughput per container 5,000
Maximum throughput per shared-throughput database 20,000
Maximum total storage per account 10 GB

¹ A new trial can be requested after expiration. ² After expiration, the information stored in your account is

Learning Resources
Get started with Azure Cosmos DB for NoSQL - Training | Microsoft Learn
Execute queries in Azure Cosmos DB for NoSQL - Training | Microsoft Learn

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.