In an era where cloud computing and virtualization are increasingly taking center stage, Microsoft’s Azure is a dominant force. One of the vital components in Azure is the Disk Export and Virtual Hard Disk (VHD) Download functionality. While it offers a wealth of conveniences, it also opens up potential vulnerabilities in terms of data security and regulatory compliance. In addition, the process of exporting and downloading can be time-consuming and resource-intensive, sometimes resulting in performance degradation. This blog post is dedicated to exploring ways of avoiding these risks associated with Disk Export and VHD Download in Azure. Through understanding the mechanisms behind this process, you will be able to design more efficient, secure, and compliant Azure environments, saving both time and resources.
What are we trying to achieve?
Whether you are a Security professional or an IT Professional working with VMs you might have seen this option before in the Azure Portal. This opens up a whole new conversation for Data Encryption but for today we will focus on avoiding the download of VHDs / Disks from Azure.
In our Official Documentation we can find the specific role permissions that are required to Generate the URL and download the disk.
But how do we match this up in an ever changing Azure RBAC Roles?
Easy. We will just use the Azure Portal to download all Possible Roles.
Find and Download all RBAC Roles
Visit the Azure Cloud Shell in the Portal
1. Run this command
It should look something like the below
2. Run a “dir” to see which files are in this directory and copy the “azure_rbac_roles.json”
3. Download the file by clicking the download button and pasting the “azure_rbac_roles.json” from above step
4. Open in your favorite IDE, Visual Studio Code and do a search for those permissions.
Out of the 12624 Lines of JSON there is only one Role that can download the disks being “Data Operator for Managed Disks“
Lets take a look at what happens when I try to download if I am a “Virtual Machine Contributor“.
Great, a very nice error message. Exactly what I want if I am trying to avoid Data Exfiltration.
But lets take it a step further and also create an Alert in Case I have missed some folks that could still have “Owner, Contributor or any other Custom Role“
Create an Alert
1. Log in to Azure with permission that can Generate a URL
2. Navigate to the Activity Log and look for “Get Disk SAS URI“
3. After clicking on that Activity, I can click “New Alert Rule” and follow the steps to set up an alert.
Alternatives / Mentions
The disk networking restrictions can also be enforced with an Azure Policy – this would block anyone from downloading the disk. The only downside is that Azure VM Backup is at the moment incompatible with disk networking restrictions.
As we reach the end of this post and our look into the world of Azure Disk Export and VHD Download, it’s essential to reflect on the main takeaways. Navigating the Azure environment can be complex, but armed with the right knowledge and tools, it’s possible to streamline processes, enhance security, and maintain regulatory compliance without resorting to disk exports and VHD downloads. By understanding and implementing the strategies discussed in this post, you are better positioned to manage your Azure environment efficiently, maximizing the benefits of the cloud without the inherent risks associated with disk exports and downloads.
The sample scripts are not supported under any Microsoft standard support program or service. The sample scripts are provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.