1

I don't know how to connect to an existing Azure File Share from Azure Cloud Shell.

The command clouddrive seems to move my default cloud shell storage account. But I don't want to do that. I just want to access my existing Azure File Share storage. This can exist in any Azurea region (not just what's available for Cloud Shell, which is currently very limited)

When I tried to use clouddrive to mount my existing Azure Files account, I get the following error message:

ERROR: The storage account is not in the valid location. Expect: eastus Actual: canadacentral

I'd prefer not to move my existing Azure File Shares from canadacentral to eastus. Is there a workaround for this?

I'd like to just connect to my existing Azure File Shares through Cloud Shell and run commands in those directories.

Thank you!


Same question asked here:

Rohit Mistry
  • 113
  • 3
  • 11

1 Answers1

1

Azure cloud shell is an interactive, authenticated, browser-accessible shell which backend is running on cloud shell hosts. The cloud shell machines are temporary but your files are persisted through a mounted file share named clouddrive.

By using the advanced option, you can associate existing resources. Also, the associated Azure storage accounts must reside in the same region as the Cloud Shell machine that you're mounting them to. To find your current region you may run env in Bash and locate the variable ACC_LOCATION. enter image description here

As the document stated, the canadacentral is not an available region for Cloud Shell, you should mount file storage in the available region. If so, you can run clouddrive unmount to unmount the current file share then select the existing file storage in the available region via clicking advanced settings in the initial login.

enter image description here

Nancy
  • 26,865
  • 3
  • 18
  • 34
  • Thanks @Nancy, this is all known to me. I don't want to use my `canadacentral` storage account for CloudShell. I just want to connect to a storage account in `cc` and execute commands in my Azure Files Share (or any NFS accessible through internet, e.g. Azure NetApp Files). I have files that are zipped in my Azure File Share in `cc` and I'd like to unzip them through cloud shell. I know there are workarounds, I'd just like to learn if what I want to do is possible. – Rohit Mistry Nov 23 '19 at 23:56
  • Since you're not able to mount an existing file share due to the storage account region, you can copy files from an existing file share to your current `clouddrive` then unzip it in the cloud shell, then copy back to your existing file share. But it is complicated. I think the easiest way is to download and unzip and upload to your file share on the Azure portal. – Nancy Nov 27 '19 at 07:13
  • 1
    You can use `az storage file upload` or `download` or `copy` commands with Azure CLI. Refer to [this](https://learn.microsoft.com/en-us/azure/storage/files/storage-how-to-use-files-cli#upload-a-file). – Nancy Nov 27 '19 at 07:25
  • Do you need further help in your question? – Nancy Nov 28 '19 at 01:38
  • Thanks @Nancy. This is another known workaround. But it doesn't address the core problem. For Linux Azure Cloud Shell session, I don't have access to `sudo`. But is there a way to mount a regular internet-accessible NFS drive? I feel that if I can do that in Az Cloud Shell then I can find a way to mount my existing Azure Files Share under my `canadacentral` storage account. I'm also open to using PowerShell Az Cloud Shell. I just can't figure out how to connect to an arbitrary NFS without root/admin privilege. – Rohit Mistry Nov 29 '19 at 03:10
  • I tried and I also couldn't figure it out. As far as I know, I only have full control in my $HOME directory and do not have access to `sudo` in Azure cloud shell. – Nancy Nov 29 '19 at 03:54