Skip to content
This repository has been archived by the owner on Oct 6, 2020. It is now read-only.

Support emulator connections with sas tokens #314

Closed

Conversation

perfectayush
Copy link

Creating a draft request to address #310. This modifies Client::from_connection_string function to create development storage clients access with SAS tokens.

Example usage:

fn abs_emulator_client_sas(sas_token: &str) -> Result<KeyClient,AzureError> {
    let connection_string = format!("DefaultEndpointsProtocol=http; \
                                     AccountName=devstoreaccount1; \
                                     BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1; \
                                     TableEndpoint=http://127.0.0.1:10002/devstoreaccount1; \
                                     UseDevelopmentStorage=true; \
                                     SharedAccessSignature=?{};",
                                     sas_token);
    return Client::from_connection_string(&connection_string)
}

This code is tested against Azurite. The SAS token client is able to list objects if it is correctly generated. Have to prefix SAS token with ? in connection_string for now as it is parsed with url::Url::query_pairs in get_sas_token_parms

Ayush Goyal added 2 commits July 14, 2020 01:57
Add support for creating azure storage clients without account_key using SAS
credentials. This is useful for emulating a few production usecases when
developing against azurite with SAS auth.
If the value for a connection string key includes '=',  it's not parsed
correctly. This is an issue specifically with SAS tokens
@MindFlavor
Copy link
Owner

@perfectayush: please note we are migrating this repo here: https://github.com/Azure/azure-sdk-for-rust so I have to close this. Please feel free to reopen this PR at the new repo!

@MindFlavor MindFlavor closed this Oct 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants