Created
March 26, 2022 07:45
Star
You must be signed in to star a gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param location string | |
param containersRGMI string | |
@description('Create a brand new User Assigned Managed Identity') | |
resource managedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2018-11-30' = { | |
name: containersRGMI | |
location: location | |
} | |
@description('This is the built-in Key Vault Administrator role. See https://docs.microsoft.com/azure/role-based-access-control/built-in-roles#key-vault-administrator') | |
resource keyVaultAdministratorRoleDefinition 'Microsoft.Authorization/roleDefinitions@2018-01-01-preview' existing = { | |
scope: subscription() | |
name: '00482a5a-887f-4fb3-b363-3b7fe8e74483' | |
} | |
@description('This is the built-in Owner role. See https://docs.microsoft.com/azure/role-based-access-control/built-in-roles#key-vault-administrator') | |
resource OwnerRoleDefinition 'Microsoft.Authorization/roleDefinitions@2018-01-01-preview' existing = { | |
scope: subscription() | |
name: '8e3af657-a8ff-443c-a75c-2fe8c4bcb635' | |
} | |
resource keyVaultAdminRoleAssignment 'Microsoft.Authorization/roleAssignments@2020-04-01-preview' = { | |
name: guid(containersRGMI, containersRGMI, keyVaultAdministratorRoleDefinition.id) | |
properties: { | |
roleDefinitionId: keyVaultAdministratorRoleDefinition.id | |
principalId: managedIdentity.properties.principalId | |
principalType: 'ServicePrincipal' | |
} | |
} | |
resource OwnerRoleAssignment 'Microsoft.Authorization/roleAssignments@2020-04-01-preview' = { | |
name: guid(containersRGMI, containersRGMI, OwnerRoleDefinition.id) | |
properties: { | |
roleDefinitionId: OwnerRoleDefinition.id | |
principalId: managedIdentity.properties.principalId | |
principalType: 'ServicePrincipal' | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment