Copy files to Azure VM - azure

I have a VM I want to copy files to, a console app I want to run on the VM. How do I do this as the Remote Desktop won't let me copy files.

You should just be able to copy/paste like normal. You can check to make sure rdpclip.exe is running on the VM.
If that doesn't work, you can always open your local drive using \\tsclient\c from within the RDP session. To share your local drive you can save the RDP file from the Management Portal website, then right-click the .rdp file and select Edit. Then switch to the Local Resources tab and click More under 'Local devices and resources' and check the drives that you want to share.

In my case simple restart of rdpclip.exe did the job, so try it.

From my point of view the simplest and most reliable way is to use an Azure File Share.
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 console 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.
The process is more or less automatable. I wrote about it on my blog:
https://engineerer.ch/2020/08/16/copy-large-files-to-an-azure-vm/

Related

Copy file from Remote Desktop (RDP) to Azure blob storage

I have a requirement to copy a file from C: Drive of a remote desktop (RDP) to Azure blob storage.
The RDP server is accessible only through the Jump box.
How can I get the file that is on the RDP to Azure Storage, which linked service can I use to create the connection.
Is there a straight forward way in Azure to do this or some workaround needs to be done for this.
Thanks in advance !
Upload the file to a file share
The easiest way would be to mount a file share directly to your machine.
You can find detailed instructions on how to do so:
https://learn.microsoft.com/en-us/azure/storage/files/storage-files-quick-create-use-windows
To sum the article up, the instructions are:
In the Azure portal, create a file share in the storage account.
From the storage account, click connect
A pane will pop up on the right. Choose a drive letter which is unused on your VM and then copy the command.
Paste the command in a Powershell terminal in the virtual machine.
Once the file share is mounted, you can simply copy your file to the drive and it will be uploaded to Azure.
Upload the file to Blob Storage
You would have to install the Azure CLI:
https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-cli
and then use the az copy command.

Access Azure Virtual Machine File Structure from outside the VM

We have Windows Server 2016 Azure Virtual Machines using managed disks.
I am trying to create an Azure Data Factory pipeline that will let me copy certain files from a folder on the hard drives of those VMs, to our Azure SQL Server. I was quite surprised to see no ADF connectors available for Azure VMs; then I checked Logic Apps - same issue, no available connectors for connecting to Azure VM's there either.
Then I did some Googling to find out how, in general, you can access an Azure VM file structure from outside (without using Remote Desktop) and was even more surprised to see that there isn't any info out there about this (not even that it can't be done).
Is it possible for me to access the file system of my Windows Server 2016 Azure VM without using Remote Desktop? The VM's are running Managed Disks if that makes any difference.
You can either ssh your_vm_ip and then use rsync command to download or upload files.
rsync -au --progress your_user_name#ip.ip.ip.ip:/remote_dir/remote_dir/ /local_dir/local_dir/
Otherwise you can install Dropbox in the VM and your local computer, transfering small files in the shared Dropbox folder is very fast..
Here are some instruction slides on the Azure storage system and their Storage Explorer App.

Is there a way to download files from Azure Cloud Shell?

I am trying to get credentials for my Azure Kubernetes Cluster. Ran the script to fetch details on Azure cloud shell and got a .config file. I wonder if there is a way to download the file from my Azure Cloud Shell session?
At the cloud shell prompt just type: download yourfilename
When you use Azure Cloud Shell, you need to create an Azure File Share or use the existed. Cloud shell will mount File Share to the system. And the mount path you can use command mount to take a look. The result will like this:
As I suggest, you can copy the .config file to the path like this: /home/RG/clouddrive/.cloudconsole, then you can download the file from File Share.
For more details, you can take a look at another case here.
List your files
Azure Cloud Shell File listing
You may notice the clouddrive folder (check image link above). This folder is mounted to an Azure File Share, as specified here: https://learn.microsoft.com/en-us/azure/cloud-shell/persisting-shell-storage#how-cloud-shell-storage-works
Get Azure File Share Information:
Azure File Share
With the Get-CloudDrive command you obtain the Azure File Share metadata that will help you to find the download page for your files in Azure Portal. Alternatively you may use the df command
Login to Azure Portal and locate the Azure File Share:
Azure File Share at Azure Portal

Is there any way to copy files from azure app service to another azure app service?

I need to copy the files from my app service A to my app service B.
To do this I can simple download the A files over FTP to my computer and upload them to B over FTP.
Is there a way to do this ftp download directly from A to B? I tried azure app service console and kudu power shell but I'm getting the following error:
I Know that I can clone the entire app service but that's not what a I want.
Thanks for the suggestions.
As far as I know, azure kudu don't support ftp tool.
Besides, I don't think there's a way to copy files without downloading and re-uploading, at least I found nothing like this in the List of FTP commands and no client I have seen so far supported something like this.
You need download it firslty and upload it again.
Here is a workaround, you could use some tools to help you copy files.
These tool also will cpoy the files to local(in temp folder) and upload it again.
For example WinSCP FTP client does support the remote copy.
You could just right click the file after login in and select remote copy tag.
If you want to copy files from A to B in kudu, I suggest you could use git tool to help you copy the files(the entire app service).
More details, you could refer to below steps:
1.Generate the git url in your web service A.
(1)You could firstly set your deployment username and password.
(2)Enable local git deploy
(3) Find the web service git url in the overview.
2.In the kudu, locate to the site folder and change add below codes:
Notice: you need delete all the files in the wwwort folder add password behind the user name as below format:
https://{username}:{password}#xxxxxxxxxxxxxxxx.scm.azurewebsites.net:443/xxxxxxxxxxxxxxx.git
Code:
git clone {git url} wwwroot
Result:
Not sure what exactly you want to achieve and how this is related to programming, but here is a bunch of info that will help you:
Azure Web App Cloning
Backup Azure Web App
Restore Azure Web App
FTP client can be install on app server:
apt-get install ftp

Client-Side: Accessing Windows Azure Drive?

I am developing an Azure application, part of which involves users browsing an online filesystem. TO do this, I am trying to use the Windows Azure drive, but I can't figure out how to access it from client side, or how to make it accessible on the server side.
At the moment, I only know how to make the drive:
CloudStorageAccount devStorage = CloudStorageAccount.DevelopmentStorageAccount;
CloudBlobClient client = devStorage.CreateCloudBlobClient();
CloudBlobContainer container = new CloudBlobContainer("teacher", client);
CloudDrive.InitializeCache(localCache.RootPath,
localCache.MaximumSizeInMegabytes);
CloudDrive drive = new CloudDrive(container.GetPageBlobReference("drive1").Uri, devStorage.Credentials);
drive.Create(50);
I am using C# as my development language.
All help is greatly appreciated!
There are couple of things you need to understand with Windows Azure Cloud Drive:
Cloud drives are actual Page Blobs which are stored on Windows Azure Blob storage and mount as a drive (you will get a drive letter depend on your machine drive statistics) in a machine where you can provide Windows Azure Run time environment.
Programmatic it is very easy to mount a cloud drive in your code as you showed in your example however one thing is missed that is to be sure to have Windows Azure RunTime environment where this code can run.
I have written a utility to mount azure drive within Windows Azure VM (Web, Worker or VM Role) located here:
http://mountvhdazurevm.codeplex.com/
You can run above tool directly in Windows Azure VM and can also this the exact same code in your Compute Emulator (Windows Azure Development Fabric) so the bottom line is as long as you can provide Windows Azure Runtime environment, you can mount a Page blob VHD drive.
I have seen several cases where someone asked me to mount a Windows Azure Page Blob as drive in local machine (client and server, anywhere) and the actual hurdle was to bring Windows Azure Run time in local environment because it is not available. In some cases a few person went ahead and tries to use Windows Azure SDK to have Windows Azure runtime made
available in their desktop, created a dummy web role and then mount the VHD which was mounted in local machine and a drive letter was made available as well. I am not sure about such kind of solution because this is not Windows Azure compute emulator is designed.
Hope this description provide you some guideline.
I'm not sure I understand your question properly, but it sounds like you want multiple client applications - presumably on machines that are not on Azure - to access your Azure drive?
Unfortunately, Azure drives can only be accessed from Azure web/worker or VM role instances.
I've written a WebDAV Server which runs on an Azure Website which will allow clients, including Windows Explorer and Office to connect to Azure Storage. It uses a combination of Table and Blob Storage to store the file structure and files. I've tested it with Windows Explorer and Word 2013. Although this isn't a clouddrive solution it's still using Azure Storage as a backend and it's accessible from WebDAV clients. You might find it useful..
https://github.com/ichivers/AzureDAV
One additional point to the existing answers. You can always download the blob backing your Cloud Drive and mount it on a local system. The blob is really just a VHD. However, the download time isn't going to trivial unless the drive is small.
Erick

Resources