Created
October 3, 2021 15:48
-
-
Save cdennig/bad3cdb81bf19398625c95bc9b8d1ad5 to your computer and use it in GitHub Desktop.
roledef.bicep
This file contains hidden or 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
@description('Principal ID of the managed identity') | |
param principalId string | |
var roleDefId = guid('sql-role-definition-', principalId, cosmosDbAccount.id) | |
var roleDefName = 'Custom Read/Write role' | |
resource roleDefinition 'Microsoft.DocumentDB/databaseAccounts/sqlRoleDefinitions@2021-06-15' = { | |
name: '${cosmosDbAccount.name}/${roleDefId}' | |
properties: { | |
roleName: roleDefName | |
type: 'CustomRole' | |
assignableScopes: [ | |
cosmosDbAccount.id | |
] | |
permissions: [ | |
{ | |
dataActions: [ | |
'Microsoft.DocumentDB/databaseAccounts/readMetadata' | |
'Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/*' | |
] | |
} | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment