Azure Identity Rust
MicrosoftOfficialCreated by Microsoft
- Skill
- Tool integration
- Software development
- MIT
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
The azure-identity-rust skill provides the official mechanism for Rust developers to authenticate against Azure services. It supports various credential types, including managed identities for production environments and developer tools for local workflows. The library is designed to work seamlessly with the broader Azure SDK for Rust, ensuring secure and standardized access to cloud resources.
What it does
- Provides authentication mechanisms for Azure SDK clients in Rust.
- Supports local development via DeveloperToolsCredential (Azure CLI and azd).
- Enables production authentication using ManagedIdentityCredential.
- Handles service principal authentication via secrets or certificates.
- Facilitates secure integration with Azure services like Key Vault.
- Offers specialized credential types for Kubernetes and CI/CD pipelines.
When to use it
- When building Rust applications that need to interact with Azure cloud services.
- When you need to switch between local development and production authentication flows.
- When implementing service principal authentication for automated CI/CD pipelines.
- When deploying Rust services to Azure-hosted environments like AKS, VMs, or App Service.
Advantages
- Official Microsoft-supported library for the Rust ecosystem.
- Thread-safe credential handling via Arc-wrapped types.
- Supports a wide range of authentication scenarios including workload identity.
- Clear separation between local development and production credential types.
Usage examples
- “How do I authenticate a Rust application locally using Azure CLI?”
- Use the DeveloperToolsCredential in your code, which automatically attempts to authenticate using your active Azure CLI or Azure Developer CLI session.
- “What is the production equivalent of DefaultAzureCredential in Rust?”
- Rust does not have a single DefaultAzureCredential type. You should use DeveloperToolsCredential for local development and ManagedIdentityCredential for production environments.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/microsoft/azure-identity-rust/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip azure-identity-rust.zip -d .agents/skills
Documentation by Microsoft
Azure Identity library for Rust
Microsoft Entra ID authentication for Azure SDK clients.
Use this skill when:
An app needs to authenticate to Azure services from Rust
You need
DeveloperToolsCredentialfor local developmentYou need
ManagedIdentityCredentialfor Azure-hosted workloadsYou need service principal auth with secret or certificate
IMPORTANT: Only use official
azure_*crates published by the azure-sdk crates.io user. Do NOT use the deprecatedazure_sdk_*crates (MindFlavor/AzureSDKForRust) or community crates. Official crates use underscores in names and none have version 0.21.0.
Note: The Rust SDK does not have
DefaultAzureCredential. UseDeveloperToolsCredentialfor local development andManagedIdentityCredentialfor production.
// Incorrect in Rust: this type does not exist in azure_identity
use azure_identity::DefaultAzureCredential;Installation
cargo add azure_identity azure_core tokioIf your code uses
azure_coretypes directly, addazure_coretoCargo.toml. If you only use service-crate re-exports, directazure_coredependency is optional.
Environment Variables
AZURE_TENANT_ID=<your-tenant-id> # Required for service principal auth
AZURE_CLIENT_ID=<your-client-id> # Required for service principal or user-assigned managed identity
AZURE_CLIENT_SECRET=<your-client-secret> # Required for ClientSecretCredentialAuthentication
DeveloperToolsCredential (Local Development)
Tries Azure CLI then Azure Developer CLI:
use azure_identity::DeveloperToolsCredential;
use azure_security_keyvault_secrets::SecretClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Local dev: DeveloperToolsCredential. Production: use ManagedIdentityCredential.
let credential = DeveloperToolsCredential::new(None)?;
let client = SecretClient::new(
"https://<vault-name>.vault.azure.net/",
credential.clone(),
None,
)?;
let secret = client.get_secret("secret-name", None).await?.into_model()?;
println!("Secret: {:?}", secret.value);
Ok(())
}Ensure you are logged in:
az login # Azure CLI
azd auth login # or Azure Developer CLI| Order | Credential | Login Command |
|---|---|---|
| 1 | AzureCliCredential | az login |
| 2 | AzureDeveloperCliCredential | azd auth login |
ManagedIdentityCredential (Production)
For Azure-hosted resources (VMs, App Service, Functions, AKS):
use azure_identity::ManagedIdentityCredential;
// System-assigned managed identity
let credential = ManagedIdentityCredential::new(None)?;ClientSecretCredential (Service Principal)
For CI/CD pipelines and service accounts:
use azure_identity::ClientSecretCredential;
let credential = ClientSecretCredential::new(
"<tenant-id>",
"<client-id>",
"<client-secret>",
None,
)?;Credential Types
| Credential | Use Case |
|---|---|
DeveloperToolsCredential | Local development — tries CLI tools |
ManagedIdentityCredential | Azure VMs, App Service, Functions, AKS |
WorkloadIdentityCredential | Kubernetes workload identity |
ClientSecretCredential | Service principal with secret |
ClientCertificateCredential | Service principal with certificate |
AzureCliCredential | Direct Azure CLI auth |
AzureDeveloperCliCredential | Direct azd CLI auth |
AzurePipelinesCredential | Azure Pipelines service connection |
ClientAssertionCredential | Custom assertions (federated identity) |
Best Practices
Use
cargo addto manage dependencies, never editCargo.tomldirectly. Add and remove Rust SDK dependencies with cargo commands instead of manual manifest edits.Add
azure_coreonly when importingazure_coretypes directly. If your code importsazure_core::http::Url,azure_core::http::RequestContent, orazure_core::error::ErrorKind, includeazure_core; otherwise a direct dependency is optional.Use
DeveloperToolsCredentialfor local dev,ManagedIdentityCredentialfor production — Rust does not provide a singleDefaultAzureCredentialtypeNever hardcode credentials — use environment variables for service principals
Clone credentials — pass
credential.clone()when constructing multiple clients; credentials areArc-wrappedReuse clients — clients are thread-safe; create once, share across tasks
Assign RBAC roles — ensure the identity has appropriate roles for the target service (e.g., "Key Vault Secrets User" for secret reads)
Run
cargo clippy -- -D warningswhen the prompt, eval, or CI expects lint-clean output; Rust trajectory graders can fail on style lints even after compiler errors are fixedFuture-proof
#[non_exhaustive]SDK models — when constructing SDK model/options structs, end the initializer with..Default::default()(add#[allow(clippy::needless_update)]) and use a_wildcard arm when matching SDK enums, so new service-added fields/variants don't break your build
Reference Links
| Resource | Link |
|---|---|
| API Reference | https://docs.rs/azure_identity/latest/azure_identity |
| crates.io | https://crates.io/crates/azure_identity |
| Source Code | https://github.com/Azure/azure-sdk-for-rust/tree/main/sdk/identity/azure_identity |
Files
- ATTRIBUTION.mdAdded by AutoGineer964 B
- LICENSELicence file added by AutoGineer1.1 KiB
- SKILL.md6.2 KiB
LICENSE
MIT License
Copyright (c) Microsoft Corporation.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARERequirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs a command-line tool
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- Microsoft
- Publisher
- Microsoft (Official)
- Source
- microsoft/skills · .github/plugins/azure-sdk-rust/skills/azure-identity-rust · commit 0696600
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Microsoft or Microsoft.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download azure-identity-rust.zip