3

I am trying to practice on the following tasks:

  1. Create Storage Account: az storage account create --name heyatafroz25 --resource-group user-fottsascvuzj

  2. Get Storage Account Key: az storage account keys list -g user-fottsascvuzj -n heyatafroz25

  3. Create Share Account: az storage share create --account-name heyatafroz25 --name key1 az storage share create --account-name heyatafroz25 --name key2

  4. Create Storage Directory: az storage directory create --account-name heyatafroz25 --name heyatdir1 --share-name key1 az storage directory create --account-name heyatafroz25 --name heyatdir2 --share-name key2

  5. Uploading the File

I was asked to create a index.php file which i created using the touch command.

Post that I am not sure what details to be considered for path and source. For path i took the present working directory

az storage file upload --account-name heyatafroz25 --account-key N+PKe3ihto+G0h9CvVRV/bJ5KeEFF6RFB0aKf2qcfcyJA1uOyCBUO06Tlh9KHUzhA+PyugmDLwlrceXW5V31Xw== --path /home/scrapbook/tutorial/index.php --share-name key1 --source /home/scrapbook/tutorial/index.php

Please suggest on the corrections in the 5th command.

Thanks in advance.

Heyat Afroz
  • 51
  • 1
  • 1
  • 3

2 Answers2

3

Looking at the documentation for az storage file upload:

--source: Path of the local file to upload as the file content.

Essentially this is the path of the local file you want to upload.

--path: The path to the file within the file share. If the file name is omitted, the source file name will be used.

So assuming if you're uploading a file, it would be the name of the file you want the local file to be saved in the storage.

To elaborate further, let's say you have a local file called "image.png" and you want to save it as "logo.png", you will use the following command:

az storage file upload --account-name <account-name> --account-key <account-key> --share-name <share-name> --path logo.png --source image.png
Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241
  • Thanks for the detailed understanding along with the example. Will try and update on that...Thank you very much – Heyat Afroz Apr 11 '20 at 03:23
3

Try running the following command:

az storage file upload --account-name mystorageaccount --account-key NT9ewNtqU1CB+Z7Lzm5f3UOvWbywC8b0Bk8TWnp06zwzDCoe3vGV2u/wQmupT04//pqpIyOwsn/Q9rtSDBdVdg== --share-name myfileshare --path "myDirectory/index.php" --source "/home/scrapbook/tutorial/php-docs-hello-world/index.php"
Eric Aya
  • 69,473
  • 35
  • 181
  • 253
a.garg
  • 61
  • 4
  • I have already solved this...Thanks a lot for your response. The answer is as under: az storage file upload --account-name heyatafroz25 --account-key slFQOw7ylasPDUMOHn5xCu0ds+jYQw9fAQQGWWHl3n4JN+bJ0fwWHruN7yoUQVfPUhbqehC2kyHrDRzWlTBqfQ== --path heyatdir1/index.php --share-name key1 --source index.php – Heyat Afroz Sep 04 '20 at 08:30