Skip to content

This sample shows you how get started quickly with Microsoft Azure Cosmos DB, using the SQL API and .NET.

License

Notifications You must be signed in to change notification settings

Azure-Samples/cosmos-dotnet-v4-getting-started

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

languages products page_type description
csharp
azure
azure-cosmos-db
dotnet
sample
This sample shows you how to use the Azure Cosmos DB service to store and access data from a .NET console application.

Developing a .NET console app using Azure Cosmos DB

This sample shows you how to use the Azure Cosmos DB service to store and access data from a .NET console application.

For a complete end-to-end walkthrough of creating this application, please refer to the full tutorial on the Azure Cosmos DB documentation page.

Running this sample

  1. Before you can run this sample, you must have the following prerequisites:

  2. Clone this repository, or download the zip file.

  3. Browse to the src folder.

  4. Run dotnet build to restore all packages.

  5. Retrieve the URI and PRIMARY KEY (or SECONDARY KEY) values from the Keys blade of your Azure Cosmos DB account in the Azure portal. For more information on obtaining endpoint & keys for your Azure Cosmos DB account refer to View, copy, and regenerate access keys and passwords. If you are using the Emulator, you can also use its credentials.

  6. In the Program.cs file, located in the src directory, find EndPointUri and AuthorizationKey and replace the placeholder values with the values obtained for your account.

    private const string EndpointUrl = "https://<your-account>.documents.azure.com:443/";

    private const string AuthorizationKey = "<your-account-key>";
  1. You can now run the application with dotnet run.

About the code

The code included in this sample is intended to get you quickly started with a .NET console application that connects to Azure Cosmos DB.

More information

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

About

This sample shows you how get started quickly with Microsoft Azure Cosmos DB, using the SQL API and .NET.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages