-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauthorization.bicep
61 lines (45 loc) · 1.94 KB
/
authorization.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
54
55
56
57
58
59
60
61
import * as _authVar from 'private/variables/authorization.bicep'
import * as _authType from 'private/types/authorization.bicep'
import * as _authFunction from 'private/functions/authorization.bicep'
import * as _resourceType from 'private/types/resource.bicep'
/* ----------------------------------------
🤠 Bicep# - Public variables 🤠
------------------------------------------- */
@description('''
All Azure built-in roles and custom roles.
Please note, this list is generated during compile-time for Bicep# with a specific tenant.
- Built-in roles as specified at https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles.
''')
@export()
var roles = _authVar.roles
/* ----------------------------------------
😎 Bicep# - Public types 😎
------------------------------------------- */
@export()
type roleAssignmentProperties = _authType.roleAssignmentProperties
@export()
type roleAssignmentName = _authType.roleAssignmentName
@description('''
Type of the role value
''')
@export()
type roleGuid = _authType.roleGuid
/* ----------------------------------------
💪 Bicep# - Public functions 💪
------------------------------------------- */
@description('''
Build a role assignment for a service principal identity.
''')
@export()
func buildRoleAssignmentForServicePrincipal(roleId string, principalId string, targetResourceName string) _resourceType.resourceFormat => {
name: guid(resourceGroup().id, targetResourceName, roleId, principalId)
properties: _authFunction.buildRoleAssignmentProperties(roleId, principalId, 'ServicePrincipal')
}
@description('''
Build a role assignment for a group identity.
''')
@export()
func buildRoleAssignmentForGroup(roleId string, principalId string, targetResourceName string) _resourceType.resourceFormat => {
name: guid(resourceGroup().id, targetResourceName, roleId, principalId)
properties: _authFunction.buildRoleAssignmentProperties(roleId, principalId, 'Group')
}