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

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.

Related

Unable to sort files by modified date/time in Azure Storage Explorer

We have logs on our application server hosted in Azure cloud. We want to show the logs to the customer who does not have access to the application server directly. We decided to use Azure sync to synchronize the logs from the app server to Azure File storage and enable view those logs from Azure Storage Explorer. The sync all works fine, but I am unable to sort the logs based on modified date-time. Our production server has 1000s of log files and it is not easy to search through the files to check logs. Any idea how to bring the modified date-time in Storage explorer? Or Is there any another approach?
In the Azure file explorer App, fileshares don't have the date column, only Blob containers do, indeed.
However, if you mount the fileshare as a drive on your computer, you'll get the date info and will be able to sort.
The command script (Powershell) to mount the fileshare as a drive on Windows is available in the Azure portal.

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.

How to mount a volume (Azure File Share) to a bitnami-based docker image on Azure (Web App for Container)?

I have the Matomo Docker Image from https://github.com/bitnami/bitnami-docker-matomo that I run in a Web App for Container on Azure with my own Azure Container Registry (ACR).
Also, I have an Azure Storage Account with a File Share available.
What I would like to achieve is to mount a persistent storage (File Share from Az Storage Account) to it so I don't loose the config and plugins installed of Matomo.
I tried using the Mount Storage (Preview), but I couldn't get it to work.
Name: matomo_data
Storage Type: Azure Files
Mount path: /bitnami
As described in: https://github.com/bitnami/bitnami-docker-matomo#persisting-your-application
This didn't work.
I also tried via the setting WEBSITES_ENABLE_APP_SERVICE_STORAGE = true on the Web App for Containers, but apparently seems not to do anything either.
I would appreciate any hints here, as otherwise I would have to make a custom docker image, push it to the registry, with a custom docker compose file, which I would like to avoid.
Thanks a lot in advance for any hints on this!
To mount the Azure File Share to the Web App for Container, as I think, it's not simple persistent storage, it's a share action. See the Caution below:
Linking an existing directory in a web app to a storage account will
delete the directory contents. If you are migrating files for an
existing app, make a backup of your app and its content before you
begin.
So, if you want to mount the file share to the web app to persist the storage, you need to upload all the files needed to the file share first. And the steps that mount the Azure File Share to the Web app are here. It shows for Windows, and for Linux is also the same way.
But I will suggest you'd better use the persistent storage following the steps here. This way will create persistent storage at the beginning and will not delete the directory contents.

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

Copy files to Azure VM

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/

Resources