table azure_config {
"azure_account_key": "YOUR-ACCOUNT-KEY-HERE",
"azure_account_name": "YOUR-ACCOUNT-NAME-HERE",
"azure_blob_container" : "BLOB-CONTAINER-NAME-HERE"
}
sub create_azure_authorization_header {
declare local var.azure_account_name STRING;
declare local var.azure_account_key STRING;
declare local var.azure_blob_container STRING;
declare local var.decoded_access_key STRING;
declare local var.canonical_headers STRING;
declare local var.canonical_resource STRING;
declare local var.string_to_sign STRING;
declare local var.hmac_base64 STRING;
if (!) {
set var.azure_account_name = table.lookup(azure_config,"azure_account_name", "");
set var.azure_account_key = table.lookup(azure_config,"azure_account_key", "");
set var.azure_blob_container = table.lookup(azure_config,"azure_blob_container", "missing-container");
set = table.lookup(azure_config,"azure_api_version","2017-11-09");
set = now;
set var.decoded_access_key = digest.base64_decode(var.azure_account_key);
set var.canonical_headers = "x-ms-date:" + + "%0A" + "x-ms-version:" + + "%0A";
set var.canonical_resource = "/" + var.azure_account_name + "/" + var.azure_blob_container + bereq.url;
set var.string_to_sign = "GET" + std.strrep(LF, 4) + var.canonical_headers + var.canonical_resource;
set var.hmac_base64 = digest.hmac_sha256_base64(var.decoded_access_key, var.string_to_sign);
set = "SharedKeyLite " + var.azure_account_name + ":" + var.hmac_base64;
set bereq.url = "/" + var.azure_blob_container + bereq.url;
}
}