Skip to content

Conversation

Copy link

Copilot AI commented Nov 2, 2025

Adds support for using the Azure Rust SDK on wasm32-wasip2 target via wstd's wasi-http interface.

Implementation

Created wstd-azure crate following the pattern established in wstd-aws PR bytecodealliance#102, adapted for Azure SDK's architecture:

  • AsyncRuntime - Implements typespec_client_core::async_runtime::AsyncRuntime mapping to wstd's task spawning (wstd::runtime::spawn) and timing (wstd::task::sleep)
  • HttpClient - Implements typespec_client_core::http::HttpClient using wstd's wasi-http client, converting between Azure SDK types and wstd HTTP types

Key differences from AWS implementation:

  • Azure uses typespec_client_core traits vs AWS's aws-smithy traits
  • Duration conversion handles time crate types vs std::time::Duration
  • HTTP response uses BufResponse::from_bytes() vs streaming responses

Usage

use wstd_azure::{set_wstd_runtime, http_client};

#[wstd::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    set_wstd_runtime()?;
    
    let client = http_client();
    // Use client with Azure SDK service clients via .with_http_client(client)
    
    Ok(())
}

Changes

  • Added azure/ workspace member with lib, README, and example

  • Workspace dependencies: typespec_client_core, azure_core, azure_storage_blob (v0.6), async-trait

  • Returns error for unsupported HTTP methods instead of silent fallback

  • Fixes add wstd-azure crate #1

Original prompt

This section details on the original issue you should resolve

<issue_title>add wstd-azure crate</issue_title>
<issue_description>Create a wstd-azure crate following a structure similar to the wstd-aws crate:

There are two extension points that need to be implemented:

I created a working example of implementing both using the Spin SDK in

Instead of the Spin SDK, use wstd.
</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 5 commits November 2, 2025 20:41
Co-authored-by: cataggar <87583576+cataggar@users.noreply.github.com>
Co-authored-by: cataggar <87583576+cataggar@users.noreply.github.com>
Co-authored-by: cataggar <87583576+cataggar@users.noreply.github.com>
Co-authored-by: cataggar <87583576+cataggar@users.noreply.github.com>
Co-authored-by: cataggar <87583576+cataggar@users.noreply.github.com>
Copilot AI changed the title [WIP] Add wstd-azure crate with async runtime and http client Add wstd-azure crate for Azure SDK integration Nov 2, 2025
Copilot AI requested a review from cataggar November 2, 2025 20:57
@cataggar
Copy link
Owner

cataggar commented Nov 3, 2025

@copilot, change target branch to be wstd-azure.

Copy link
Author

Copilot AI commented Nov 3, 2025

@copilot, change target branch to be wstd-azure.

I cannot change the PR target branch directly as that's a GitHub interface setting. The target branch needs to be changed through the GitHub PR web interface. You can do this by:

  1. Going to the PR page on GitHub
  2. Clicking "Edit" next to the target branch name
  3. Selecting wstd-azure as the new target branch

The wstd-azure branch exists on the remote and the current changes should be compatible with it.

@cataggar cataggar changed the base branch from main to wstd-azure November 3, 2025 00:57
Cargo.toml Outdated
async-trait = "0.1"
axum = { version = "0.8.6", default-features = false }
azure_core = { version = "0.29", default-features = false }
azure_storage_blobs = { version = "0.21", default-features = false }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot this is the old crate. Instead, use azure_storage_blob. There are examples in the docs https://docs.rs/crate/azure_storage_blob/latest
There are also example to create a container and upload a blob in this test:
https://github.com/Azure/azure-sdk-for-rust/blob/main/sdk/storage/azure_storage_blob_test/src/lib.rs

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to use azure_storage_blob v0.6 instead of the deprecated azure_storage_blobs v0.21. Changes made in commit 1bacd67:

  • Workspace dependency updated in Cargo.toml
  • Dev-dependency updated in azure/Cargo.toml
  • Example documentation updated to reference the correct crate name

The code compiles successfully for both native and wasm32-wasip2 targets.

Co-authored-by: cataggar <87583576+cataggar@users.noreply.github.com>
Copilot AI requested a review from cataggar November 3, 2025 01:47
Copy link

@pchickey pchickey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like Copilot was able to do the easy part. This will need an integration test hooked up in test-programs/tests/azure_blob_storage.rs with the auth machinery working in CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add wstd-azure crate

3 participants