Chuyển đến nội dung
Skillpedia
API và máy chủ (backend)48k · #3994

azure-storage-blob-rust

Skill này làm gì

Công cụ này giúp các chương trình viết bằng Rust lưu và lấy các tệp (gọi là “blob”) trong dịch vụ lưu trữ đám mây Azure của Microsoft. Bạn có thể dùng nó để tải lên, tải xuống và quản lý các tệp này.

Khi nào nên dùng

  • ✓Khi chương trình của bạn cần lưu một tệp lớn lên đám mây.
  • ✓Khi chương trình của bạn cần tải về một tệp đã được lưu trên đám mây.
  • ✓Khi chương trình của bạn cần liệt kê hoặc xóa tệp ở một vị trí cụ thể trên đám mây.

Liên kết skill

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

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/azure-storage-blob-rust/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Làm sao để chương trình Rust của tôi tải một tệp lên Azure Blob Storage?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Chương trình dùng một “thư viện” đặc biệt (SDK) để giao tiếp với Azure. Nó cần thông tin truy cập, sau đó dùng các lệnh cụ thể để tải lên, tải xuống hoặc quản lý tệp.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Azure Blob Storage SDK for Rust

Client library for Azure Blob Storage — Microsoft's object storage solution for the cloud.

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

Environment Variables

export AZURE_STORAGE_ACCOUNT_NAME="<storage-account-name>"
# Endpoint: https://<account>.blob.core.windows.net/

Authentication

use azure_identity::DeveloperToolsCredential;
use azure_core::http::Url;
use azure_storage_blob::clients::{BlobClient, BlobClientOptions};

let credential = DeveloperToolsCredential::new(None)?;
let blob_client = BlobClient::new(
    Url::parse("https://<account>.blob.core.windows.net/container-name/blob-name")?,
    Some(credential),
    Some(BlobClientOptions::default()),
)?;

Client Types

Client Purpose
BlobServiceClient Account-level operations, list containers
BlobContainerClient Container operations, list blobs
BlobClient Individual blob operations

Core Operations

Upload Blob

use azure_core::http::RequestContent;
use azure_storage_blob::models::BlobClientUploadOptions;

let data = b"hello world";
blob_client
    .upload(
        RequestContent::from(data.to_vec()),
        Some(BlobClientUploadOptions::if_not_exists()), // fail rather than overwrite an existing blob
    )
    .await?;

Download Blob

let response = blob_client.download(None).await?;
// Check the approved size before fetching; use download_into with a bounded buffer for large data.
let content = response.body.collect().await?;
// Process authorized bytes; do not log the payload.

Get Blob Properties

let properties = blob_client.get_properties(None).await?;
// Read the version-specific response header trait; properties is a response, not a content_length field.
// Do not infer a body/size limit from successful metadata access alone.

Delete Blob

blob_client.delete(None).await?;

Container Operations

use azure_storage_blob::clients::BlobContainerClient;
use futures::TryStreamExt;

let container_client = BlobContainerClient::new(
    Url::parse("https://<account>.blob.core.windows.net/container-name")?,
    Some(credential),
    None,
)?;

// Create container
container_client.create(None).await?;

// List blobs
let mut pager = container_client.list_blobs(None)?;
while let Some(page) = pager.try_next().await? {
    let listing = page.into_model()?;
    // Process this listing page; apply an explicit maximum-page budget.
}

Best Practices

  1. Use Entra ID auth — DeveloperToolsCredential for dev, ManagedIdentityCredential for production
  2. Review overwrite behavior — the reviewed upload API uses options; if_not_exists prevents unintended replacement
  3. Use RequestContent::from() — to wrap upload data
  4. Handle async operations — use tokio runtime
  5. Check RBAC permissions — ensure "Storage Blob Data Contributor" role

RBAC Permissions

For Entra ID auth, assign one of these roles:

  • Storage Blob Data Reader — read-only
  • Storage Blob Data Contributor — read/write
  • Storage Blob Data Owner — blob-data access and supported ownership/ACL management; it does not grant general Azure RBAC role-assignment authority

The example API follows BlobClient 1.1.0; earlier releases used different constructor/upload signatures. Use the project’s compatible Azure crate versions rather than mixing them.

The reviewed example set uses azure_storage_blob 1.1.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_storage_blob
Source Code https://github.com/Azure/azure-sdk-for-rust/tree/main/sdk/storage/azure_storage_blob
crates.io https://crates.io/crates/azure_storage_blob

When to Use

Use when a Rust application uploads/downloads a specified Azure blob, reads its properties or manages an authorized container.

Limitations

…

Câu hỏi thường gặp

“Blob” là gì?

“Blob” chỉ là thuật ngữ kỹ thuật cho một tệp được lưu trên Azure, như ảnh, tài liệu hoặc bất kỳ loại dữ liệu nào khác.

“Cloud storage” nghĩa là gì?

Đó là nơi lưu trữ tệp trên các máy tính từ xa (máy chủ) mà bạn truy cập qua internet, thay vì lưu trên máy tính của bạn.

Tôi có cần biết lập trình Azure để dùng công cụ này không?

SDK này dành cho người đã biết lập trình Rust. Nó đơn giản hóa việc làm việc với Azure, nhưng bạn vẫn cần hiểu cơ bản về cách Azure hoạt động và lập trình Rust.

Chi tiết

Mô tả gốc của tác giả

Azure Blob Storage SDK for Rust. Use for uploading, downloading, and managing blobs and containers.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#3994
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự