-
Notifications
You must be signed in to change notification settings - Fork 2
/
policy.bicep
27 lines (23 loc) · 885 Bytes
/
policy.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
targetScope = 'subscription'
var stringArray = [
'./policies/policy_1.json'
]
var policies = [for i in range(0, length(stringArray)): json(loadTextContent(stringArray[i]))]
resource policyDefinition 'Microsoft.Authorization/policyDefinitions@2020-09-01' = [for policy in policies: {
name: '${policy.properties.displayName}'
properties: {
displayName: policy.properties.displayName
policyType: policy.properties.policyType
mode: policy.properties.mode
metadata: policy.properties.metadata
parameters: policy.properties.parameters
policyRule: policy.properties.policyRule
}
}]
resource policyAssignment 'Microsoft.Authorization/policyAssignments@2020-09-01' = [for (policy,i) in policies: {
name: '${policy.properties.displayName}'
properties: {
policyDefinitionId: policyDefinition[i].id
displayName: policy.properties.displayName
}
}]