【问题标题】:How do I programmatically assign a User assigned managed identity to an Azure Web App Staging Slot?如何以编程方式将用户分配的托管标识分配给 Azure Web 应用暂存槽?
【发布时间】:2018-12-17 00:25:28
【问题描述】:

我可以在门户中手动分配用户分配的托管身份。

在部署到暂存槽期间如何作为部署管道的一部分执行此操作?

我可以使用 PowerShell 通过Set-AzureRMWebAppSlot设置系统分配的托管标识,但是我找不到为用户分配的方法。

【问题讨论】:

  • 目前处于预览阶段,powershell可能不支持,您可以尝试使用ARM template来实现。
  • 我可以使用 Arm 模板只更新身份部分吗?我们还没有转而使用 Arm 模板来定义我们的环境
  • 是的,你可以用它来更新身份部分。
  • 差不多两年后,这似乎仍然不可能。我已提交功能请求:github.com/Azure/azure-powershell/issues/13109

标签: azure powershell azure-active-directory azure-web-app-service azure-managed-identity


【解决方案1】:

用户分配的身份目前处于预览阶段,如果您想以编程方式分配用户分配的托管身份,您可以尝试使用ARM template 来执行此操作。

示例:

{
    "apiVersion": "2016-08-01",
    "type": "Microsoft.Web/sites",
    "name": "[variables('appName')]",
    "location": "[resourceGroup().location]",
    "identity": {
        "type": "UserAssigned",
        "userAssignedIdentities": {
            "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', variables('identityName'))]": {}
        }
    },
    "properties": {
        "name": "[variables('appName')]",
        "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]",
        "hostingEnvironment": "",
        "clientAffinityEnabled": false,
        "alwaysOn": true
    },
    "dependsOn": [
        "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]",
        "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', variables('identityName'))]"
    ]
}

【讨论】:

    猜你喜欢
    • 2019-09-19
    • 2021-10-17
    • 1970-01-01
    • 2013-01-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-16
    相关资源
    最近更新 更多