Mohamed Azizi
Mohamed Azizi

Reputation: 162

Upload File (.txt .csv ...) to Azure blob [using PowerShell]

Pretty new to Azure... and I have a task to upload a file to a blob using PowerShell.

All the information I got are :

  1. A blob url : https://blabla.blob.core.windows.net/whatever
  2. Blob EndPoint : https://.........
  3. and a SAS token : ?sv=2018-03-28&s.......

I've already connected to my account and got the tenantID but an empty subscription (I thought that I'll have it by default, as the client should add me in there or something like that) which leads to not being able to list the all the storage accounts.

any hints, helps, leads ? or if someone have a better idea or already faced the same situation

Thank you all in advance

Upvotes: 0

Views: 1816

Answers (1)

Gaurav Mantri
Gaurav Mantri

Reputation: 136146

Please try something like below:

$ctx = New-AzStorageContext -StorageAccountName "<account-name>" -SasToken "<sas-token>"
Set-AzStorageBlobContent -File "<full-file-path>" -Container "<container-name>" -Context $ctx

You can find more examples of uploading blobs using PowerShell here: https://learn.microsoft.com/en-us/powershell/module/az.storage/Set-AzStorageBlobContent?view=azps-2.8.0.

Upvotes: 1

Related Questions