【问题标题】:how can I create user assigned identity and system assign identity with arm template on a app service如何在应用服务上使用 arm 模板创建用户分配的身份和系统分配身份
【发布时间】:2020-07-18 15:41:52
【问题描述】:

是否可以使用 ARM 模板将 userAssigned 标识和系统分配标识分配给应用服务。如果可以,怎么做。

【问题讨论】:

    标签: azure-resource-manager azure-managed-identity


    【解决方案1】:

    谷歌中的 5 秒:

    {
        "apiVersion": "2016-08-01",
        "type": "Microsoft.Web/sites",
        "name": "[variables('appName')]",
        "location": "[resourceGroup().location]",
        "identity": {
            "type": "SystemAssigned"
        },
        "properties": {
            "name": "[variables('appName')]",
            "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]",
            "hostingEnvironment": "",
            "clientAffinityEnabled": false,
            "alwaysOn": true
        },
        "dependsOn": [
            "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]"
        ]
    }
    
    {
        "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'))]"
        ]
    }
    

    https://docs.microsoft.com/en-us/azure/app-service/overview-managed-identity?tabs=dotnet#add-a-system-assigned-identity

    ps。如果您要求同时拥有两者 - 这是不可能的

    【讨论】:

    • 我想同时将两者添加到应用服务中
    • 我认为您可以分配系统或分配用户。我很好奇为什么一个人都想要?
    猜你喜欢
    • 2021-04-02
    • 1970-01-01
    • 2022-12-17
    • 2020-06-04
    • 2020-12-08
    • 1970-01-01
    • 2021-05-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多