Skip to content
Skillpedia
APIs & servers (backend)48k · #2326

azure-keyvault-keys-rust

Allows your agent to handle cryptographic keys in Azure Key Vault with Rust. It helps create, use, and manage keys.

What it does

This code helps securely manage cryptographic keys in Azure Key Vault using the Rust language. You can create, retrieve, delete, list, back up, and restore keys.

When to use it

  • ✓When you need to create new encryption keys in a secure vault.
  • ✓When you need to retrieve or delete existing keys.
  • ✓To perform cryptographic operations like signing or encrypting data using securely stored keys.

Example of what to ask your AI

“Create a 2048-bit RSA key named 'my-secure-key' in Azure Key Vault.”

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

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

Ready-to-paste message

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/azure-keyvault-keys-rust/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
How it works

The code connects to Azure Key Vault using authentication credentials. It then uses specific commands to perform actions like creating, reading, or deleting the cryptographic keys stored there.

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-keyvault-keys-rust

Or download just the file:

curl -L https://raw.githubusercontent.com/sickn33/agentic-awesome-skills/main/plugins/agentic-awesome-skills-claude/skills/azure-keyvault-keys-rust/SKILL.md -o SKILL.md
Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Azure Key Vault Keys SDK for Rust

Client library for Azure Key Vault Keys — secure storage and management of cryptographic keys.

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_security_keyvault_keys@=1.0.1 azure_identity@=1.0.0 azure_core@=1.1.0

Environment Variables

export AZURE_KEYVAULT_URL="https://<vault-name>.vault.azure.net/"

Authentication

use azure_identity::DeveloperToolsCredential;
use azure_security_keyvault_keys::KeyClient;

let credential = DeveloperToolsCredential::new(None)?;
let client = KeyClient::new(
    "https://<vault-name>.vault.azure.net/",
    credential.clone(),
    None,
)?;

Key Types

Type Description
RSA RSA keys (2048, 3072, 4096 bits)
EC Elliptic curve keys (P-256, P-384, P-521)
RSA-HSM HSM-protected RSA keys
EC-HSM HSM-protected EC keys

Core Operations

Get Key

let key = client
    .get_key("key-name", None)
    .await?
    .into_model()?;

println!("Key ID: {:?}", key.key.as_ref().map(|k| &k.kid));

Create Key

use azure_security_keyvault_keys::models::{CreateKeyParameters, KeyType};

let params = CreateKeyParameters {
    kty: Some(KeyType::Rsa),
    key_size: Some(2048),
    ..Default::default()
};

let key = client
    .create_key("key-name", params.try_into()?, None)
    .await?
    .into_model()?;

Create EC Key

use azure_security_keyvault_keys::models::{CreateKeyParameters, KeyType, CurveName};

let params = CreateKeyParameters {
    kty: Some(KeyType::Ec),
    curve: Some(CurveName::P256),
    ..Default::default()
};

let key = client
    .create_key("ec-key", params.try_into()?, None)
    .await?
    .into_model()?;

Delete Key

client.delete_key("key-name", None).await?;

List Keys

use azure_security_keyvault_keys::ResourceExt;
use futures::TryStreamExt;

let mut pager = client.list_key_properties(None)?;
while let Some(key) = pager.try_next().await? {
    let name = key.resource_id()?.name;
    println!("Key: {}", name);
}

Backup Key

let backup = client.backup_key("key-name", None).await?;
// Store backup.value safely

Restore Key

use azure_security_keyvault_keys::models::RestoreKeyParameters;

let params = RestoreKeyParameters {
    key_bundle_backup: backup_bytes,
};

client.restore_key(params.try_into()?, None).await?;

Cryptographic Operations

Key Vault can perform crypto operations without exposing the private key:

// For cryptographic operations, use the key's operations
// Available operations depend on key type and permissions:
// - encrypt/decrypt (RSA)
// - sign/verify (RSA, EC)
// - wrapKey/unwrapKey (RSA)

Best Practices

  1. Use Entra ID auth — DeveloperToolsCredential for dev, ManagedIdentityCredential for production
  2. Use HSM keys for sensitive workloads — hardware-protected keys
  3. Use EC for signing — more efficient than RSA
  4. Use envelope encryption — RSA can wrap a symmetric data key; do not encrypt arbitrary bulk data directly with RSA
  5. Backup keys — for disaster recovery
  6. Enable soft delete — required for production vaults
  7. Use key rotation — create new versions periodically

RBAC Permissions

Assign these Key Vault roles:

  • Key Vault Crypto User — use keys for crypto operations
  • Key Vault Crypto Officer — full CRUD on keys

The reviewed example set uses azure_security_keyvault_keys 1.0.1 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_security_keyvault_keys
Source Code https://github.com/Azure/azure-sdk-for-rust/tree/main/sdk/keyvault/azure_security_keyvault_keys
crates.io https://crates.io/crates/azure_security_keyvault_keys

When to Use

Use when a Rust application retrieves public key metadata or performs authorized Key Vault key creation, versioning, backup, restoration or cryptographic operations.

Limitations

…

FAQ

What types of keys can I create?

You can create RSA keys (for encryption and signing) and EC keys (elliptic curve, more efficient for signing), including hardware-protected (HSM) versions.

How does the code authenticate to Azure Key Vault?

It uses credentials, such as `DeveloperToolsCredential` for development or `ManagedIdentityCredential` for production, to prove your identity to Azure.

Can I use these keys to encrypt large files?

Envelope encryption is recommended: use an RSA key to encrypt a smaller symmetric key, then use that symmetric key to encrypt the large data. Do not encrypt bulk data directly with RSA.

Details

Original description by the author

Azure Key Vault Keys SDK for Rust. Use for creating, managing, and using cryptographic keys. Triggers: "keyvault keys rust", "KeyClient rust", "create key rust", "encrypt rust", "sign rust".

repo: sickn33/agentic-awesome-skills

Popularity

GitHub stars
48k
Ranking position
#2326
License
MIT
Updated
10/15/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills