Skilling tasks
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 a time-based retention policy and an encryption scope.
STEPS
Create the storage account and managed identity
1, 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.
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.Wait for the resource to deploy.
2, Provide a managed identity for the web app to use. Learn more about managed identities
Select your resource group.
Give your managed identity a name.
3, 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.
Search for and select your storage account.
Select the Access Control (IAM) blade.
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.
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
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 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.
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.
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.
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
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. Learn more about customer managed keys on an existing storage account.
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.
Ensure the Identity type is User-assigned.
Select an identity.
Save your changes.
If you receive an error that your identity does not have the correct permissions, wait a minute and try again.
Configure a 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.
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.
Try to delete the file in the container.
Verify you are notified failed to delete blobs due to policy.
2.The developers require an encryption scope that enables infrastructure encryption. Learn more about 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.
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.
Key takeaways
Azure has built-in RBAC roles for Azure storage. These roles include: Storage Account Contributor, Storage Blob Data Owner, and File Data SMB Share Contributor.
You can use your own encryption key to protect the data in your storage account. When you specify a customer-managed key, that key is used to protect and control access to the key that encrypts your data.
Immutable storage ensures data can’t be modified or deleted for a user-specified interval. There are two types of immutable policies: time-based and legal hold.
Infrastructure encryption can be enabled for the entire storage account, or for an encryption scope within an account. Infrastructure encryption is recommended for scenarios where doubly encrypting data is necessary for compliance requirements.
Thank you for reading, I am open for further conversations, please leave a question, suggestions in the comments
Top comments (0)