Download Blob to Azure VM using Custom Script Extension via PowerShell

Virtual Machines in Azure can be spun up in multiple ways — Azure Portal, PowerShell, or by deploying ARM templates. They are created to serve a purpose, and often, we come across the need to store files in the VM. This can be achieved in multiple ways — Disks, AzCopy, download from Blob, Github, or other URLs. Installing or copying these files post-VM-creation is a daunting task, as that requires you to RDP or SSH into the machine and then start executing commands.

With the help of Custom Script Extension, copying files post VM creation can be automated with a simple PowerShell script. All you have to do is point out the location to the PowerShell script stored as a Blob in one of the containers.