Azure / azure-sdk-for-python

This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/python/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-python.
MIT License
4.63k stars 2.84k forks source link

Expose `signed_version` in `generate_container_sas` #38636

Open janjagusch opened 16 hours ago

janjagusch commented 16 hours ago

Is your feature request related to a problem? Please describe.

As a user, I want to specify the signed version of my SAS tokens. Currently, this SDK does not expose an obvious way to do this:

generate_container_sas does not expose a signed_version: https://github.com/Azure/azure-sdk-for-python/blob/a71376d5d0942c08f431178c40ec230d851f54a0/sdk/storage/azure-storage-blob/azure/storage/blob/_shared_access_signature.py#L429-L442

BlobSharedAccessSignature does not expose a signed_version in its constructor. Instead, it always uses ._shared.constants import X_MS_VERSION: https://github.com/Azure/azure-sdk-for-python/blob/a71376d5d0942c08f431178c40ec230d851f54a0/sdk/storage/azure-storage-blob/azure/storage/blob/_shared_access_signature.py#L36-L52

This is my current workaround:

sas = BlobSharedAccessSignature(...)
# Note: You currently cannot set the `x_ms_version` in the `BlobSharedAccessSignature` constructor.
sas.x_ms_version = signed_version
sas_token = sas.generate_container(...)

Describe the solution you'd like

My preferred solution would be:

sas_token = generate_container_sas(signed_version=signed_version, ...)
github-actions[bot] commented 16 hours ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jalauzon-msft @vincenttran-msft.