【发布时间】:2022-08-03 14:47:54
【问题描述】:
我正在使用以下 powershell 脚本使用我的开发凭据连接到 azure datalake storage gen2,部署后使用托管身份凭据。
代码:
try {
$AzStorageContext = (Connect-AzAccount -Identity).context;
}
catch{
$AzStorageContext = (Connect-AzAccount).context;
}
$AzStorageContext = Set-AzContext -SubscriptionName $AzStorageContext.Subscription -DefaultProfile $AzStorageContext
Get-AzStorageContainer -Name \'MyContainer\' -Context $AzStorageContext
我遇到的错误是
错误:
Get-AzStorageContainer : Cannot bind parameter \'Context\'. Cannot convert the \"Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext\" value of type
\"Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext\" to type \"Microsoft.Azure.Commands.Common.Authentication.Abstractions.IStorageContext\".
标签: powershell azure-data-lake-gen2