BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Microsoft Officially Supports Rust on Azure with First SDK Beta

Microsoft Officially Supports Rust on Azure with First SDK Beta

Log in to listen to this article

Microsoft has released the first beta of its official Azure SDK for Rust, enabling Rust developers to interact with Azure services. The initial release includes libraries for essential components such as Identity, Key Vault (secrets and keys), Event Hubs, and Cosmos DB.

This move signifies Microsoft's recognition of the growing importance and adoption of the Rust programming language, both within the company and in the broader developer ecosystem. Rust is gaining popularity due to its performance, reliability, and memory safety features, making it well-suited for systems programming and high-performance applications. Its strong type system and ownership model help prevent common programming errors, leading to more secure and stable code. At the same time, its modern syntax and tooling contribute to a positive developer experience.

The beta SDK provides Rust developers with libraries designed to integrate with Rust's package management system (cargo) and coding conventions. The included libraries, known as "crates"  in the Rust ecosystem, can be added as dependencies to Rust projects using the cargo add command.

For example, to use the Identity and Key Vault Secrets libraries, they can run the following command:

cargo add azure_identity azure_security_keyvault_secrets tokio --features tokio/full

Next, the developer can import the necessary modules from the Azure SDK crates. The code for creating a new secret client using the DefaultAzureCredential would look like this:

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create a credential using DefaultAzureCredential
    let credential = DefaultAzureCredential::new()?;
    // Initialize the SecretClient with the Key Vault URL and credential
    let client = SecretClient::new(
        "https://your-key-vault-name.vault.azure.net/,"
        credential.clone(),
        None,
    )?;

    // Additional code will go here...

    Ok(())
}

After the Azure SDK release for Rust, Microsoft´s Cosmos DN team released the Azure Cosmos DB Rust SDK, which provides an idiomatic API for performing operations on databases, containers, and items. Theo van Kraay, a product maanger for Cosmos DB at Microsoft, wrote:

With its growing ecosystem and support for WebAssembly, Rust is increasingly becoming a go-to language for performance-critical workloads, cloud services, and distributed systems like Azure Cosmos DB.

While Microsoft is now officially entering the Rust cloud SDK space with this beta release, Amazon Web Services (AWS) already offers a mature and official AWS SDK for Rust. This SDK provides a comprehensive set of crates, each corresponding to an AWS service, allowing Rust developers to build applications that interact with the vast array of AWS offerings.

Looking ahead, Microsoft plans to expand the Azure SDK for Rust by adding support for more Azure services and refining the existing beta libraries. The goal is to stabilize these libraries and provide a robust and user-friendly experience. Future improvements are expected to include buffering entire responses in the pipeline to ensure consistent policy application (like retry policies) and deserializing arrays as empty Vec<T> in most cases to simplify code.

Lastly, developers interested in getting started with the Azure SDK for Rust can find detailed documentation, code samples, and installation instructions on the project's GitHub repository. They can also look for new releases from the SDK.

 

About the Author

BT