2cool4school
2cool4school

Reputation: 249

how can I create user assigned identity and system assign identity with arm template on a app service

Is it possible to assign both userAssigned identity and system assigned identity to app service with ARM template. if so, how can it be done.

Upvotes: 1

Views: 830

Answers (2)

sebbrochet
sebbrochet

Reputation: 129

As of june 2023, assigning to the same Azure resource both a system assigned and one or several user-assigned identities look to be supported.

Resources that support managed identities can have both a system-assigned identity and one or more user-assigned identities.

ARM Samples are available here.

Upvotes: 0

4c74356b41
4c74356b41

Reputation: 72211

5 seconds in google:

{
    "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://learn.microsoft.com/en-us/azure/app-service/overview-managed-identity?tabs=dotnet#add-a-system-assigned-identity

ps. if you are asking to have both at the same time - its not possible

Upvotes: 1

Related Questions