Visual FoxPro
Visual FoxPro
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 Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loRest
LOCAL lnBTls
LOCAL lnBAutoReconnect
LOCAL loAzAuth
LOCAL lcResponseText
lnSuccess = 0
loRest = CreateObject('Chilkat.Rest')
lnBTls = 1
lnBAutoReconnect = 1
lnSuccess = loRest.Connect("example.com",443,lnBTls,lnBAutoReconnect)
IF (lnSuccess = 0) THEN
? loRest.LastErrorText
RELEASE loRest
CANCEL
ENDIF
* Configure Azure Storage Shared Key authentication. Provide the account name, base64 account
* access key, service, and (optionally) the x-ms-version.
loAzAuth = CreateObject('Chilkat.AuthAzureStorage')
loAzAuth.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.
loAzAuth.AccessKey = "BASE64_ACCOUNT_ACCESS_KEY"
loAzAuth.Scheme = "SharedKey"
loAzAuth.Service = "Blob"
loAzAuth.XMsVersion = "2021-08-06"
* Associate the provider so Chilkat automatically adds the Shared Key Authorization header.
lnSuccess = loRest.SetAuthAzureStorage(loAzAuth)
IF (lnSuccess = 0) THEN
? loRest.LastErrorText
RELEASE loRest
RELEASE loAzAuth
CANCEL
ENDIF
lcResponseText = loRest.FullRequestNoBody("GET","/mycontainer?restype=container&comp=list")
IF (loRest.LastMethodSuccess = 0) THEN
? loRest.LastErrorText
RELEASE loRest
RELEASE loAzAuth
CANCEL
ENDIF
? lcResponseText
RELEASE loRest
RELEASE loAzAuth