azure-identity-rust
Allows your agent to authenticate to Azure services using Rust. It simplifies using different types of credentials.
What it does
This tool helps programs written in Rust securely connect to Microsoft Azure services. It manages how the program identifies itself and proves it has permission to access resources.
When to use it
- ✓When developing a Rust program that needs to access Azure locally.
- ✓When the program is already running on an Azure service (like virtual machines or web apps).
- ✓When configuring a program to use a 'service principal' with secrets or certificates to access Azure.
Example of what to ask your AI
“How do I get my Rust program to connect to Azure using my command-line credentials?”
Want more? Open the sections below.
How to use
The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.
Skill link
Ready-to-paste message
How it works
It tries various ways to prove the program's identity, starting with developer tools installed on your computer. If it can't find those, it can use identities configured directly in Azure or secrets you provide.
Installation
Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.
In the terminal (Claude Code, Codex, Cursor), in your project folder:
npx skills add sickn33/agentic-awesome-skills --skill azure-identity-rustOr download just the file:
curl -L https://raw.githubusercontent.com/sickn33/agentic-awesome-skills/main/plugins/agentic-awesome-skills-claude/skills/azure-identity-rust/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from GitHub.
Azure Identity SDK for Rust
Authentication library for Azure SDK clients using Microsoft Entra ID (formerly Azure AD).
The examples below require a reviewed compatible crate set and replacement of every resource placeholder. Do not use production data for demonstration writes.
Installation
cargo add azure_identity@=1.0.0 azure_core@=1.1.0
Environment Variables
# Service Principal (for production/CI)
export AZURE_TENANT_ID="<your-tenant-id>"
export AZURE_CLIENT_ID="<your-client-id>"
: "${AZURE_CLIENT_SECRET:?Inject through the approved host or CI secret manager}"
export AZURE_CLIENT_SECRET
# User-assigned Managed Identity (optional)
export AZURE_CLIENT_ID="<managed-identity-client-id>"
DeveloperToolsCredential
The recommended credential for local development. Tries developer tools in order (Azure CLI, Azure Developer CLI):
use azure_identity::DeveloperToolsCredential;
use azure_security_keyvault_secrets::SecretClient;
let credential = DeveloperToolsCredential::new(None)?;
let client = SecretClient::new(
"https://my-vault.vault.azure.net/",
credential.clone(),
None,
)?;
Credential Chain Order
| Order | Credential | Environment |
|---|---|---|
| 1 | AzureCliCredential | az login |
| 2 | AzureDeveloperCliCredential | azd auth login |
Credential Types
| Credential | Usage |
|---|---|
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) |
ManagedIdentityCredential
For Azure-hosted resources:
use azure_identity::{ManagedIdentityCredential, ManagedIdentityCredentialOptions, UserAssignedId};
// System-assigned managed identity
let credential = ManagedIdentityCredential::new(None)?;
// User-assigned managed identity
let options = ManagedIdentityCredentialOptions {
user_assigned_id: Some(UserAssignedId::ClientId("<user-assigned-mi-client-id>".into())),
..Default::default()
};
let credential = ManagedIdentityCredential::new(Some(options))?;
ClientSecretCredential
For service principal with secret:
use azure_identity::ClientSecretCredential;
let credential = ClientSecretCredential::new(
"<tenant-id>".into(),
"<client-id>".into(),
"<client-secret>".into(),
None,
)?;
Best Practices
- Use
DeveloperToolsCredentialfor local dev — automatically picks up Azure CLI - Use
ManagedIdentityCredentialin production — no secrets to manage - Clone credentials — credentials are
Arc-wrapped and cheap to clone - Reuse credential instances — same credential can be used with multiple clients
- Provide the async runtime — add Tokio with the features required by your application; do not assume a crate-specific
tokiofeature exists
The reviewed example set uses azure_identity 1.0.0 and compatible Azure core/credential crates. Record and commit Cargo.lock; source/API review is not a compiler or live-service test.
Reference Links
| Resource | Link |
|---|---|
| API Reference | https://docs.rs/azure_identity |
| Source Code | https://github.com/Azure/azure-sdk-for-rust/tree/main/sdk/identity/azure_identity |
| crates.io | https://crates.io/crates/azure_identity |
When to Use
Use when choosing or configuring Entra ID credentials for Rust Azure SDK clients: local developer tools, managed/workload identity or a reviewed service principal.
Limitations
- Examples are fragments inside async application code, with compatible pinned Azure crates and the required Tokio/Serde/Futures dependencies; verify the selected version’s API before use. They were reviewed against official source/reference, not compiled or run against a cloud account here.
…
FAQ
What's the best way to use it for local development?
Use `DeveloperToolsCredential`. It tries to use the Azure CLI or Azure Developer CLI, which you might already have set up for logging in.
What if my program is already running in Azure?
Use `ManagedIdentityCredential`. Azure itself handles the authentication without needing passwords or secrets.
Can I reuse the same authentication setup for multiple clients?
Yes, credentials are cheap to clone and can be used with multiple Azure clients.
Details
Original description by the author
Azure Identity SDK for Rust authentication. Use for DeveloperToolsCredential, ManagedIdentityCredential, ClientSecretCredential, and token-based authentication.
Popularity
- GitHub stars
- 48k
- Ranking position
- #2323
- License
- MIT
- Updated
- 10/15/2026
Comments
- …
More skills from this repository
00-andruia-consultant
Helps your agent start or improve AI projects. It analyzes code, suggests tools, and creates action plans in Spanish.
sickn33/agentic-awesome-skills
007
Lets your agent perform security audits and threat modeling. It's useful for protecting projects against attacks and vulnerabilities.
sickn33/agentic-awesome-skills
10-andruia-skill-smith
Helps your agent create or improve AI tools. It defines how tools work, writes documentation, and validates the structure.
sickn33/agentic-awesome-skills
20-andruia-niche-intelligence
Lets your agent create a summary about a specific industry. It's useful for understanding the context, rules, usage patterns, and risks of a project, using reliable sources.
sickn33/agentic-awesome-skills
Similar skills
api-connector-builder
Has your agent build new API connections following the existing pattern. Use when you need to add one more integration without creating a new way of doing things.
affaan-m/ECC
api-design
Helps your agent design REST APIs following best practices. It's useful for defining how APIs communicate, how errors are shown, and how to organize data.
affaan-m/ECC
backend-patterns
Helps your agent with server-side architecture patterns and database optimization. It's useful for building or reviewing code that runs on the server.
affaan-m/ECC