VBScript
VBScript
Configure Azure Storage Shared Key Authentication
See more REST Examples
Demonstrates Rest.SetAuthAzureStorage, which associates an AuthAzureStorage provider so Chilkat automatically adds a Shared Key Authorization header. The provider supplies the account name, base64 account key, service, and scheme.
Background. Azure Storage Shared Key authorization signs each request with the account access key. The provider also manages the
x-ms-version header required by the storage REST API.Chilkat VBScript Downloads
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)
success = 0
set rest = CreateObject("Chilkat.Rest")
bTls = 1
bAutoReconnect = 1
success = rest.Connect("example.com",443,bTls,bAutoReconnect)
If (success = 0) Then
outFile.WriteLine(rest.LastErrorText)
WScript.Quit
End If
' Configure Azure Storage Shared Key authentication. Provide the account name, base64 account
' access key, service, and (optionally) the x-ms-version.
set azAuth = CreateObject("Chilkat.AuthAzureStorage")
azAuth.Account = "myStorageAccount"
' Normally you would not hard-code secrets in source. You should instead obtain them from an
' interactive prompt, environment variable, or a secrets vault.
azAuth.AccessKey = "BASE64_ACCOUNT_ACCESS_KEY"
azAuth.Scheme = "SharedKey"
azAuth.Service = "Blob"
azAuth.XMsVersion = "2021-08-06"
' Associate the provider so Chilkat automatically adds the Shared Key Authorization header.
success = rest.SetAuthAzureStorage(azAuth)
If (success = 0) Then
outFile.WriteLine(rest.LastErrorText)
WScript.Quit
End If
responseText = rest.FullRequestNoBody("GET","/mycontainer?restype=container&comp=list")
If (rest.LastMethodSuccess = 0) Then
outFile.WriteLine(rest.LastErrorText)
WScript.Quit
End If
outFile.WriteLine(responseText)
outFile.Close