【问题标题】:How to set Azure-Native storage IdentityConfig in Pulumi如何在 Pulumi 中设置 Azure-Native 存储 IdentityConfig
【发布时间】:2021-09-04 09:52:46
【问题描述】:

我想将我的存储帐户连接到托管标识。我创建了一个托管标识,并遵循 Pulumi 文档 (here)。它非常清楚地显示了第一个参数应该是什么,即托管身份的 id。但是其他输入应该是什么?

我已经尝试了整个托管标识实例、对象 ID、甚至存储帐户 ID(虽然如果需要它会很奇怪)和许多其他的,但我不知道需要什么。

链接的代码是:

Identity = new AzureNative.Storage.Inputs.IdentityArgs
{
    Type = "UserAssigned",
    UserAssignedIdentities = 
    {
       { "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}", },
     },
},

【问题讨论】:

  • 链接已失效,请更正。

标签: c# arm-template azure-managed-identity azure-storage-account pulumi


【解决方案1】:

值应该是new Dictionary<string, object>():

Identity = new AzureNative.Storage.Inputs.IdentityArgs
{
    Type = "UserAssigned",
    UserAssignedIdentities =
    {
        { "/subscriptions/subid/resourcegroups/rgname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test", new Dictionary<string, object>() }
    }
}

如果你需要动态计算 ID,你应该这样做:

Identity = new AzureNative.Storage.Inputs.IdentityArgs
{
    Type = "UserAssigned",
    UserAssignedIdentities = userAssignedIdentity.Id.Apply(id =>
    {
        var im = new Dictionary<string, object>
        {
            { id, new Dictionary<string, object>() }
        };
        return im;
    })
}

这绝对不是非常用户友好且难以正确处理。在this issue 中跟踪了一项改进。

【讨论】:

    猜你喜欢
    • 2021-12-15
    • 2022-01-26
    • 2021-11-20
    • 2021-05-28
    • 2022-01-07
    • 1970-01-01
    • 2015-04-20
    • 1970-01-01
    • 2015-05-07
    相关资源
    最近更新 更多