As you may already know, Azure Bastion allows you to connect to an Azure virtual machine using either SSH or RDP without the need to have a public IP address and management ports authorized on the network security group (NSG) (see https://t.co/UBOCpnMD2k).
Since Azure Bastion has been made available, there has been some improvements to allow the use of the native clients (remote desktop client or SSH client) to connect to the virtual machine.
Well, good news, the long awaited feature to allow transferring files between your client and the virtual machine while connected using Bastion is now available in preview.
To be able to transfer files between your client and the VM you need to connect using the native clients.
This requires you to have Azure Bastion configured to allow the native client – see https://t.co/LKRJkNe5hD
Then you just need to connect using the corresponding Azure Cli command (either RDP or SSH connection) and use the copy/paste capability to transfer your files
- Remote Desktop
az network bastion rdp –name “<name of your Bastion>” –resource-group “<resource group name>” –target-resource-id “<your virtual machine ID – using the format /subscriptions/<subscription ID>/resourceGroups/<resource group name of the VM>/providers/Microsoft.Compute/virtualMachines/<name of the virtual machine>”
- SSH
az network bastion tunnel –name “<name of your Bastion>” –resource-group “<resource group name>” –target-resource-id “<your virtual machine ID – using the format /subscriptions/<subscription ID>/resourceGroups/<resource group name of the VM>/providers/Microsoft.Compute/virtualMachines/<name of the virtual machine>” –resource-port “<target VM port>” –port “<local machine port>”
scp -P <local machine port> <local machine file path> <username>@127.0.0.1:<target VM file path>