Microsoft Azure Storage

Management: Access Control

Understanding Access Control in Azure Storage

Azure Storage offers robust mechanisms to secure your data, ensuring that only authorized users and applications can access your blobs, files, queues, and tables. This document details the primary access control models available for Azure Storage.

Shared Access Signatures (SAS)

Shared Access Signatures provide a secure way to delegate access to resources in your storage account. A SAS token grants specific permissions for a limited period to a designated resource. This is ideal for scenarios where you need to provide limited access to clients without them needing full account credentials.

For more details on SAS, refer to the official documentation.

Azure Role-Based Access Control (RBAC)

Azure RBAC is the foundational access control system for Azure resources. It allows you to grant granular access to Azure Storage management operations and data operations by assigning roles to users, groups, service principals, or managed identities.

Learn more about Azure RBAC for Storage in the documentation.

Access Keys

Storage account access keys provide full administrative access to your storage account. They grant unrestricted read and write access to all data in the account. Access keys should be treated as highly sensitive credentials and rotated regularly.

See managing storage account access keys.

Best Practice: For most application scenarios, using Azure RBAC with Azure Active Directory (Azure AD) and Shared Access Signatures (SAS) is the recommended approach for secure and granular access control. Reserve the use of storage account access keys for management tasks or scenarios where other authentication methods are not feasible, and ensure they are securely stored and rotated.

Example: Granting Read Access to Blobs using RBAC

To grant a user read-only access to blob data in a specific storage account:

  1. Navigate to the storage account in the Azure portal.
  2. Select "Access control (IAM)" from the left-hand menu.
  3. Click "+ Add" and then "Add role assignment."
  4. Select the "Storage Blob Data Reader" role.
  5. Choose the members (users, groups, service principals) you want to assign the role to.
  6. Review and assign the role.

Example: Creating a SAS Token for a Blob

You can generate a SAS token for a specific blob using the Azure portal, Azure CLI, Azure PowerShell, or SDKs. For example, using Azure CLI:


az storage blob generate-sas \
  --account-name mystorageaccount \
  --container-name mycontainer \
  --name myblob.txt \
  --permissions r \
  --expiry 2024-12-31T23:59:59Z \
  --output tsv
        

The output will be the SAS token string, which you can then append to the blob's URL.

Key Concepts Summary