简体   繁体   中英

Function to move/delete files within file share in Azure Storage Explorer?

I'm not proficient in Powershell yet, so please bear with me if I use the incorrect terminology.(And please correct me if I do.)

I have installed the Az and Azure.Storage modules.

I have also connected to my account using Connect-AZAccount (Is this the best way? Since you need to copy the URL and login via a browser)

Then I was just trying to view the files, to test the connection. Using Get-AzureStorageFile

This prompts me for a sharename - I used the name of the folder under File Shares in Azure Storage Explorer. But this failed, see failure below

cmdlet Get-AzureStorageFile at command pipeline position 1 Supply values for the following parameters: (Type !? for Help.) ShareName: bss get-azurestoragefile : Could not get the storage context. Please pass in a storage context or set the current storage context.

Additional information to note, I do not have access to the Account Key, only the SAS Token.

Any help would be appreciated.

If you use Connect-AzAccount , you will use the Az module powershell Get-AzStorageFile instead of Get-AzureStorageFile . Before running the Get-AzStorageFile command, you need to pass the storage context with New-AzStorageContext to fix the error.

Sample:

$context = New-AzStorageContext -StorageAccountName "<StorageAccountName>" -StorageAccountKey "<StorageAccountKey>"
Get-AzStorageFile -ShareName "<ShareName>" -Path "<ContosoWorkingFolder>" -Context $context

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM