We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
List containers (buckets):
#!/bin/bash # List the blobs in an Azure storage container. echo "usage: ${0##*/} <storage-account-name> <container-name> <access-key>" storage_account="$1" access_key="$2" blob_store_url="blob.core.windows.net" authorization="SharedKey" request_method="GET" request_date=$(TZ=GMT LC_ALL=en_US.utf8 date "+%a, %d %h %Y %H:%M:%S %Z") #request_date="Mon, 18 Apr 2016 05:16:09 GMT" storage_service_version="2015-04-05" # HTTP Request headers x_ms_date_h="x-ms-date:$request_date" x_ms_version_h="x-ms-version:$storage_service_version" # Build the signature string canonicalized_headers="${x_ms_date_h}\n${x_ms_version_h}" canonicalized_resource="/${storage_account}/" string_to_sign="${request_method}\n\n\n\n\n\n\n\n\n\n\n\n${canonicalized_headers}\n${canonicalized_resource}\ncomp:list" # Decode the Base64 encoded access key, convert to Hex. decoded_hex_key="$(echo -n $access_key | base64 -d -w0 | xxd -p -c256)" # Create the HMAC signature for the Authorization header signature=$(printf "$string_to_sign" | openssl dgst -sha256 -mac HMAC -macopt "hexkey:$decoded_hex_key" -binary | base64 -w0) authorization_header="Authorization: $authorization $storage_account:$signature" curl \ -H "$x_ms_date_h" \ -H "$x_ms_version_h" \ -H "$authorization_header" \ -H "Content-Length: 0" \ "https://${storage_account}.${blob_store_url}/?comp=list"
List blobs (objects) in a container (bucket):
#!/bin/bash # List the blobs in an Azure storage container. echo "usage: ${0##*/} <storage-account-name> <container-name> <access-key>" storage_account="$1" container_name="$2" access_key="$3" blob_store_url="blob.core.windows.net" authorization="SharedKey" request_method="GET" request_date=$(TZ=GMT LC_ALL=en_US.utf8 date "+%a, %d %h %Y %H:%M:%S %Z") #request_date="Mon, 18 Apr 2016 05:16:09 GMT" storage_service_version="2015-04-05" # HTTP Request headers x_ms_date_h="x-ms-date:$request_date" x_ms_version_h="x-ms-version:$storage_service_version" # Build the signature string canonicalized_headers="${x_ms_date_h}\n${x_ms_version_h}" canonicalized_resource="/${storage_account}/${container_name}" string_to_sign="${request_method}\n\n\n\n\n\n\n\n\n\n\n\n${canonicalized_headers}\n${canonicalized_resource}\ncomp:list\nrestype:container" # Decode the Base64 encoded access key, convert to Hex. decoded_hex_key="$(echo -n $access_key | base64 -d -w0 | xxd -p -c256)" # Create the HMAC signature for the Authorization header signature=$(printf "$string_to_sign" | openssl dgst -sha256 -mac HMAC -macopt "hexkey:$decoded_hex_key" -binary | base64 -w0) authorization_header="Authorization: $authorization $storage_account:$signature" curl \ -H "$x_ms_date_h" \ -H "$x_ms_version_h" \ -H "$authorization_header" \ -H "Content-Length: 0" \ "https://${storage_account}.${blob_store_url}/${container_name}?comp=list&restype=container"
The text was updated successfully, but these errors were encountered:
fe49d91
No branches or pull requests
List containers (buckets):
List blobs (objects) in a container (bucket):
The text was updated successfully, but these errors were encountered: