【问题标题】:Connect to Azure Storage account using User assigned managed identiry in Automation Account (using Azure RM modules)使用自动化帐户中用户分配的托管标识连接到 Azure 存储帐户(使用 Azure RM 模块)
【发布时间】:2022-01-07 00:05:15
【问题描述】:

我正在尝试使用 Azure RM powershell 模块连接到 Azure 自动化帐户中的 Stoarge 帐户。

我正在使用以下命令

Connect-AzureRMAccount -Identity    
$storage = Get-AzureRmStorageAccount -ResourceGroupName $ResourceGroupName -Name $StorageAccountName  
$srcContext = $storage.Context    
$blobs = Get-AzureStorageBlob -Context $srcContext -Container $containerName -MaxCount $MaxReturn  -ContinuationToken $Token 

最后一行总是返回未找到的存储上下文。

我已向 MSI 提供了存储帐户所在资源组所需的权限。

【问题讨论】:

  • 如果您收到任何错误消息,最好分享完整的脚本和错误消息。如果您告诉我们您在 Azure 自动化帐户中选择了哪个 AzureRM 版本,那也很棒。

标签: azure powershell azure-automation azure-storage-account azure-rm


【解决方案1】:

我没有在我的命令中提供 ClientId,因此它失败了。下面是使用用户分配的 MSI 时的命令

Connect-AzureRMAccount -Identity - AccountId "MSI_client_Id"

【讨论】:

    猜你喜欢
    • 2019-09-19
    • 2021-10-17
    • 1970-01-01
    • 2019-12-16
    • 2021-01-28
    • 2021-11-08
    • 1970-01-01
    • 2023-03-25
    • 1970-01-01
    相关资源
    最近更新 更多