Sitemap
A A Oke

A A Oke

Exercise 5. Guided Project-Secure storage for Azure Files and Azure Blob Storage — Provide storage for a new company app

--

Azure provides a range of robust tools for securely managing and storing your data. In this guide, you’ll learn how to create and configure an Azure Storage Account, set up a Managed Identity, secure access to your storage with Azure Key Vault, and establish advanced encryption policies. Let’s dive into each step.

Step 1: Create the Storage Account and Managed Identity

1.1 Creating a Storage Account: To start, you need to create a storage account, which is the foundation for securely storing your data in Azure.

  • Go to the Azure portal and search for Storage Accounts.
  • Select + Create.
  • Under the Resource group, either select an existing one or create a new one by clicking Create new. Name it appropriately and click OK.
  • Provide a unique Storage account name that meets Azure’s naming conventions.
  • Go to the Encryption tab and ensure that Enable infrastructure encryption is checked. Be cautious, as this setting cannot be changed once the account is created.
  • Click Review + Create, then wait for the resource deployment to complete.

1.2 Creating a Managed Identity: Next, we will create a Managed Identity, which allows your web app to securely access Azure resources like your Storage Account without embedding credentials.

  • In the portal, search for and select Managed identities.
  • Click Create and choose your resource group.
  • Give your managed identity a name.
  • Select Review + Create, then click Create to deploy your identity.

Step 2: Assign Permissions to the Managed Identity

Managed Identities need permissions to interact with Azure Storage. Let’s assign the correct permissions so it can read and list containers and blobs.

  • Search for your Storage Account in the Azure portal.
  • Select the Access Control (IAM) option from the left-hand menu.
  • Click Add role assignment in the center of the page.
  • On the Job functions roles page, search for and select Storage Blob Data Reader.
  • Go to the Members page and select Managed identity.
  • Click Select members, choose User-assigned managed identity from the dropdown, and select the identity you created earlier.
  • Click Select, then Review + assign to complete the role assignment.

Your storage account can now be accessed by the Managed Identity with the appropriate permissions.

Step 3: Secure Access to the Storage Account with a Key Vault

To further secure access to your storage account, you’ll integrate it with Azure Key Vault, which can securely store and manage access keys.

Get A A Oke’s stories in your inbox

Join Medium for free to get updates from this writer.

3.1 Set Up Key Vault and Key Permissions:

  • First, ensure that your user account has Key Vault Administrator permissions. You can assign these permissions as follows:
  • Go to Resource groups in the portal.
  • Select your resource group, and open the Access Control (IAM) blade.
  • Click Add role assignment, search for the Key Vault Administrator role, and assign it to your user account.

3.2 Create a Key Vault and Customer-Managed Key:

  • In the portal, search for Key vaults and click Create.
  • Select your resource group and provide a unique name for your key vault.
  • Ensure that Azure role-based access control (recommended) is selected on the Access configuration tab.
  • After validation, click Review + Create, then Create. Once the deployment is complete, click Go to resource.
  • Ensure that both Soft-delete and Purge protection are enabled on the Overview page.
  • In the Objects section, go to Keys and create a new key by selecting Generate/Import. Name the key and accept the default parameters, then click Create.

Step 4: Configure the Storage Account with Customer-Managed Keys

Now that you have your Key Vault and customer-managed key, let’s integrate it with your storage account.

4.1 Assign the Necessary Role:

Before continuing, ensure that your Managed Identity has the Key Vault Crypto Service Encryption User role.

  • Go to your Resource group and open the Access Control (IAM) blade.
  • Add the Key Vault Crypto Service Encryption User role, assigning it to the Managed Identity you created earlier.

4.2 Link the Key Vault and Storage Account:

  • Return to your Storage Account and navigate to the Encryption tab under Security + networking.
  • Select Customer-managed keys and choose the Key Vault and key you created earlier.
  • Make sure the identity type is set to User-assigned, and select your Managed Identity.

If you encounter any permission errors, wait for a few minutes and try again.

Step 5: Set Up Retention Policies and Encryption Scopes

To ensure that sensitive data is properly protected, we’ll configure a time-based retention policy and create an encryption scope for advanced encryption.

5.1 Time-Based Retention Policy:

  • Go to your storage account and open the Containers blade under Data storage.
  • Create a new container named hold and take the default settings.
  • Upload a file to this container.
  • Navigate to the Access policy blade under Settings, and in the Immutable blob storage section, click + Add policy.
  • Choose time-based retention, and set the retention period to 5 days. Be sure to save your changes.

To verify that the policy works, try to delete the file. You should receive a notification stating that blob deletion failed due to the retention policy.

5.2 Create an Encryption Scope:

  • Return to the Encryption tab of your storage account and select the Encryption scopes tab.
  • Click Add to create a new encryption scope.
  • Provide a name for the scope, select Microsoft-managed key as the encryption type, and enable Infrastructure encryption.
  • Once created, return to your storage account and create a new container.
  • Notice that on the New container page, you can apply the encryption scope you just created to all blobs in the container.

Conclusion

By following these steps, you have securely set up an Azure Storage Account, configured Managed Identities, integrated a Key Vault, and applied advanced encryption settings. With Azure’s robust tools, your data is now well-protected against unauthorized access while ensuring compliance with encryption best practices.

--

--