-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.bicep
32 lines (25 loc) · 1.02 KB
/
main.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
targetScope = 'tenant'
@description('Management group id')
param managementGroupId string
@description('Management group display name')
param managementGroupDisplayName string
@description('Management group id of the parent management group')
param parentManagementGroupId string = ''
@description('Subscription id of the subscription(s) to add to the management group')
param subscriptionIds array
resource managementGroup 'Microsoft.Management/managementGroups@2020-05-01' = {
name: managementGroupId
properties: {
displayName: managementGroupDisplayName
details: {
parent: {
id: (!empty(parentManagementGroupId)) ? '/providers/Microsoft.Management/managementGroups/${parentManagementGroupId}' : null
}
}
}
}
resource managementGroupsubscriptions 'Microsoft.Management/managementGroups/subscriptions@2020-05-01' = [for subscriptionId in subscriptionIds: {
name: subscriptionId
parent: managementGroup
}]
output managementGroupID string = managementGroup.name