Azure Cosmos DB for Rust
A practical guide to building Rust applications with the official Azure Cosmos DB NoSQL client.
The skill restricts use to the official azure_data_cosmos crate, rejects unofficial community crates, and recommends managed identity, environment variables, and RBAC, reducing credential and dependency risk. It lacks user confirmation for CRUD/deletion, finer least-privilege guidance, data-flow disclosure, and rollback guidance, so points are deducted.
Installation, authentication, client hierarchy, and CRUD examples cover the main path, with Result-based error propagation. However, there are no committed tests specific to this skill, no version pinning, abnormal-input handling, or diagnosable failure guidance, and compile correctness of some API calls cannot be established statically; the score is conservatively limited.
The name, audience, Rust/Cosmos DB use cases, and trigger phrases are reasonably clear, covering document CRUD, containers, and partition keys. Non-fit boundaries, input/output boundaries, query or pagination scenarios, and Chinese-language or mainland-China network fit are not documented, so points are deducted.
The document has clear sections for installation, environment variables, authentication, client hierarchy, examples, best practices, license metadata, and reference links. It lacks an SDK version policy, changelog, explicit maintenance/update path, troubleshooting guidance, and broader complete examples, so it does not merit full marks.
The material gives a directly useful starting point for common Cosmos DB Rust CRUD work and includes patch operations, key authentication, and RBAC guidance. Static evidence does not verify that representative snippets run, and query, pagination, recovery, and production-configuration details are missing, so additional review and rework may be needed.
The skill supplies docs.rs, crates.io, and Azure SDK source references and identifies the official crate source. It provides no skill-specific tests or committed execution results, and the supplied repository-level test material does not cover this path's key behavior, leaving evidence coverage limited.
- This is a static source review; cargo builds, examples, and tests were not executed.
- The deletion example causes external data changes but provides no confirmation, backup, or recovery workflow.
- Reference links and dependency versions are not pinned; the current azure_data_cosmos API and release should be checked before use.
- The skill does not address mainland-China reachability of Azure services, crates.io, or docs.rs, or provide alternatives.
What it does & when to use it
This skill is for Rust developers working with Azure Cosmos DB through its NoSQL API. It covers the CosmosClient hierarchy and document create, read, update, delete, and patch operations with partition keys. It also explains Entra ID and account-key authentication, built-in RBAC roles, regional routing, and client reuse. It fits application-level Cosmos DB development, but does not provide infrastructure provisioning, deployment, or a dedicated Rust test suite.
It guides an agent to install azure_data_cosmos, azure_identity, serde, serde_json, and tokio, configure COSMOS_ENDPOINT, and generate Rust authentication code using DeveloperToolsCredential or ManagedIdentityCredential. It demonstrates creating a CosmosClient, obtaining database and container clients, and performing item CRUD and patch operations with partition keys. It also documents the key_auth feature, Cosmos DB built-in data roles, ProximityTo routing, and the distinction between the official crate and named unofficial alternatives.
- A Rust developer needs to store or read documents in an Azure Cosmos DB NoSQL container.
- A team needs item create, update, query, or delete flows that consistently supply partition keys.
- A project needs DeveloperToolsCredential for local development and managed identity for production.
- An application needs account-key authentication as an alternative to Entra ID.
- A globally distributed application needs proximity-based regional routing for lower latency.
Pros & cons
- Includes copyable Cargo commands and Rust examples for authentication, client construction, and CRUD.
- Clearly identifies the official azure_data_cosmos crate and warns about named unofficial crates.
- Covers Entra ID, account keys, RBAC, partition keys, and regional routing.
- Released under the MIT license as part of Microsoft's open Agent Skills repository.
- The source provides no dedicated Rust test scenarios or Rust-specific coverage evidence.
- It focuses on client usage rather than provisioning Cosmos DB accounts, databases, or containers.
- Successful operation depends on a configured endpoint, valid authentication, and correct partition keys.
- No specific azure_data_cosmos version is stated.
How to install
Install the collection with npx skills add microsoft/skills, then select this skill in the wizard. The README says skills are installed into the selected agent directory, such as .github/skills/ for GitHub Copilot; the source skill is .github/plugins/azure-sdk-rust/skills/azure-cosmos-rust/SKILL.md. Add project dependencies with cargo add azure_data_cosmos azure_identity serde serde_json tokio. If the code imports azure_core types directly, also run cargo add azure_core.
How to use
In an Agent Skills-compatible coding agent, use a prompt such as: “Implement Rust document CRUD for Cosmos DB with CosmosClient and a partition key” or “Configure key_auth for a Rust Cosmos DB project.” Set COSMOS_ENDPOINT=https://<account>.documents.azure.com/, use the official azure_data_cosmos crate, and avoid azure_cosmos and azure_sdk_for_rust.
Compared to similar skills
The skill presents account-key authentication as an optional alternative to Entra ID and recommends DeveloperToolsCredential locally and ManagedIdentityCredential in production. It explicitly distinguishes the official azure_data_cosmos crate from the unofficial azure_cosmos and azure_sdk_for_rust crates.