Get-AzureStorageBlob:无法获取存储上下文。请传入存储上下文或设置当前存储上下文
Get-AzureStorageBlob : Could not get the storage context. Please pass in a storage context or set the current storage context
我将 powershell 与 Azure cmdlet 结合使用,尝试简单地查看 blob 存储中的项目
$StorageContext = New-AzureStorageContext -StorageAccountName 'myblobname' -StorageAccountKey '2341231234asdff2352354345=='
$Container = Get-AzureStorageContainer -Name 'mycontainer' -Context $StorageContext
$blobs = Get-AzureStorageBlob -Container $Container
Error:
Get-AzureStorageBlob : Could not get the storage context. Please pass in a storage context or set the current storage context.
我 100% 确定凭据是正确的(此 post 中只是随机缩短的凭据数据)
为什么我会收到此错误?
是否使用了 AzureRM? AzureRM 版本列为 3.8.0。
我需要哪些脚本的哪些版本才能正常工作?
您还需要在此处包括 StorageContext
:
$blobs = Get-AzureStorageBlob -Container $Container
因此您的代码将是:
$blobs = Get-AzureStorageBlob -Container $Container -Context $StorageContext
我将 powershell 与 Azure cmdlet 结合使用,尝试简单地查看 blob 存储中的项目
$StorageContext = New-AzureStorageContext -StorageAccountName 'myblobname' -StorageAccountKey '2341231234asdff2352354345=='
$Container = Get-AzureStorageContainer -Name 'mycontainer' -Context $StorageContext
$blobs = Get-AzureStorageBlob -Container $Container
Error:
Get-AzureStorageBlob : Could not get the storage context. Please pass in a storage context or set the current storage context.
我 100% 确定凭据是正确的(此 post 中只是随机缩短的凭据数据)
为什么我会收到此错误?
是否使用了 AzureRM? AzureRM 版本列为 3.8.0。 我需要哪些脚本的哪些版本才能正常工作?
您还需要在此处包括 StorageContext
:
$blobs = Get-AzureStorageBlob -Container $Container
因此您的代码将是:
$blobs = Get-AzureStorageBlob -Container $Container -Context $StorageContext