...
where $AccessKey is the access key for the Azure blob container. $stringToSign is the signature string which depends on the type of operation.
Request to Azure
The request to the azure is used to invoke the call. This takes different types of URI for different operations. The URI depends on the type of operation we want to use in the request. The header used in the request are:
Code Block |
---|
'x-ms-blob-type' = 'BlockBlob'; `
'x-ms-date' = "$(Get-Date (Get-Date $Now).ToUniversalTime() -Format 'R')"; `
'x-ms-version' = $Version; `
'Authorization' = "SharedKey $($Account):$($Signature)" ` |
where header
x-ms-blob-type specifies the type of blob to create
- x-ms-date specifies the Coordinated Universal Time (UTC) for the request
- x-ms-version specifies the version of the operation to use for this request
- Authorization specifies the authorization scheme, account name, and signature
The details about the type of request in the operations are:
LIST BLOB
The request URI for the LIST BLOB includes just the container name. As the LIST operations lists all the blobs in the container. So the request URI will be https://$($ownerAccount).blob.core.windows.net/$($container)?restype=container&comp=list where $ownerAccount is the name of the Account and $container is the name of the container. The headers used by LIST BLOB operation are x-ms-blob-type, x-ms-date, x-ms-version, Authorization header.The request and header syntax for LIST BLOB will be:
Code Block title Syntax for LIST BLOB collapse true Request Syntax GET https://$($ownerAccount).blob.core.windows.net/$($container)?restype=container&comp=list Request Headers x-ms-blob-type: BlockBlob x-ms-date: <date> x-ms-version: $Version Authorization="SharedKey <AccountName>:<Signature>"
- GET BLOB
As the GET BLOB is used to read a blob so we need to pass the blob name also the URI. So the request URI for the GET BLOB will be https://$($ownerAccount).blob.core.windows.net/$($container)/$($blob) where $ownerAccount is the name of the Account and $container is the name of the container and $blob is the name of the blob which is to be read. The Get BLOB uses the same headers as LIST BLOB.The request and header syntax for GET BLOB will be:Code Block title Syntax for GET BLOB Request Syntax GET https://$($ownerAccount).blob.core.windows.net/$($container)/$($blob) Request Headers x-ms-blob-type: BlockBlob x-ms-date: <date> x-ms-version: $Version Authorization="SharedKey <AccountName>:<Signature>"
- PUT BLOB
The PUT BLOB operation is used to create a blob. So the URI for the PUT BLOB requires to pass the name of the blob to be created in the URI and also the content of the file which will be passed as a body to the request. So, the URI will be https://$($ownerAccount).blob.core.windows.net/$($container)/$($blob)where $ownerAccount is the name of the Account and $container is the name of the container and $blob is the name of the blob which is to be created in the container. The PUT BLOB uses the same headers.Code Block title Syntax for PUT BLOB Request Syntax PUT https://$($ownerAccount).blob.core.windows.net/$($container)/$($blob) Request Headers x-ms-blob-type: BlockBlob x-ms-date: <date> x-ms-version: $Version Authorization="SharedKey <AccountName>:<Signature>" Request Body: <Content of the File>