https://github.com/azurecosmosdb/management-sdk-samples
Repository of Azure Management SDK samples for creating and updating Azure Cosmos DB resources in C#, Python, JavaScript and Java
https://github.com/azurecosmosdb/management-sdk-samples
Last synced: 4 months ago
JSON representation
Repository of Azure Management SDK samples for creating and updating Azure Cosmos DB resources in C#, Python, JavaScript and Java
- Host: GitHub
- URL: https://github.com/azurecosmosdb/management-sdk-samples
- Owner: AzureCosmosDB
- License: mit
- Created: 2024-09-27T17:15:56.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2026-01-11T13:50:00.000Z (5 months ago)
- Last Synced: 2026-01-11T17:29:21.828Z (5 months ago)
- Language: C#
- Size: 76.2 KB
- Stars: 0
- Watchers: 3
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
- Support: SUPPORT.md
Awesome Lists containing this project
README
# Azure Management SDK Samples for Azure Cosmos DB
This repository contains Azure Management SDK samples for Azure Cosmos DB to create and update Azure Cosmos DB resources through its resource provider (control plane). Azure resource providers are used to provision and manage resources in Azure.
The samples can be used to support users who are adopting Microsoft Entra ID and disabling key-based access to their data, and want to manage their Cosmos resources using an SDK rather than using Bicep templates, PowerShell, or Azure CLI.
## Resource Operations
These samples demonstrate create or update operations on the following Cosmos DB resources, including:
- Accounts:
- Serverless, IP firewall rules, and disabling local auth (key-based data plane access) to force Entra ID for Auth-N and role-based access control (RBAC) for Auth-Z
- Databases
- Containers:
- Hierarchical partition keys, index policies, unique keys, TTL, conflict resolution policies, autoscale throughput
- Throughput
- Update autoscale or manual throughput
- RBAC definitions:
- Creating a built-in definition, creating a custom RBAC definition
- RBAC assignments
The samples also include some other handy conveniences for developers working with Cosmos resources including:
- Getting your IP address to add to a Firewall Rule, add Portal Access and Azure data center access
- Getting your principal id for RBAC assignments
## Languages available
The samples are available in 5 languages including:
- [C#](/Csharp/README.md)
- [Python](/Python/README.md)
- [Go](/Go/README.md)
- [Java](/Java/readme.md)
- [JavaScript](/JavaScript/README.md)
## VS Code debugging (recommended)
This repo contains samples in multiple languages/frameworks. Use the `*.code-workspace` files at the repo root to open and debug a single language sample at a time.
Each workspace file opens only that language's folder (for example, `Python.code-workspace` opens `Python/`). This keeps debug configuration, settings, and environment-file handling isolated per sample.
To avoid VS Code debug adapter errors when you don't have every language extension installed, open the workspace file for the language you're working on:
- [Python.code-workspace](Python.code-workspace)
- [Csharp.code-workspace](Csharp.code-workspace)
- [Go.code-workspace](Go.code-workspace)
- [Java.code-workspace](Java.code-workspace)
- [JavaScript.code-workspace](JavaScript.code-workspace)
### How to open a workspace file
In VS Code:
1. Use **File → Open Workspace from File…**
2. Pick the `*.code-workspace` file you want (for example, `Python.code-workspace`).
Then use **Run and Debug** (or press **F5**) to start that sample.
Notes:
- Opening the repo as a normal folder is fine for browsing, but the run/debug configurations are intentionally isolated per language workspace file.
- If you switch between languages, just open the other workspace file.
## Azure Management SDK source code repositories
All Azure Management SDKs are open source. For more information and the source for the underlying Azure Management SDKs, visit their GitHub repositories.
- [C#](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/cosmosdb/Azure.ResourceManager.CosmosDB)
- [Python](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cosmos/azure-mgmt-cosmosdb)
- [Go](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/cosmos/armcosmos)
- [Java](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/resourcemanager/azure-resourcemanager-cosmos)
- [JavaScript](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/cosmosdb/arm-cosmosdb)
## How to file issues and get help
Azure Management SDKs are fully supported by Microsoft. For issues related to them, please open a support ticket. GitHub issues in this repository are not the correct channel for support.
For questions, feature requests or issues related to just the samples themselves, please use GitHub Issues.
Please search the existing issues before filing new ones to avoid duplicates.
## 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](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](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
## Trademarks
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
Any use of third-party trademarks or logos are subject to those third-party's policies.