Azure Storage Accounts: Get Storage Account Properties and Endpoints
See more Azure Storage Accounts Examples
Reads an account by subscription, resource group, and account name. Displays string resource IDs, service endpoints, provisioning state, and selected security settings. Missing or null policy properties are reported as unspecified rather than treated as false. Consult the relevant service default when interpreting these fields. Account properties do not include access keys and do not establish that this identity can access stored data.
These calls manage Azure resources at management.azure.com. They do not upload or download stored data. Supply a current Microsoft Entra access token for Azure Resource Manager in private qa_data/tokens/azureToken.json, with a nonempty access_token string. For v2 client credentials, request https://management.azure.com/.default; obtain a new token when it expires. A storage account key, SAS, Microsoft Graph token, or Storage data-plane token is not an ARM token. Never print the token or commit its file.
Azure RBAC must grant the caller the required management actions at the appropriate scope. An app registration alone does not grant resource access. Management permissions and blob/file data permissions are distinct. These examples target public Azure; sovereign clouds require the corresponding authority, ARM endpoint, token audience, and continuation-host validation.
Chilkat Lua Downloads
local chilkat = require("chilkat")
-- This example requires the Chilkat API to have been previously unlocked.
-- See Global.UnlockBundle for sample code.
-- This is Azure Resource Manager (the management plane), not a blob data request.
-- Load an unexpired Microsoft Entra token whose audience is Azure Resource Manager.
-- For the v2 token endpoint, request scope https://management.azure.com/.default.
-- Keep the token file private and out of source control and public web directories.
local token = chilkat.JsonObject.new()
token.strict = true
local success = token:load_file("qa_data/tokens/azureToken.json")
if not success then
print("Could not load the private Azure Resource Manager token file.")
return
end
if (token:json_type_of("access_token") ~= 1) or (token:string_of_equals("access_token", "", true)) then
print("A nonempty access_token string is required.")
return
end
-- Use your subscription ID as a string. The all-zero value is only a placeholder.
local subscriptionId = "00000000-0000-0000-0000-000000000000"
local http = chilkat.Http.new()
http.auth_token = token:string_of("access_token")
http.accept = "application/json"
http.require_ssl_cert_verify = true
http.follow_redirects = false
http.connect_timeout = 30
http.read_timeout = 60
success = http:set_url_var("subscriptionId", subscriptionId)
if not success then
print("Could not encode subscription ID.")
return
end
local response = chilkat.HttpResponse.new()
local result = chilkat.JsonObject.new()
result.strict = true
local parsed = chilkat.Url.new()
local resourceGroupName = "my-resource-group"
success = http:set_url_var("resourceGroupName", resourceGroupName)
if not success then
print("Could not encode resource group.")
return
end
local accountName = "youruniquestorageaccount"
success = http:set_url_var("accountName", accountName)
if not success then
print("Could not encode account name.")
return
end
local resourceUrl = "https://management.azure.com/subscriptions/{$subscriptionId}/resourceGroups/{$resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{$accountName}?api-version=2026-09-01"
success = http:http_no_body("GET", resourceUrl, response)
if response.status_code == 0 then
print("No HTTP response. Inspect LastErrorText privately; it may contain credentials.")
return
end
if response.status_code ~= 200 then
print("HTTP status: " .. response.status_code)
print("Request ID: " .. response:get_header_field("x-ms-request-id"))
print("Retry-After: " .. response:get_header_field("Retry-After"))
-- Inspect the error body privately. Do not log tokens, headers, or full responses.
-- For 401 check the token/audience; for 403 check Azure RBAC and policy.
-- Honor Retry-After for 429 and use bounded backoff for transient failures.
return
end
if not success then
print("The HTTP response could not be read completely.")
return
end
success = result:load(response.body_str)
if not success then
print("Expected a well-formed JSON response.")
return
end
if result:json_type_of("id") ~= 1 then
print("Missing or invalid id.")
return
end
if result:json_type_of("name") ~= 1 then
print("Missing or invalid name.")
return
end
if result:json_type_of("id") == 1 then
print("Resource ID: " .. result:string_of("id"))
end
if result:json_type_of("name") == 1 then
print("Name: " .. result:string_of("name"))
end
if result:json_type_of("location") == 1 then
print("Location: " .. result:string_of("location"))
end
if result:json_type_of("kind") == 1 then
print("Kind: " .. result:string_of("kind"))
end
if result:json_type_of("sku.name") == 1 then
print("SKU: " .. result:string_of("sku.name"))
end
if result:json_type_of("properties.provisioningState") == 1 then
print("Provisioning state: " .. result:string_of("properties.provisioningState"))
end
if result:json_type_of("properties.primaryEndpoints.blob") == 1 then
print("Blob endpoint: " .. result:string_of("properties.primaryEndpoints.blob"))
end
if result:json_type_of("properties.primaryEndpoints.file") == 1 then
print("File endpoint: " .. result:string_of("properties.primaryEndpoints.file"))
end
if result:json_type_of("properties.minimumTlsVersion") == 1 then
print("Minimum TLS: " .. result:string_of("properties.minimumTlsVersion"))
end
if result:json_type_of("properties.publicNetworkAccess") == 1 then
print("Public network access: " .. result:string_of("properties.publicNetworkAccess"))
end
if result:json_type_of("properties.supportsHttpsTrafficOnly") == 5 then
print("HTTPS only: " .. tostring(result:bool_of("properties.supportsHttpsTrafficOnly")))
else
print("HTTPS only: not explicitly set; consult the service default.")
end
if result:json_type_of("properties.allowBlobPublicAccess") == 5 then
print("Anonymous blob access allowed: " .. tostring(result:bool_of("properties.allowBlobPublicAccess")))
else
print("Anonymous blob access allowed: not explicitly set; consult the service default.")
end
if result:json_type_of("properties.allowSharedKeyAccess") == 5 then
print("Shared Key allowed: " .. tostring(result:bool_of("properties.allowSharedKeyAccess")))
else
print("Shared Key allowed: not explicitly set; consult the service default.")
end