DEV Community

Cover image for Provide storage for a new company app
Rahimah Sulayman
Rahimah Sulayman

Posted on

Provide storage for a new company app

Introduction

In the world of cloud architecture, "default" is rarely enough. When a company's data is on the line, the difference between a functional app and a secure app lies in the details of the infrastructure.

I recently architected a storage solution for a new enterprise application, that moves beyond basic configurations. This implementation focuses on the "Zero Trust" model, leveraging Customer-Managed Keys (CMK), User-Assigned Managed Identities, and Immutable Storage policies to ensure that data isn't just stored but it's fortified.

This guide walks through the end-to-end process of how I hardened the cloud environment.

Scenario: The company is designing and developing a new app. Developers need to ensure the storage is only accessed using keys and managed identities. The developers would like to use role-based access control. To help with testing, protected immutable storage is needed.

Skilling tasks

I exhibited the following skills:

  • Create the storage account and managed identity.
  • Secure access to the storage account with a key vault and key.
  • Configure the storage account to use the customer managed key in the key vault
  • Configure an time-based retention policy and an encryption scope.

Create the storage account and managed identity

Provide a storage account for the web app.
Step 1: In the portal, search for and select Storage accounts.

storage acct

Step 2: Select + Create.

create

Step 3: For Resource group select Create new. Give your resource group a name and select OK to save your changes.

save

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

name

Step 5: Move to the Encryption tab.

encryption

Step 6: Check the box for Enable infrastructure encryption.

reviewncreate

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

notice

Step 7: Select Review + Create.

review

validation

create

deployment

Wait for the resource to deploy.

deploymentcomplete

Provide a managed identity for the web app to use.

Step 1: Search for and select Managed identities.

search

Step 2: Select Create.

create

Step 3: Select your resource group.

rg

Step 4: Give your managed identity a name.

miname

Step 5: Select Review and create, and then Create.

review

validation

create

gotoresource

Assign the correct permissions to the managed identity. The identity only needs to read and list containers and blobs.
Step 1: Search for and select your storage account.

storageacct

Step 2: Select the Access Control (IAM) blade.

IAM

Step 3: Select Add role assignment (center of the page).

addrole

Step 4: On the Job functions roles page, search for and select the Storage Blob Data Reader role.

jobrole

Step 5: On the Members page, select Managed identity.

members

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

members

select

Step 7: Select the managed identity you created in the previous step.

id

Step 8: Click Select and then Review + assign the role.

select

rvnassign

Step 9: Select Review + assign a second time to add the role assignment.
revnassign

manageid

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 here, your user account must have Key Vault Administrator permissions.
Step 1: In the portal, search for and select Resource groups.

rg

Step 2: Select your resource group, and then the Access Control(IAM) blade.

rg

IAM blade
Step 3: Select Add role assignment (center of the page).

addrole

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

jobfxn

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

members

Step 6: Select Select members.

selectmembers

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

Step 8: Click Select and then Review + assign.
useracct
reviewnassign

Step 9: Select Review + assign a second time to add the role assignment.
secondtime

addedrole

Create a key vault to store the access keys.

Step 1: In the portal, search for and select Key vaults.

keyvaults

Step 2: Select Create.

create
Step 3: Select your resource group.

rg

Step 4: Provide the name for the key vault. The name must be unique.

keyvaultname

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

access

Step 6: Select Review + create.

reviewncreate

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

create
Step 8: After the deployment, select Go to resource.

gotoresource

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

purge

enabled

Create a customer-managed key in the key vault.

Step 1: In your key vault, in the Objects section, select the Keys blade.

keyvauly

Step 2: Select Generate/Import and Name the key.

generate

name

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

create

created

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.
Step 1: In the portal, search for and select Resource groups.

rg

Step 2: Select your resource group, and then the Access Control (IAM) blade.

IAM

selectrg

Step 3: Select Add role assignment (center of the page).

addrole

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

jobfxnrole

Step 5: On the Members page, select Managed identity.

memberspage

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

selectmembers

select

Step 7: Select your managed identity.

managedid

Step 8: Click Select and then Review + assign.

select

review

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

review

Configure the storage account to use the customer managed key in your key vault.

Step 1: Return to your the storage account.
Step 2: In the Security + networking section, select the Encryption blade.

encryptn

Step 3: Select Customer-managed keys.

customer

Step 4: Select a key vault and key. Select your key vault and key.

keyvault
Step 5: Select to confirm your choices.
Step 6: Ensure the Identity type is User-assigned.
keyvault
Step 7:Select an identity.

selectanid
Step 8: Select your managed identity then select Add.

add

ensure
Step 9: Save your changes.

save

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.

Step 1: Navigate to your storage account.
Step 2: In the Data storage section, select the Containers blade.

containerblade
Step 3: Create a container called hold. Take the defaults. Be sure to Create the container.

hold

Step 4: Upload a file to the container.

upload

upload

sure

Step 5: In the Settings section, select the Access policy blade.

accesspolicy
Step 6: In the Immutable blob storage section, select + Add policy.

Immutable
Step 7: For the Policy type, select time-based retention.

policy

Step 8: Set the Retention period to 5 days.

retention

Step 9: Be sure to Save your changes.

save

created
Step 10: Try to delete the file in the container.

delete
Step 11: Verify you are notified failed to delete blobs due to policy.

failedtodelete

The developers require an encryption scope that enables infrastructure encryption.

Step 1: Navigate back to your storage account.
Step 2: In the Security + networking blade, select Encryption.

security

Step 3: In the Encryption scopes tab, select Add.

add

Step 4: Give your encryption scope a name.

name

Step 5: The Encryption type is Microsoft-managed key.

key
Step 6: Set Infrastructure encryption to Enable.
Step 7: Create the encryption scope.
create

enabled

Step 8: Return to your storage account and create a new container.
newcontainer
_Notice on the New container page, there is the Name and Public access level.

notice

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

notice

created
Cleanup your resources

If you are working with your own subscription and have completed these labs, take a minute to delete the lab resources. This will ensure resources are freed up and cost is minimized. The easiest way to delete the lab resources is to delete the lab resource group.

In the Azure portal, select the resource group, select Delete the resource group, Enter resource group name, and then click Delete.

Conclusion

Security is a Feature, not an Afterthought.
In modern cloud environments, "it works" is only half the requirement. The real challenge is ensuring it stays secure, compliant, and resilient. This implementation proves that by moving beyond default configurations—leveraging Customer-Managed Keys (CMK), User-Assigned Managed Identities, and Immutable Storage, we can build systems that protect data from both external threats and internal accidents.

For any organization, this architecture represents a shift toward a Zero Trust mindset. It demonstrates how to:

  • Minimize Attack Surfaces: By eliminating shared secrets in favor of Managed Identities.
  • Exert Total Control: Through granular RBAC and Key Vault governance.
  • Guarantee Compliance: With time-based retention policies that satisfy even the strictest audit requirements.

Top comments (2)

Collapse
 
realcloudprojects profile image
SKILL.SCH

Nicely written, welldone!

Collapse
 
rahimah_dev profile image
Rahimah Sulayman

Thanks Sir!