-
Notifications
You must be signed in to change notification settings - Fork 5
/
roleassign.bicep
53 lines (46 loc) · 1.78 KB
/
roleassign.bicep
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//Scope
targetScope = 'managementGroup'
//Variables
var contributorrole = '/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c'
var monitoringrole = '/providers/Microsoft.Authorization/roleDefinitions/749f88d5-cbae-40b8-bcfc-e573ddc772fa'
var lacontributor = '/providers/Microsoft.Authorization/roleDefinitions/92aaf0da-9dab-42b6-94a3-d43ce8d16293'
//Parameters
param principalId string
param automationaccountpid string
//Resources
//This deploys the Contributor role assignment.
resource umicontributorroleassign 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(principalId, contributorrole, managementGroup().id)
properties: {
roleDefinitionId: contributorrole
principalId: principalId
principalType: 'ServicePrincipal'
}
}
//This deploys the Contributor role assignment.
resource autocontributorroleassign 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(automationaccountpid, contributorrole, managementGroup().id)
properties: {
roleDefinitionId: contributorrole
principalId: principalId
principalType: 'ServicePrincipal'
}
}
//This deploys the Monitoring Contributor role assignment.
resource monitoringroleassign 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(principalId, monitoringrole, managementGroup().id)
properties: {
roleDefinitionId: monitoringrole
principalId: principalId
principalType: 'ServicePrincipal'
}
}
//This deploys the Log Analytics Contributor role assignment.
resource lacontributorroleassign 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(principalId, lacontributor, managementGroup().id)
properties: {
roleDefinitionId: lacontributor
principalId: principalId
principalType: 'ServicePrincipal'
}
}