Skip to content

[storage] Add azure_storage_sas crate for User Delegation SAS generation#4462

Open
eureka-cpu wants to merge 1 commit into
Azure:mainfrom
eureka-cpu:eureka-cpu/4444
Open

[storage] Add azure_storage_sas crate for User Delegation SAS generation#4462
eureka-cpu wants to merge 1 commit into
Azure:mainfrom
eureka-cpu:eureka-cpu/4444

Conversation

@eureka-cpu
Copy link
Copy Markdown

@eureka-cpu eureka-cpu commented May 22, 2026

Closes #3330
Closes #4444

Adds a new crate which adds type safety to user delegation SAS URL generation for blob storage, files, queues and tables.

Copilot AI review requested due to automatic review settings May 22, 2026 22:50
@github-actions github-actions Bot added Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. Storage Storage Service (Queues, Blobs, Files) labels May 22, 2026
@github-actions
Copy link
Copy Markdown

Thank you for your contribution @eureka-cpu! We will review the pull request and get back to you soon.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown
Member

@heaths heaths left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution; however, there are a number of guideline violations in the public API. I'll let @vincenttran-msft and @jalauzon-msft review the Storage-specific functionality, but I don't think you need or should have your own errors. We have strict guidelines on those, and typically only add more specific errors if 1) they can yield more actionable information (we don't define error kinds just because it's useful; it's not helpful if you can't act on it when a message is sufficient), and 2) errors need to provide more structured information than the general azure_core::Error does. Storage already has its own error, for example, that - if necessary - could be put in azure_storage_common and that published going forward if they want to share it across crates.

Comment thread Cargo.toml
"sdk/canary/azure_canary",
"sdk/storage/azure_storage_blob",
"sdk/storage/azure_storage_queue",
"sdk/storage/azure_storage_sas"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Trailing comma.

@@ -0,0 +1,31 @@
#[derive(Debug, thiserror::Error)]
pub enum SasError {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We don't use thiserror. You should return azure_core::Error in most cases. If a subordinate crate has good reason to define it's own, it must still follow the guidelines for errors - no enums (they are problematic) - and be convertible to/from azure_core::Error.

reqwest = { workspace = true, default-features = false, features = ["json", "rustls"] }
quick-xml.workspace = true
serde.workspace = true
thiserror.workspace = true
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Don't use thiserror. Didn't even realize we had this. Will remove it.

Also, how are all these dependencies necessary? I don't see how serde and quick-xml are necessary. Even reqwest - which we cannot depend on unconditionally anyway - shouldn't be necessary to create a SAS URI.

Comment on lines +16 to +19
/// Re-export of the [`time`] crate.
pub use time;
/// Re-export of the [`url`] crate.
pub use url;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Both are already re-exported from azure_core and should not be here as well. Use them from azure_core, in fact, not from their original crates in case we ever re-implement them to add needed functionality we can't upstream.

/// }
/// ```
///
/// <https://learn.microsoft.com/en-us/rest/api/storageservices/create-user-delegation-sas>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

URLs should never have a locale in them. Covered in general guidelines.

Suggested change
/// <https://learn.microsoft.com/en-us/rest/api/storageservices/create-user-delegation-sas>
/// <https://learn.microsoft.com/rest/api/storageservices/create-user-delegation-sas>

@eureka-cpu
Copy link
Copy Markdown
Author

Much appreciated on the feedback @heaths! Thank you, I will fix these up shortly.

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

Labels

Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. Storage Storage Service (Queues, Blobs, Files)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

User Delegation SAS URL Builder sas URL creation

3 participants