Sample code for 30+ languages & platforms
AutoIt Requires Chilkat v11.6.0+

Azure Table: Create a Read-Only Table Service SAS

See more Azure Table Service Examples

Generates a short-lived HTTPS-only account-key service SAS for ExampleCustomers, restricted to one partition and the inclusive lexical row range customer-001 through customer-099. Includes Table-specific spk/srk/epk/erk fields, lowercase canonical table name and tn. It grants entity reads, not table creation/deletion or policy administration. Respect stricter account SAS-expiration policies.

Writes a token without a leading question mark to private table-sas.txt, replacing a prior token. Anyone holding it can exercise its permissions until expiry; do not log it. This is an account-key Table service SAS, not a Blob user-delegation SAS.

Targets Azure Storage Table service in the public cloud, not Azure Cosmos DB for Table. Uses Chilkat 11.6.0 or later and an unlocked library. Direct data requests pin x-ms-version 2026-04-06 and OData 3.0. Shared Key examples read private qa_data/azure/storage.json with account and access_key string fields. Authentication examples explain their additional fields. Create private local directories before running; keep credentials, tokens, SAS, entity values, checkpoints and diagnostics outside public content and source control.

HTTPS certificates are verified. Transport completion and HTTP status are checked separately. Writes are not automatically retried after an uncertain outcome. Entity keys, ETags and continuation tokens remain strings. Examples operate on the existing ExampleCustomers table unless noted; review the targets before adapting them. Microsoft Entra ID with suitable Table data roles is preferred where available.

Microsoft reference.

Chilkat AutoIt Downloads

AutoIt
Local $bSuccess = False

;  StringBuilder compares text by value in every generated language.
$oTextCompare = ObjCreate("Chilkat.StringBuilder")
;  Assumes Chilkat is unlocked. See Global Unlock Sample.
$bSuccess = False
$oConfig = ObjCreate("Chilkat.JsonObject")
$oConfig.Strict = True
$bSuccess = $oConfig.LoadFile("qa_data/azure/storage.json")
If ($bSuccess <> True) Then
    ConsoleWrite("Could not load private Azure configuration." & @CRLF)
    Exit
EndIf

$oTextCompare.Clear 
$oTextCompare.SetString($oConfig.StringOf("account"))
Local $bSameText1 = $oTextCompare.ContentsEqual("",True)
If (($oConfig.JsonTypeOf("account") <> 1) Or ($bSameText1 = True)) Then
    ConsoleWrite("Supply the storage account name." & @CRLF)
    Exit
EndIf

;  access_key is the base64 account key, not a connection string or SAS.
$oTextCompare.Clear 
$oTextCompare.SetString($oConfig.StringOf("access_key"))
Local $bSameText2 = $oTextCompare.ContentsEqual("",True)
If (($oConfig.JsonTypeOf("access_key") <> 1) Or ($bSameText2 = True)) Then
    ConsoleWrite("Supply the base64 account access key." & @CRLF)
    Exit
EndIf

$oSas = ObjCreate("Chilkat.AuthAzureSAS")
$oSas.AccessKey = $oConfig.StringOf("access_key")
$oSas.StringToSign = "sp,st,se,resource,si,sip,spr,sv,spk,srk,epk,erk"
$oCanonical = ObjCreate("Chilkat.StringBuilder")
$bSuccess = $oCanonical.Append("/table/")
If ($bSuccess <> True) Then
    ConsoleWrite("Could not prepare the request." & @CRLF)
    Exit
EndIf

$bSuccess = $oCanonical.Append($oConfig.StringOf("account"))
If ($bSuccess <> True) Then
    ConsoleWrite("Could not prepare the request." & @CRLF)
    Exit
EndIf

$bSuccess = $oCanonical.Append("/examplecustomers")
If ($bSuccess <> True) Then
    ConsoleWrite("Could not prepare the request." & @CRLF)
    Exit
EndIf

$bSuccess = $oSas.SetNonTokenParam("resource",$oCanonical.GetAsString())
If ($bSuccess <> True) Then
    ConsoleWrite("Could not prepare the request." & @CRLF)
    Exit
EndIf

;  Canonicalized table name must be lowercase. tn belongs in the token, not StringToSign.
$oStart = ObjCreate("Chilkat.CkDateTime")
$oExpiry = ObjCreate("Chilkat.CkDateTime")
$bSuccess = $oStart.SetFromCurrentSystemTime()
If ($bSuccess <> True) Then
    ConsoleWrite("Could not prepare the request." & @CRLF)
    Exit
EndIf

$bSuccess = $oExpiry.SetFromCurrentSystemTime()
If ($bSuccess <> True) Then
    ConsoleWrite("Could not prepare the request." & @CRLF)
    Exit
EndIf

$bSuccess = $oStart.AddSeconds(-300)
If ($bSuccess <> True) Then
    ConsoleWrite("Could not prepare the request." & @CRLF)
    Exit
EndIf

$bSuccess = $oExpiry.AddSeconds(900)
If ($bSuccess <> True) Then
    ConsoleWrite("Could not prepare the request." & @CRLF)
    Exit
EndIf

$bSuccess = $oSas.SetTokenParam("tn","tn","examplecustomers")
If ($bSuccess <> True) Then
    ConsoleWrite("Could not prepare the request." & @CRLF)
    Exit
EndIf

$bSuccess = $oSas.SetTokenParam("sp","sp","r")
If ($bSuccess <> True) Then
    ConsoleWrite("Could not prepare the request." & @CRLF)
    Exit
EndIf

$bSuccess = $oSas.SetTokenParam("st","st",$oStart.GetAsTimestamp(False))
If ($bSuccess <> True) Then
    ConsoleWrite("Could not prepare the request." & @CRLF)
    Exit
EndIf

$bSuccess = $oSas.SetTokenParam("se","se",$oExpiry.GetAsTimestamp(False))
If ($bSuccess <> True) Then
    ConsoleWrite("Could not prepare the request." & @CRLF)
    Exit
EndIf

$bSuccess = $oSas.SetTokenParam("spr","spr","https")
If ($bSuccess <> True) Then
    ConsoleWrite("Could not prepare the request." & @CRLF)
    Exit
EndIf

$bSuccess = $oSas.SetTokenParam("sv","sv","2026-04-06")
If ($bSuccess <> True) Then
    ConsoleWrite("Could not prepare the request." & @CRLF)
    Exit
EndIf

$bSuccess = $oSas.SetTokenParam("spk","spk","customers-west")
If ($bSuccess <> True) Then
    ConsoleWrite("Could not prepare the request." & @CRLF)
    Exit
EndIf

$bSuccess = $oSas.SetTokenParam("epk","epk","customers-west")
If ($bSuccess <> True) Then
    ConsoleWrite("Could not prepare the request." & @CRLF)
    Exit
EndIf

$bSuccess = $oSas.SetTokenParam("srk","srk","customer-001")
If ($bSuccess <> True) Then
    ConsoleWrite("Could not prepare the request." & @CRLF)
    Exit
EndIf

$bSuccess = $oSas.SetTokenParam("erk","erk","customer-099")
If ($bSuccess <> True) Then
    ConsoleWrite("Could not prepare the request." & @CRLF)
    Exit
EndIf

Local $sasToken = $oSas.GenerateToken()
If ($oSas.LastMethodSuccess <> True) Then
    ConsoleWrite("Could not sign the SAS." & @CRLF)
    Exit
EndIf

$oFiles = ObjCreate("Chilkat.FileAccess")
$bSuccess = $oFiles.WriteEntireTextFile("qa_data/azure/table-sas.txt",$sasToken,"utf-8",False)
If ($bSuccess <> True) Then
    ConsoleWrite("Could not save private SAS token." & @CRLF)
    Exit
EndIf

ConsoleWrite("Read-only Table SAS saved privately; expires in about 15 minutes." & @CRLF)