Advanced Azure Storage Security: Managed Identities, Key Vaults, and Immutability
Introduction
Security is a multi-layered responsibility in the cloud. Beyond simple access keys, enterprise-grade storage requires robust identity management and data protection. In this guide, we will walk through the advanced configuration of an Azure Storage account. We will cover the implementation of User-Assigned Managed Identities, securing data with Customer-Managed Keys (CMK) via Azure Key Vault, and enforcing data integrity using time-based retention policies and infrastructure encryption scopes.
Create the storage account and managed identity
Provide a storage account for the web app.
For Resource group select Create new. Give your resource group a name and select OK to save your changes.

Provide a Storage account name. Ensure the name is unique and meets the naming requirements.

Notice the warning, This option cannot be changed after this storage account is created.

Provide a managed identity for the web app to use. Learn more about managed identities.
Assign the correct permissions to the managed identity. The identity only needs to read and list containers and blobs. Learn more about how to assign Azure roles.
On the Job functions roles page, search for and select the Storage Blob Data Reader role.

Select Select members, in the Managed identity drop-down select User-assigned managed identity.

Select the managed identity you created in the previous step.

Select Review + assign a second time to add the role assignment.
Your storage account can now be accessed by a managed identity with the Storage Data Blob Reader permissions.
Secure access to the storage account with a key vault and key
To create the key vault and key needed for this part of the lab, your user account must have Key Vault Administrator permissions. Learn more about how to provide access to Key Vault keys, certificates, and secrets with an Azure role-based access control
Select your resource group, and then the Access Control (IAM) blade.


On the Job functions roles page, search for and select the Key Vault Administrator role.

On the Members page, select User, group, or service principal.

Search for and select your user account. Your user account is shown in the top right of the portal.

Select Review + assign a second time to add the role assignment.

You are now ready to continue with the lab.
Create a key vault to store the access keys.
Provide the name for the key vault. The name must be unique.

Ensure on the Access configuration tab that Azure role-based access control (recommended) is selected.

Wait for the validation checks to complete and then select Create.

On the Overview blade ensure both Soft-delete and Purge protection are enabled.

Create a customer-managed key in the key vault.In your key vault, in the Objects section, select the Keys blade.

Take the defaults for the rest of the parameters, and Create the key.

Configure the storage account to use the customer managed key in the key vault
Before you can complete the next steps, you must assign the Key Vault Crypto Service Encryption User role to the managed identity. Learn more about how to use a system-assigned managed identity to authorize access
Select your resource group, and then the Access Control (IAM) blade.

On the Job functions roles page, search for and select the Key Vault Crypto Service Encryption User role.


Select Select members, in the Managed identity drop-down select User-assigned managed identity.

Select Review + assign a second time to add the role assignment.

Configure the storage account to use the customer managed key in your key vault. Learn more about customer managed keys on an existing storage account.
In the Security + networking section, select the Encryption blade.

If you receive an error that your identity does not have the correct permissions, wait a minute and try again.
Configure an time-based retention policy and an encryption scope.
The developers require a storage container where files canβt be modified, even by the administrator. Learn more about blob immutable storage.
Create a container called hold. Take the defaults. Be sure to Create the container.

Verify you are notified failed to delete blobs due to policy.

The developers require an encryption scope that enables infrastructure encryption. Learn more about infrastructure encryption.
Notice on the New container page, there is the Name and Public access level.

Notice in the Advanced section you can select the Encryption scope you created and apply it to all blobs in the container.

Conclusion
By implementing these configurations, you have successfully established a highly secure and compliant storage environment. Using User-Assigned Managed Identities removes the risk associated with hard-coded credentials, while Customer-Managed Keys ensure you maintain full control over your data encryption. Furthermore, the use of immutable storage and specialized encryption scopes provides the data integrity required for modern development workflows. This architecture not only protects against external threats but also safeguards your data from accidental modification or deletion.





























































Top comments (0)