Expand description
Minimal Azure Storage connection string parser and URL builder for Blob Storage.
This module intentionally avoids relying on the legacy Azure Storage SDK crates.
It extracts only the fields we need and composes container/blob URLs suitable
for the newer azure_storage_blob crate (>= 0.7).
Supported keys (case-insensitive):
- AccountName
- AccountKey
- SharedAccessSignature
- DefaultEndpointsProtocol
- EndpointSuffix
- BlobEndpoint
- UseDevelopmentStorage
- DevelopmentStorageProxyUri
Behavior
- If
BlobEndpointis present, it is used as the base for container/blob URLs. It may already include the account segment (e.g., Azurite: http://127.0.0.1:10000/devstoreaccount1). - Otherwise, if
UseDevelopmentStorage=true, we synthesize a dev endpoint:{protocol}://127.0.0.1:10000/{account_name}, withprotocoldefaulthttpif unspecified. IfDevelopmentStorageProxyUriis present, it replaces the host/port while still appending the account name path segment. - Otherwise, we synthesize the public cloud endpoint:
{protocol}://{account_name}.blob.{endpoint_suffix}whereendpoint_suffixdefaults tocore.windows.netandprotocoldefaults tohttps.
SAS handling
- If
SharedAccessSignatureexists, it will be appended to the generated URLs as a query string. Bothsv=...and?sv=...forms are accepted; the leading ‘?’ is normalized.
Examples:
-
Access key connection string: “DefaultEndpointsProtocol=https;AccountName=myacct;AccountKey=base64key==;EndpointSuffix=core.windows.net” Container URL: https://myacct.blob.core.windows.net/logs Blob URL: https://myacct.blob.core.windows.net/logs/file.txt
-
SAS connection string: “BlobEndpoint=https://myacct.blob.core.windows.net/;SharedAccessSignature=sv=2022-11-02&ss=b&…” Container URL (with SAS): https://myacct.blob.core.windows.net/logs?sv=2022-11-02&ss=b&... Blob URL (with SAS): https://myacct.blob.core.windows.net/logs/file.txt?sv=2022-11-02&ss=b&...
-
Azurite/dev storage: “UseDevelopmentStorage=true;DefaultEndpointsProtocol=http;AccountName=devstoreaccount1” Container URL: http://127.0.0.1:10000/devstoreaccount1/logs
Structs§
- Parsed
Connection String - A parsed Azure Storage connection string and helpers to compose URLs for containers/blobs.
Enums§
- Auth
- Represents the type of authentication present in the connection string.
- Connection
String Error - Errors that can occur while parsing a connection string or composing URLs.