简体   繁体   English

将文件 (.txt.csv ...) 上传到 Azure blob [使用 PowerShell]

[英]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. Azure 的新手......我有一个任务是使用 PowerShell 将文件上传到 blob。

All the information I got are:我得到的所有信息是:

  1. A blob url : https://blabla.blob.core.windows.net/whatever一个blob urlhttps://blabla.blob.core.windows.net/whatever
  2. Blob EndPoint : https://......... Blob 端点:https://.......
  3. and a SAS token : ?sv=2018-03-28&s.......和一个 SAS 令牌:?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.我已经连接到我的帐户并获得了tenantID,但订阅为空(我认为默认情况下我会拥有它,因为客户应该将我添加到那里或类似的东西)导致无法列出所有存储帐户。

any hints, helps, leads?任何提示,帮助,线索? or if someone have a better idea or already faced the same situation或者如果有人有更好的想法或已经面临同样的情况

Thank you all in advance谢谢大家

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://docs.microsoft.com/en-us/powershell/module/az.storage/Set-AzStorageBlobContent?view=azps-2.8.0 .您可以在此处找到更多使用 PowerShell 上传 Blob 的示例: https://docs.microsoft.com/en-us/powershell/module/az.storage/Set-AzStorageBlobContent?view=azps-2.8.0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用pyspark从Azure Blob存储读取(txt,csv)文件 - Reading (txt , csv) FIle from Azure blob storage using pyspark 使用 python 创建 csv 文件并将其上传到 azure blob 存储 - Create and upload csv file to azure blob storage using python 将CSV文件上传到Azure BLOB存储 - Upload csv file to Azure BLOB Storage 带有Powershell脚本的Azure WebJob可将文件上传到Azure Blob存储 - Azure WebJob with Powershell Script to upload file to Azure Blob storage 使用 Powershell 将.csv 文件转换为 ZIP 文件并存储在 Z3A580F142203677F1F0BC30898FZ 中 - Convert .csv file to ZIP file using Powershell and store in Azure blob stroage Powershell - 上传到 Azure Blob 容器 - Powershell - Upload to an Azure blob container Azure Powershell-如何使用“仅写”共享访问签名(SAS)将文件上传到Blob存储? - Azure Powershell - How to upload file to Blob Storage using “write-only” shared access signature (SAS)? 使用 React 在 Azure Blob 存储中上传文件 - Upload a file in Azure Blob Storage using React 将 Powershell Object CSV 字符串作为文件保存到 Z3A580F142203677F1F0BC30898F - Saving Powershell Object CSV String as a file to Azure Blob Storage 将 pandas dataframe 上传到 azure blob 而不创建 Z628CB5675FF524F3E719BFEAAZ8 本地文件 - upload pandas dataframe to azure blob without creating csv local file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM