I wanted to know how to assign both system managed identity as well as user managed identity on a single VM in ARM template?
For example, I have ARM template with user managed identity like below:
"identity":{
"type":"UserAssigned",
"userAssignedIdentities":{
"[resourceId(variables('userAssignedIdentitySubscription'),variables('userAssignedIdentityResourceGroup'),'Microsoft.ManagedIdentity/userAssignedIdentities', variables('userAssignedIdentityName'))]":{
}
}
},
if I want to use System managed identity, should I add another dict in identity with type as system managed identity? Like:
"identity":{
"type":"UserAssigned",
"userAssignedIdentities":{
"[resourceId(variables('userAssignedIdentitySubscription'),variables('userAssignedIdentityResourceGroup'),'Microsoft.ManagedIdentity/userAssignedIdentities', variables('userAssignedIdentityName'))]":{
}
}
},
{
"type":"SystemAssigned"
}
OR there is another way to do it?
I found the answer, to use both System managed identity and User managed identity, below is the simple way:
"identity":{
"type":"SystemAssigned, UserAssigned",
"userAssignedIdentities":{
"[resourceId(variables('userAssignedIdentitySubscription'),variables('userAssignedIdentityResourceGroup'),'Microsoft.ManagedIdentity/userAssignedIdentities', variables('userAssignedIdentityName'))]":{
}
}
},
Easy TIP to find ARM template related answers: I found the answer by manually creating a VM with both type of identities, and exported ARM template from Azure portal and found the answer :)