Azure Storage Accounts API Guide

An Azure storage account is an Azure resource that provides storage services such as Blob Storage, Azure Files, queues, and tables. The Storage Accounts API manages the account itself: its location, configuration, network rules, access keys, and lifecycle settings. This guide links to 14 complete examples using direct Chilkat.Http calls.

Account management and stored data

These examples call Azure Resource Manager (ARM) at https://management.azure.com, using the Storage Resource Provider API version 2026-09-01. Uploading a blob, downloading a file, or reading a queue uses a service endpoint and a separate authorization context. For blob transfers and related data operations, see the Azure Cloud Storage API Guide. Microsoft describes this distinction as the control plane and data plane.

Use Chilkat 11.6.0 or later and unlock the library before running the examples. Supply your subscription ID, resource group, and account name where indicated. Keep subscription IDs, resource IDs, and subnet IDs as strings. The management examples use the public Azure cloud; another cloud requires its corresponding ARM endpoint, identity authority, token audience, and continuation-host checks.

How the requests map to Chilkat

Direct HTTP calls used in the linked examples
REST operationChilkat implementation
Bearer authenticationSet Http.AuthToken to the access-token value. Chilkat supplies the Authorization: Bearer header.
GET, DELETE, or a bodyless POSTCall Http.HttpNoBody with the method and URL. List Keys is a POST even though it retrieves information.
JSON POST, PUT, or PATCHBuild a JsonObject and pass that object to Http.HttpJson with application/json.
OAuth form POSTUse HttpRequest.AddParam, POST, and application/x-www-form-urlencoded, then call Http.HttpReq.
Query parametersUse Http.HttpParams with raw values. The managed-identity example uses this for its token request.
Resource names in pathsSet values with Http.SetUrlVar and reference them as {$accountName}, for example. Let Chilkat encode them.
Response processingCheck HttpResponse.StatusCode, then parse a JSON body with JsonObject.Load when that operation returns JSON. An accepted operation or successful DELETE can have an empty body.

The linked examples use these calls directly. Subscription, resource-group, and account names supply the management paths; no HttpCurl dependency setup is required. See the Storage Accounts API reference for the operation contracts.

Authorization

An ARM access token identifies the caller, while Azure role-based access control (RBAC) determines which resources it may manage. Assign the application service principal or managed identity the required actions at the intended scope. For example, listing accounts throughout a subscription needs account-read permission there; an account-management role does not automatically grant blob-data access.

The client-credentials example loads tenant_id, client_id, and client_secret from private qa_data/azure/arm-client.json. It sends a tenant-specific v2 token request with scope https://management.azure.com/.default. Use the secret's value, not its identifier. This pattern suits controlled applications that can protect a credential. A publicly distributed application should not contain a shared application secret. See Microsoft's client-credentials protocol.

The managed-identity example runs on an Azure VM with an identity assigned to it. It requests an ARM token from the VM's fixed link-local IMDS endpoint, using the Metadata: true header and resource=https://management.azure.com/. It bypasses proxies and redirects. Leave managedIdentityClientId empty for the system-assigned identity, or set it to the client ID of a user-assigned identity attached to the VM. Other Azure hosts have different endpoint contracts. See Azure VM managed-identity tokens.

Both examples write private qa_data/tokens/azureToken.json, which the remaining examples load. They save a refresh_after_utc deadline with a one-minute margin. Schedule another token request before that time; neither flow uses an OAuth refresh token. Protect the directories with operating-system permissions and coordinate shared-file updates. A Storage data token, account key, SAS, or Microsoft Graph token cannot substitute for an ARM token.

Discovery

Start by listing accounts across the subscription or within a resource group. Both list examples follow the server's opaque nextLink until it is absent or empty, including after an empty intermediate page. They preserve the query string, check the continuation destination before sending the token, and stop if a link repeats or a page limit is reached. A partial listing is not reported as complete.

Get Properties reads one account by name and resource group, returning its string resource ID, SKU, provisioning state, service endpoints, and selected access settings. A missing or null setting can mean that a service default applies; do not automatically interpret it as false. These responses do not contain account keys.

Check Name Availability helps before creating an account. Names must contain 3-24 lowercase letters or digits. Inspect nameAvailable even when HTTP status is 200, and use the reason to distinguish an invalid name from one already taken. Availability is not a reservation and does not prove that a SKU or region can be used. See Check Name Availability.

Account Configuration

The create example uses an existing resource group and creates a general-purpose v2 account with Standard_LRS, the Hot tier, HTTPS-only access, a minimum TLS version of 1.2, and anonymous blob access disabled. Choose a supported region and globally unique name. The subscription must have the Storage resource provider registered, and policy, quota, resource locks, and permissions can affect the request.

Creation is a PUT that can also update an existing account. Review the target resource and settings before submitting it. Creating and using storage can incur charges. The example's access settings do not configure private networking or assign data-access roles.

HTTP 202 means the request was accepted. The example monitors Azure-AsyncOperation when present, otherwise Location, and observes Retry-After. It checks the final account's provisioning state before reporting success. Save the printed operation URL and monitor type. To resume, set operationUrl and operationUsesStatus; a nonempty URL skips the PUT. Long delays and polling limits pause the example rather than shorten the server's delay. Applications should persist this state and schedule polling off the UI thread. See asynchronous ARM operations.

The tags example reads existing tags, changes only the tag it owns, and PATCHes the merged collection. The security example PATCHes HTTPS, TLS, anonymous-access, and Shared Key settings. Its default allowSharedKey=false can affect existing account-key and key-signed SAS clients, so choose it deliberately. These read-modify-write operations are not atomic merges; coordinate competing writers. See Update Storage Account.

Network Access

The firewall example reads the current network ACLs, preserves existing rules and exceptions, and adds a public IPv4 rule and optionally a subnet rule. Replace the documentation IP address with the client's actual public outbound address. For a subnet rule, supply the full subnet resource ID as a string; its Storage service endpoint must already be configured.

The proposed policy combines publicNetworkAccess=Enabled with defaultAction=Deny, allowing selected public-network sources rather than unrestricted access. It can reopen a previously disabled public endpoint for those sources. Existing trusted-service bypasses and resource-instance exceptions remain in effect. Review the policy and set applyChanges=true to submit it.

Network rules do not grant data permissions, create private endpoints, or configure private DNS. Consider the source network, same-region Azure traffic, and the storage service being accessed when choosing a policy. See Azure Storage network access.

Data Protection and Lifecycle

The Blob service settings example enables 14-day blob and container soft delete and blob versioning for standard StorageV2 without hierarchical namespace. It reads the current service settings first, preserving unrelated settings such as CORS, and checks for a conflicting point-in-time restore retention period. These features can increase retained data and storage costs; versioning does not reconstruct changes made before it was enabled. See blob versioning and the Blob service settings API.

The lifecycle example reads the current policy and adds or replaces one named rule while preserving other rules. Its rule moves matching block blobs to Cool after 30 days without modification. The prefix starts with a container name and is not a wildcard or URL. Choose the prefix, tier, and timing for your workload and costs. Azure processes matching blobs asynchronously after the policy is updated.

The sample adds no deletion action, but existing rules retain their actions. If the policy GET returns 404, verify the target before setting createMissingPolicy=true to create a policy. A policy PUT replaces the document, so coordinate concurrent writers rather than overwriting a newer policy. See the lifecycle management policy API.

Keys and Cleanup

The key example retrieves the account's keys and saves only the selected key in private qa_data/azure/storage-key.json. With rotateKey=false, it does not regenerate a key. To rotate key1, first migrate every dependent client and key-signed SAS workflow to the other key, then set rotateKey=true. Regeneration invalidates the old key immediately. Distribute the replacement through your secret-management process before considering a separate rotation of the other key.

Never rotate both keys together or print returned key values. If a response is lost or saving the replacement fails, use List Keys to recover the current value instead of regenerating again. Prefer Entra authentication where supported. See storage account key management.

Account deletion deletes the account and its stored data. The deletion example initially displays the target without deleting it. Set deleteAccount=true only after verifying the target and completing your backup and retention process. Blob soft delete and versioning do not protect against deleting the whole account.

The example accepts DELETE status 200 or 204 without parsing an empty body. It reports locks and policy failures instead of removing protections. If a transport problem makes the result uncertain, read the resource to determine whether it still exists. See Delete Storage Account.

Handling failures and application state

The direct Http methods can return false for an HTTP error as well as a communication problem. Status zero means no HTTP response was received. For 401, check token validity and audience; for 403, check RBAC and policy. Honor Retry-After for throttling and use bounded backoff for transient service failures. Check JSON fields and operation outcomes separately from the HTTP status.

A failed response after a write does not prove that Azure rejected the change. Read the resource or resume its known operation before deciding to retry. Keep tokens, account keys, and detailed diagnostics private. The ARM examples verify HTTPS certificates and disable automatic redirects; the VM identity example's fixed link-local HTTP endpoint is a separate IMDS contract.