Introduction
In today’s cloud-driven environments, securing data at rest and ensuring controlled access are critical components of any robust architecture. Microsoft Azure provides a comprehensive set of tools that enable organizations to build secure, scalable, and compliant storage solutions.
In this guide, we walk through the end-to-end process of provisioning a storage account and enhancing its security using managed identities, role-based access control (RBAC), and customer-managed encryption keys. Beyond basic configuration, this setup demonstrates how to enforce least-privilege access, integrate secure key management with Azure Key Vault, and apply advanced data protection features such as immutable storage and encryption scopes.
By the end of this walkthrough, you will have a secure and production-ready storage configuration that aligns with modern cloud security best practices.
- In the portal, search for and select Storage accounts.
- Select + Create.
- 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.
- Move to the Encryption tab.
- Check the box for Enable infrastructure encryption.
- Notice the warning, This option cannot be changed after this storage account is created.
- Select Review + Create
- Wait for the resource to deploy.
Provide a managed identity for the web app to use.
- Search for and select Managed identities.
- Select Create
- Select your resource group.
- Give your managed identity a name.
- Select Review and create, and then Create.
Assign the correct permissions to the managed identity. The identity only needs to read and list containers and blobs.
- Search for and select your storage account.
- Select the Access Control (IAM) blade.
- Select Add role assignment (center of the page).
- On the Job functions roles page, search for and select the Storage Blob Data Reader role.
- On the Members page, select Managed identity.
- Select Select members, in the Managed identity drop-down select User-assigned managed identity.
- Select the managed identity you created in the previous step.
- Click Select and then Review + assign the role.
- 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
- In the portal, search for and select Resource groups.
- Select your resource group, and then the Access Control (IAM) blade.
- Select your resource group, and then the Access Control (IAM) blade.
- Select Add role assignment (center of the page).
- 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.
- Select Select members.
- Search for and select your user account. Your user account is shown in the top right of the portal.
- Click Select and then Review + assign.
- 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.
- In the portal, search for and select Key vaults.
- Select Create.
- Select your resource group.
- 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.
- Select Review + create.
- Wait for the validation checks to complete and then select Create.
- After the deployment, select Go to resource.
- 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.
- Select Generate/Import and Name the key.
- 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.
- In the portal, search for and select Resource groups.
- Select your resource group, and then the Access Control (IAM) blade.
- Select Add role assignment (center of the page)
- On the Job functions roles page, search for and select the Key Vault Crypto Service Encryption User role.
- On the Members page, select Managed identity.
- Select Select members, in the Managed identity drop-down select User-assigned managed identity.
- Select your managed identity.
- Click Select and then Review + assign.
- 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.
- Return to your the storage account.
- In the Security + networking section, select the Encryption blade.
- Select Customer-managed keys.
- Select a key vault and key. Select your key vault and key.
- Select to confirm your choices.
- Ensure the Identity type is User-assigned.
- Select an identity.
- Select your managed identity then select Add.
- Save your changes.
- 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.
- Navigate to your storage account.
- In the Data storage section, select the Containers blade.
- Create a container called hold. Take the defaults. Be sure to Create the container.
- Upload a file to the container.
- In the Settings section, select the Access policy blade.
- In the Immutable blob storage section, select + Add policy.
- For the Policy type, select time-based retention.
- Set the Retention period to 5 days.
- Be sure to Save your changes.
- Try to delete the file in the container and Verify you are notified failed to delete blobs due to policy.
The developers require an encryption scope that enables infrastructure encryption.
- Navigate back to your storage account.
- In the Security + networking blade, select Encryption.
- In the Encryption scopes tab, select Add.
- Give your encryption scope a name.
- The Encryption type is Microsoft-managed key.
- Set Infrastructure encryption to Enable.
- Create the encryption scope.
- Return to your storage account and create a new container and in the advanced section select the Encryption scope you created and apply it to all blobs in the container.
Conclusion
This implementation goes beyond simply creating a storage account—it establishes a strong security foundation for managing sensitive data in the cloud. By leveraging managed identities, assigning precise RBAC roles like Storage Blob Data Reader, and integrating with Azure Key Vault for customer-managed keys, you ensure that access to your storage resources is both controlled and auditable.
Additionally, the use of infrastructure encryption, immutable blob storage policies, and encryption scopes demonstrates how to meet higher compliance and data protection requirements. These practices are essential for organizations operating in regulated environments or handling critical business data.
Adopting these configurations not only improves security posture but also aligns your architecture with industry standards for cloud governance, making your solutions more resilient, scalable, and enterprise-ready.































































































Top comments (0)