Copy Files to an Azure Windows VM
I am having some issues with
scp to copy files from Linux to an Azure Windows 10 VM. Here is a procedure to create a shared folder between Azure Storage and a Windows VM.
Create a File Share in Azure Storage
- Go to Azure Portal
- Storage account
- Left menu Data Storage, File Shares
- Create a File Share
- Enter a name for it, and select Tier
- Click Create
For reference. There is a note that says
To use the SMB protocol with this share, check if you can communicate over port 445
Get a PowerShell Script to Check Port 445
This script will check to see if this storage account is accessible via TCP port 445, which is the port SMB uses. If port 445 is available, your Azure file share will be persistently mounted.
- Open the file share
- Upload a file
- Go to
Browseto see the uploaded file
- Top menu click
- Windows tab
- Drive letter leave default
- Authentication method
Storage account key
- Copy the script
Connecting to a share using the storage account key is only appropriate for admin access. Mounting the Azure file share with the Active Directory identity of the user is preferred.
Run the script in the Azure VM
- In Azure portal, go to the VM, under Operations
Run Command, then
- Paste script in this console and
Top message says
Script execution in progress..., wait a few minutes, then it should say
Script execution complete.
The output says
CMDKEY: Credential added successfully
Mount the File Share in the Windows VM
- Login RDP to the Windows VM
- Open File Explorer, then
This PC, top menu
Map network drive, select
Map network drive
- Enter a Drive letter
- Enter folder using this format example
- Select both
Reconnect at sign-inand
Connect using different credentials
email addressenter the storage account name
- For password enter a storage account key (from Azure Portal, Storage account)
- The file you uploaded through Azure portal in File Share should appear there.
Connect the File Share in the Windows VM After Restart
When you start the VM again, the network drive will appear as disconnected.
- Double click on it
- Enter the same password above (Azure Storage Account key)
If you have the Windows VM running, while you do the procedure, the Network Drive
Z will show up with an
X (disconnected). When you mount the File Share, you will have to use a different letter and continue the steps above.