How to quickly transfer files to cloud shell

Today I will share a little trick about cloud shell, cloud shell is a good tool, especially in an emergency situation, local installation of CLI or PowerShell requires time and permissions, but cloud shell is a ready-made command line environment, also built-in Tools like vscode, terraform, and Ansible are very convenient. Unfortunately, it is currently only available in Global Azure

But there is a problem that has always made me feel more troublesome, that is, how to quickly transfer some files to the cloud shell. Some scripts or files are written locally and want to be run in the cloud shell, but editing one by one is really troublesome. , After researching it, I gradually found some skills

A better way to share files like this is actually azure file, which can directly support mounting. After research, I found that there is actually a built-in program called clouddrive in the cloud shell. This program can be used to mount azure files. , First open the cloud shell, there is a small button in the upper right corner of the global azure

Picture 1.png


After opening, there will be a clouddrive program in the root directory

Picture 2.png


After using clouddrive mount to specify the name of the subscription, storage and file share, it is easy to connect to the file share. Of course, you need to pay attention to the file share and the cloud shell in the same region

One thing to be reminded here is that the reason why cloud shell can save files is actually because it is connected to a file share by default, so if you connect to another file share, the previously saved files will not be visible.

Picture 3.png


So the best way is to find the file share that the cloud shell is connected to directly. The files of the cloud shell are actually packaged in an img file by default. Of course, we can’t directly transfer things to this img file.

Picture 4.png

But it does not prevent us from uploading files directly to this folder

Picture 5.png

In the cloud shell, you can actually see and access it directly, but the directory is hidden, but the file can be accessed directly as long as it is uploaded.

Picture 6.png


Guess you like

Origin blog.51cto.com/mxyit/2590437