gpt4 book ai didi

powershell - 在 Azure 存储资源管理器的文件共享中移动/删除文件的功能?

转载 作者:行者123 更新时间:2023-12-02 23:53:01 25 4
gpt4 key购买 nike

我还不精通Powershell,所以如果我使用了不正确的术语,请多多包涵。(如果我这样做,请纠正我。)

我已经安装了AzAzure.Storage模块。

我还使用 Connect-AZAccount 连接到我的帐户(这是最好的方法吗?因为您需要复制 URL 并通过浏览器登录)

然后我只是想查看文件,测试连接。使用 Get-AzureStorageFile
这会提示我输入共享名 - 我使用了 Azure 存储资源管理器中文件共享下的文件夹名称。但这失败了,请参阅下面的失败

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.



需要注意的其他信息,我无权访问帐户 key ,只有 SAS token 。

任何帮助,将不胜感激。

最佳答案

如果您使用 Connect-AzAccount ,您将使用 Az模块 powershell Get-AzStorageFile 而不是 Get-AzureStorageFile .在运行 Get-AzStorageFile 之前命令,您需要使用 New-AzStorageContext 传递存储上下文修复错误。

样本:

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

关于powershell - 在 Azure 存储资源管理器的文件共享中移动/删除文件的功能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54235326/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com