Langsung ke konten
Skillpedia
API & server (backend)48k · #3937

azure-identity-rust

Fungsinya

Tool ini membantu program yang ditulis dengan Rust untuk terhubung ke layanan Microsoft Azure secara aman. Tool ini mengatur bagaimana program mengenali dirinya sendiri dan membuktikan bahwa program tersebut punya izin untuk mengakses sumber daya.

Kapan dipakai

  • ✓Saat Anda mengembangkan program Rust yang perlu mengakses Azure dari komputer lokal.
  • ✓Saat program sudah berjalan di layanan Azure (seperti virtual machine atau web app).
  • ✓Saat Anda mengatur program untuk menggunakan 'service principal' dengan secret atau sertifikat untuk mengakses Azure.

Link skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/azure-identity-rust/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/azure-identity-rust/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit →

Contoh permintaan ke AI

“Bagaimana cara membuat program Rust saya terhubung ke Azure menggunakan kredensial command-line saya?”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Tool ini mencoba beberapa cara untuk membuktikan identitas program, dimulai dari tool developer yang terpasang di komputer Anda. Jika tidak menemukannya, tool ini bisa menggunakan identitas yang dikonfigurasi langsung di Azure atau secret yang Anda berikan.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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

  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. Provide the async runtime — add Tokio with the features required by your application; do not assume a crate-specific tokio feature 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.

…

Pertanyaan umum

Apa cara terbaik menggunakannya untuk pengembangan lokal?

Gunakan `DeveloperToolsCredential`. Tool ini mencoba menggunakan Azure CLI atau Azure Developer CLI, yang mungkin sudah Anda siapkan untuk proses login.

Bagaimana jika program saya sudah berjalan di Azure?

Gunakan `ManagedIdentityCredential`. Azure sendiri yang menangani autentikasi tanpa perlu password atau secret.

Apakah saya bisa menggunakan pengaturan autentikasi yang sama untuk beberapa client?

Bisa, kredensial mudah diduplikasi dan dapat digunakan dengan beberapa client Azure.

Detail

Deskripsi asli dari pembuat

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

repo: sickn33/agentic-awesome-skills

Popularitas

Bintang GitHub
48k
Peringkat
#3937
Lisensi
MIT
Diperbarui
15/10/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa