'Signature = Base64( HMAC-SHA1( YourSecretAccessKeyID,
UTF-8-Encoding-Of( StringToSign ) ) ) );
StringToSign = HTTP-VERB + "
Content-Encoding + "
Content-Language + "
Content-Length + "
Content-MD5 + "
Content-Type + "
Date + "
If-Modified-Since + "
If-Match + "
If-None-Match + "
If-Unmodified-Since + "
Range + "
CanonicalizedHeaders +
CanonicalizedResource;'

def _get_azure_auth_signature(self, method, headers, params, account, secret_key, path='/'):

    special_header_values = []
    xms_header_values = []
    param_list = []
    special_header_keys = ['content-encoding', 'content-language', 'content-length', 'content-md5', 'content-type', 'date', 'if-modified-since', 'if-match', 'if-none-match', 'if-unmodified-since', 'range']
    headers_copy = {}
    for (header, value) in headers.items():
        header = header.lower()
        value = str(value).strip()
        if header.startswith('x-ms-'):
            xms_header_values.append((header, value))
        else:
            headers_copy[header] = value
    for header in special_header_keys:
        header = header.lower()
        if (header in headers_copy):
            special_header_values.append(headers_copy[header])
        else:
            special_header_values.append('')
    values_to_sign = ([method] + special_header_values)
    xms_header_values.sort()
    for (header, value) in xms_header_values:
        values_to_sign.append(('%s:%s' % (header, value)))
    values_to_sign.append(('/%s%s' % (account, path)))
    for (key, value) in params.items():
        param_list.append((key.lower(), str(value).strip()))
    param_list.sort()
    for (key, value) in param_list:
        values_to_sign.append(('%s:%s' % (key, value)))
    string_to_sign = b('\n'.join(values_to_sign))
    secret_key = b(secret_key)
    b64_hmac = base64.b64encode(hmac.new(secret_key, string_to_sign, digestmod=sha256).digest())
    return ('SharedKey    %s:%s' % (self.user_id, b64_hmac.decode('utf-8')))
