Skip to content
azure-identity-rust logo

Azure Identity SDK for Rust

azure-identity-rust

Azure Identity SDK for Rust authentication. Use for DeveloperToolsCredential, ManagedIdentityCredential, ClientSecretCredential, and token-based authentication.

SKILL.md

Full skill instructions

Azure Identity SDK for Rust

Authentication library for Azure SDK clients using Microsoft Entra ID (formerly Azure AD).

Installation

cargo add azure_identity

Environment Variables

# Service Principal (for production/​CI)
AZURE_TENANT_ID=<your-tenant-id>
AZURE_CLIENT_ID=<your-client-id>
AZURE_CLIENT_SECRET=<your-client-secret>

# User-assigned Managed Identity (optional)
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

OrderCredentialEnvironment
1AzureCliCredentialaz login
2AzureDeveloperCliCredentialazd auth login

Credential Types

CredentialUsage
DeveloperToolsCredentialLocal development - tries CLI tools
ManagedIdentityCredentialAzure VMs, App Service, Functions, AKS
WorkloadIdentityCredentialKubernetes workload identity
ClientSecretCredentialService principal with secret
ClientCertificateCredentialService principal with certificate
AzureCliCredentialDirect Azure CLI auth
AzureDeveloperCliCredentialDirect azd CLI auth
AzurePipelinesCredentialAzure Pipelines service connection
ClientAssertionCredentialCustom assertions (federated identity)

ManagedIdentityCredential

For Azure-hosted resources:

use azure_identity::ManagedIdentityCredential;

// System-assigned managed identity
let credential = ManagedIdentityCredential::new(None)?;

// User-assigned managed identity
let options = ManagedIdentityCredentialOptions {
    client_id: Some("<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

  1. Use DeveloperToolsCredential for local dev — automatically picks up Azure CLI
  2. Use ManagedIdentityCredential in production — no secrets to manage
  3. Clone credentials — credentials are Arc-wrapped and cheap to clone
  4. Reuse credential instances — same credential can be used with multiple clients
  5. Use tokio feature — cargo add azure_identity --features tokio

Reference Links

When to Use

This skill is applicable to execute the workflow or actions described in the overview.

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.

More skills from sickn33

api-security-best-practices logo
sickn33/antigravity-awesome-skills

api-security-best-practices

Implement secure API design patterns including authentication, authorization, input validation, rate limiting, and protection against common API vulnerabilities

47.3K 7.4K
View
nextjs-best-practices logo
sickn33/antigravity-awesome-skills

nextjs-best-practices

Next.js App Router principles. Server Components, data fetching, routing patterns.

47.3K 5.7K
View
nextjs-supabase-auth logo
sickn33/antigravity-awesome-skills

nextjs-supabase-auth

Expert integration of Supabase Auth with Next.js App Router

47.3K 5.2K
View
browser-automation logo
sickn33/antigravity-awesome-skills

browser-automation

Browser automation powers web testing, scraping, and AI agent

47.3K 5.1K
View
prisma-expert logo
sickn33/antigravity-awesome-skills

prisma-expert

prisma expert

47.3K 3.6K
View
playwright-skill logo
sickn33/antigravity-awesome-skills

playwright-skill

playwright skill

47.3K 3.3K
View
game-development logo
sickn33/antigravity-awesome-skills

game-development

Game development orchestrator. Routes to platform-specific skills based on project needs.

47.3K 2.7K
View
mobile-design logo
sickn33/antigravity-awesome-skills

mobile-design

(Mobile-First · Touch-First · Platform-Respectful)

47.3K 2.6K
View
ui-ux-pro-max logo
sickn33/antigravity-awesome-skills

ui-ux-pro-max

ui ux pro max

47.3K 2.5K
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View