Storage Account Access

This document outlines the various methods for accessing your Azure Storage accounts, including authentication, authorization, and best practices for secure access.

Authentication Methods

Azure Storage offers several authentication methods to secure access to your data:

Authorization

Once a client is authenticated, Azure Storage determines if they have the necessary permissions to perform the requested operation. Authorization is typically managed through:

Access Tiers

Azure Storage offers different access tiers to optimize costs based on data access frequency:

Understanding access tiers is crucial for cost management, especially when accessing large amounts of data.

Access Control Examples

Using Shared Key (for development/testing)

When using Azure SDKs or REST API, you'll often need your storage account name and key. Never hardcode keys in production applications.


# Example using Azure CLI
az storage account show-connection-string --name <your-storage-account-name> --resource-group <your-resource-group> --keyPrimary
            

Using Shared Access Signatures (SAS)

Generate a SAS token with specific permissions and expiry. This is ideal for sharing access to specific resources without giving away account keys.

You can generate SAS tokens using the Azure portal, Azure CLI, Azure PowerShell, or the Storage Explorer.


# Example of a SAS token generated for a blob
?sv=2020-08-04&ss=bfqt&srt=sco&sp=r&se=2023-12-31T12:00:00Z&st=2023-01-01T11:00:00Z&spr=https&sig=ABCDEFG...
            

Using Azure AD

Grant appropriate RBAC roles to your Azure AD identity (user, service principal, or managed identity) on the storage account or a specific container.

When using SDKs, the library will often automatically pick up credentials from the environment (e.g., managed identity on an Azure VM or App Service).

Best Practices

Tip

For granular access control over individual files and directories within Blob Storage that supports hierarchical namespace (e.g., Azure Data Lake Storage Gen2), utilize Access Control Lists (ACLs) in conjunction with Azure AD identities.