A company is designing and developing a new app and the developers need to ensure the storage is only accessed using keys and managed identities. The developers should use role-based access control. To help with testing, protected immutable storage is also needed.
To power the new application, we aren't just going to build a storage, we are building a fortress. This configuration ensures our developers can build and test with total confidence by leveraging three pillars of cloud security:
Identity over Passwords: We will use Managed Identities and Access Keys to eliminate hard-coded credentials, ensuring the app authenticates directly and securely.
Precision Control: We are going to use Role-Based Access Control (RBAC), and grant granular permissions to team members, ensuring everyone has exactly the access they need for testing; no more, no less.
Data Permanence: We will implement Immutable Storage, locking critical data in a 'write-once, read-many' state that protects against accidental deletion or modification during the development lifecycle. This isn't just a storage account; it’s a compliant, hacker-resistant environment designed for high-stakes application development.
Let's get to it !.
PHASE 1: Create a storage account for the managed identity
Action plan
1. Provide a storage account for the web app. In the Azure 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.
PHASE 2 : Provide a managed identity for the web app to use.
Action plan
1 . 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.
PHASE 3 : Assign the correct permissions to the managed identity. The identity only needs to read and list containers and blobs.
Action plan
1 . Search for and select your storage account.Select the Access Control (IAM) blade.Select Add role assignment. 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. Once this is configured, our storage account can now be accessed by a managed identity with the Storage Data Blob Reader permissions.
PHASE 4 : Secure access to the storage account with a key vault and key.
Action plan
1 : In the portal, search for and select Resource groups. Select your resource group, and then the Access Control (IAM) blade. Select Add role assignment. 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.
PHASE 5 : Create a key vault to store the access keys
Action plan
1 : In the Azure 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.
2. 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.
PHASE 6 : 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.
Action plan
1 : 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.
PHASE 7 : Configure the storage account to use the customer managed key in your key vault.
Action plan
1 : 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.
PHASE 8 : Configure a time-based retention policy and an encryption scope
Action plan
1 : The developers require a storage container where files can’t be modified, even by the administrator. So we will navigate to our 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. Verify you are notified failed to delete blobs due to policy.
PHASE 9 : The developers require an encryption scope that enables infrastructure encryption.
Action plan
1 : 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. 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 : Hooray, the mission is a success!. Our storage fortress is ready for the new app. By enforcing access via keys and managed identities, implementing RBAC for precise testing, and locking down protected immutable storage, we have built a resilient environment where data is both accessible to developers and safe from deletion.































































Top comments (0)