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 Delphi DLL Downloads
var
success: Boolean;
token: HCkJsonObject;
subscriptionId: PWideChar;
http: HCkHttp;
response: HCkHttpResponse;
result: HCkJsonObject;
parsed: HCkUrl;
resourceGroupName: PWideChar;
accountName: PWideChar;
resourceUrl: PWideChar;
begin
success := False;
// 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.
token := CkJsonObject_Create();
CkJsonObject_putStrict(token,True);
success := CkJsonObject_LoadFile(token,'qa_data/tokens/azureToken.json');
if (success <> True) then
begin
Memo1.Lines.Add('Could not load the private Azure Resource Manager token file.');
Exit;
end;
if ((CkJsonObject_JsonTypeOf(token,'access_token') <> 1) or (CkJsonObject_StringOfEquals(token,'access_token','',True) = True)) then
begin
Memo1.Lines.Add('A nonempty access_token string is required.');
Exit;
end;
// Use your subscription ID as a string. The all-zero value is only a placeholder.
subscriptionId := '00000000-0000-0000-0000-000000000000';
http := CkHttp_Create();
CkHttp_putAuthToken(http,CkJsonObject__stringOf(token,'access_token'));
CkHttp_putAccept(http,'application/json');
CkHttp_putRequireSslCertVerify(http,True);
CkHttp_putFollowRedirects(http,False);
CkHttp_putConnectTimeout(http,30);
CkHttp_putReadTimeout(http,60);
success := CkHttp_SetUrlVar(http,'subscriptionId',subscriptionId);
if (success <> True) then
begin
Memo1.Lines.Add('Could not encode subscription ID.');
Exit;
end;
response := CkHttpResponse_Create();
result := CkJsonObject_Create();
CkJsonObject_putStrict(result,True);
parsed := CkUrl_Create();
resourceGroupName := 'my-resource-group';
success := CkHttp_SetUrlVar(http,'resourceGroupName',resourceGroupName);
if (success <> True) then
begin
Memo1.Lines.Add('Could not encode resource group.');
Exit;
end;
accountName := 'youruniquestorageaccount';
success := CkHttp_SetUrlVar(http,'accountName',accountName);
if (success <> True) then
begin
Memo1.Lines.Add('Could not encode account name.');
Exit;
end;
resourceUrl := 'https://management.azure.com/subscriptions/{$subscriptionId}/resourceGroups/{$resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{$accountName}?api-version=2026-09-01';
success := CkHttp_HttpNoBody(http,'GET',resourceUrl,response);
if (CkHttpResponse_getStatusCode(response) = 0) then
begin
Memo1.Lines.Add('No HTTP response. Inspect LastErrorText privately; it may contain credentials.');
Exit;
end;
if ((CkHttpResponse_getStatusCode(response) <> 200)) then
begin
Memo1.Lines.Add('HTTP status: ' + IntToStr(CkHttpResponse_getStatusCode(response)));
Memo1.Lines.Add('Request ID: ' + CkHttpResponse__getHeaderField(response,'x-ms-request-id'));
Memo1.Lines.Add('Retry-After: ' + CkHttpResponse__getHeaderField(response,'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.
Exit;
end;
if (success <> True) then
begin
Memo1.Lines.Add('The HTTP response could not be read completely.');
Exit;
end;
success := CkJsonObject_Load(result,CkHttpResponse__bodyStr(response));
if (success <> True) then
begin
Memo1.Lines.Add('Expected a well-formed JSON response.');
Exit;
end;
if (CkJsonObject_JsonTypeOf(result,'id') <> 1) then
begin
Memo1.Lines.Add('Missing or invalid id.');
Exit;
end;
if (CkJsonObject_JsonTypeOf(result,'name') <> 1) then
begin
Memo1.Lines.Add('Missing or invalid name.');
Exit;
end;
if (CkJsonObject_JsonTypeOf(result,'id') = 1) then
begin
Memo1.Lines.Add('Resource ID: ' + CkJsonObject__stringOf(result,'id'));
end;
if (CkJsonObject_JsonTypeOf(result,'name') = 1) then
begin
Memo1.Lines.Add('Name: ' + CkJsonObject__stringOf(result,'name'));
end;
if (CkJsonObject_JsonTypeOf(result,'location') = 1) then
begin
Memo1.Lines.Add('Location: ' + CkJsonObject__stringOf(result,'location'));
end;
if (CkJsonObject_JsonTypeOf(result,'kind') = 1) then
begin
Memo1.Lines.Add('Kind: ' + CkJsonObject__stringOf(result,'kind'));
end;
if (CkJsonObject_JsonTypeOf(result,'sku.name') = 1) then
begin
Memo1.Lines.Add('SKU: ' + CkJsonObject__stringOf(result,'sku.name'));
end;
if (CkJsonObject_JsonTypeOf(result,'properties.provisioningState') = 1) then
begin
Memo1.Lines.Add('Provisioning state: ' + CkJsonObject__stringOf(result,'properties.provisioningState'));
end;
if (CkJsonObject_JsonTypeOf(result,'properties.primaryEndpoints.blob') = 1) then
begin
Memo1.Lines.Add('Blob endpoint: ' + CkJsonObject__stringOf(result,'properties.primaryEndpoints.blob'));
end;
if (CkJsonObject_JsonTypeOf(result,'properties.primaryEndpoints.file') = 1) then
begin
Memo1.Lines.Add('File endpoint: ' + CkJsonObject__stringOf(result,'properties.primaryEndpoints.file'));
end;
if (CkJsonObject_JsonTypeOf(result,'properties.minimumTlsVersion') = 1) then
begin
Memo1.Lines.Add('Minimum TLS: ' + CkJsonObject__stringOf(result,'properties.minimumTlsVersion'));
end;
if (CkJsonObject_JsonTypeOf(result,'properties.publicNetworkAccess') = 1) then
begin
Memo1.Lines.Add('Public network access: ' + CkJsonObject__stringOf(result,'properties.publicNetworkAccess'));
end;
if (CkJsonObject_JsonTypeOf(result,'properties.supportsHttpsTrafficOnly') = 5) then
begin
Memo1.Lines.Add('HTTPS only: ' + IntToStr(Ord(CkJsonObject_BoolOf(result,'properties.supportsHttpsTrafficOnly'))));
end
else
begin
Memo1.Lines.Add('HTTPS only: not explicitly set; consult the service default.');
end;
if (CkJsonObject_JsonTypeOf(result,'properties.allowBlobPublicAccess') = 5) then
begin
Memo1.Lines.Add('Anonymous blob access allowed: ' + IntToStr(Ord(CkJsonObject_BoolOf(result,'properties.allowBlobPublicAccess'))));
end
else
begin
Memo1.Lines.Add('Anonymous blob access allowed: not explicitly set; consult the service default.');
end;
if (CkJsonObject_JsonTypeOf(result,'properties.allowSharedKeyAccess') = 5) then
begin
Memo1.Lines.Add('Shared Key allowed: ' + IntToStr(Ord(CkJsonObject_BoolOf(result,'properties.allowSharedKeyAccess'))));
end
else
begin
Memo1.Lines.Add('Shared Key allowed: not explicitly set; consult the service default.');
end;
CkJsonObject_Dispose(token);
CkHttp_Dispose(http);
CkHttpResponse_Dispose(response);
CkJsonObject_Dispose(result);
CkUrl_Dispose(parsed);