DEV Community

Olalekan Oladiran
Olalekan Oladiran

Posted on

Securing App Data: Role-Based Access Control and Immutable Storage for Testing Environments

How to create a storage account and Managed identity

  • In the market place search for storage account and select create Image description
  • In the project details, select the resource group you just created Image description
  • Under the instance details, supply the name for your storage account. Image description
  • Click review Image description
  • Once validation is passed, click create Image description
  • Wait for it to deploy Image description

How to give the web application a managed identity to utilize.

  • In the market place, search and create managed identity Image description
  • Give name to the managed identity and click review + create Image description

Image description

  • Click create Image description
  • Wait for it to deploy Image description

How to provide the managed identity the appropriate permissions.

  • Go back to the storage account created earlier and select Access Control(IAM) Image description
  • Click Add role assignment Image description
  • Search for Storage Blob Data Reader under Job functions roles and click on it Image description
  • Click members and select managed identity Image description
  • Click +Select members and click on managed identity to select user-assigned managed identity Image description
  • Select the managed identity created earlier Image description
  • Click select Image description
  • Then click Review + assign Image description
  • Click Review + assign the second time to add role assignment A managed identity with the Storage Data Blob Reader rights can now access your storage account.

How to Use a key vault and key to provide secure access to the storage account

  • Go to the resource group where your storage account is, select Access Control (IAM). Image description
  • Click Add role assignment Image description
  • Search for Key vault administrator under Job functions role and select it Image description
  • Tick User, group, or service principal under Members page Image description
  • Click + Select members and choose your user account Image description
  • Click select Image description
  • Click Review + assign Image description
  • Click Review + assign the second time to add the role assignment

How to create a key vault to keep the access keys

  • Search for key vaults in market place and click create Image description
  • Select your resource group, give name to your key vault, leave others as default and select Review + create Image description
  • Click create after validating Image description
  • Wait for it to deploy Image description
  • Click Go to resource after deployment is complete Image description
  • Ensure that both soft delete and purge protection are enabled in the overview page. By default, soft delete is enabled and purge protection is disabled. Image description -To enable purge protection click on disabled in front of it Image description
  • Click save Image description
  • Click Keys in the Objects section and select +Generate/import Image description
  • Give name to the key, leave other settings as default and select create Image description

How to set up the storage account in the key vault to use the customer-managed key.

First assign to the Managed identity, Key Vault Crypto Service Encryption User role.

  • Go to the resource group and click Access Control (IAM) Image description
  • Click Add role assignment Image description
  • Search and select Key Vault Crypto Service Encryption User under Job function roles Image description
  • Under Member page tick managed identity and select +select member Image description
  • Select User-assigned managed identity in the Managed identity drop-down Image description
  • Click your Managed identity and click select Image description
  • Click Review + assign Image description
  • Click Review + assign the second time to add role

How to set your key vault's customer managed key to be used for the storage account.

  • Go back to your storage account
  • Click Encryption under Security + networking and tick Customer-managed keys Image description
  • Click Select a key vault and key Image description
  • Input your key vault and key Image description
  • Click Select Image description
  • Change Identity type to User-assigned and click Select an identity Image description
  • Click your managed identity and click Add Image description
  • Click save Image description

How to set up encryption scope and a time-based retention policy.

First create a blob immutable storage

  • Go to your storage account
  • Select containers in the Data storage section Image description
  • Create a container by clicking +container Image description
  • Give the container name and click create Image description
  • Upload a file into the container by clicking on the created container Image description Click upload Image description
  • Browse for a file and click upload Image description
  • Click on Access policy in the settings section, click + Add policy in the immutable blob storage section Image description
  • Change policy type to time-based retention, choose a retention period and click save Image description To check, we need to delete our uploaded file and it will display failed to delete blobs due to policy

Image description

How to configure Infrastructure Encryption

  • Go back to the storage account and select Encryption in the Security + networking section, click Add in the Encryption scopes tab Image description
  • Choose a name for encryption scope, change Encryption type to Microsoft-managed key, enable Infrastructure encryption and click create Image description
  • Now go back to your storage account to create a new container, In the New container pane, in advanced section, you will be able to select the Encryption scope created earlier and apply it to the container and the blob in it Image description

Top comments (0)