Googling around led me to the simplest of all solutions: Create an Azure File Share and use it as a middle man/woman.
Here you find an Overview of Azure Storage Solutions.
Using an Azure File Share (3min of effort)
- Create a new storage account
- Create a File Share in the storage account
- Navigate to the File Share
- Click “Connect” and paste the commands to the PowerShell consoles on your client and on your Azure VM. Commands for Linux and MacOS are available as well.
- Transfer files to and from the File Share
Speed from my client to the Azure File Share: 8MB/s.
Speed from Azure File Share to the Azure VM: 90MB/s.
Automated through the Azure CLI
The script works fine. Still, if you want an easy way to download the files on the target VM, navigate through the Azure Portal to the File Share and copy the script shown after clicking “Connect”.
$subscriptionId = "YOUR_SUBSCRIPTION_ID"
$location = "switzerlandnorth"
$resourceGroupName = "rg-fileshare-temp"
$ownerMail = "kai@engineerer.ch"
$storageAccountName = "filesharetemp"
$fileShareName = "transfer"
# Create the file share
az login
az account set --subscription $subscriptionId
az group create --location $location --name $resourceGroupName --tags "owner=$ownerMail"
az storage account create --name $storageAccountName `
--resource-group $resourceGroupName `
--sku "Standard_LRS" `
--location $location `
--quota 20
az storage share create --account-name $storageAccountName --name $fileShareName
az storage file upload `
--account-name $storageAccountName `
--share-name $fileShareName `
--source $fileToUploadAbsolutePath
# You can create a SAS token from here to access the file programatically
az storage file generate-sas `
-p fileToUploadAbsolutePath `
-s $fileShareName `
--account-name $storageAccountName `
--permissions rcdw `
--https-only
# If you have the AZ CLI on the target VM installed as well, you can download files with it
az login
az account set --subscription "YOUR_SUBSCRIPTION_ID"
az storage file download `
--account-name $storageAccountName `
--share-name $fileShareName `
--path $fileName
Conclusion
Sure, sharing from my OneDrive could have been an option too. Only if our admin didn’t disable anonymous sharing links. And logging in was kind of a pain in the ass because of the locked-down Internet Explorer on the VM.
This method is the one to go for me. Maybe something similar is achievable through AzCopy (a hint from the MS Docs) as well. If you know how to copy files INSIDE a Managed Disk I’d be glad to hear about it.