forked from Azure/azure-docs-json-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azuredeploy.json
125 lines (125 loc) · 3.7 KB
/
azuredeploy.json
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
{
"$schema": "https://schema.management.azure.com/schemas/2019-08-01/managementGroupDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"targetMG": {
"type": "string",
"metadata": {
"description": "Specify the name of the management group."
}
},
"nestedsubId": {
"type": "string",
"metadata": {
"description": "Specify the subscription ID."
}
},
"nestedRG": {
"type": "string",
"metadata": {
"description": "Specify the name of the resource group."
}
},
"storageAccountName": {
"type": "string",
"metadata": {
"description": "Specify the name of the storage account."
}
},
"location": {
"type": "string",
"metadata": {
"description": "Specify the location for the deployment, resource group and resources."
}
}
},
"variables": {
"mgScope": "[concat('/providers/Microsoft.Management/managementGroups/', parameters('targetMG'))]"
},
"resources": [
{
"type": "Microsoft.Authorization/policyDefinitions",
"apiVersion": "2020-09-01",
"name": "policy2",
"properties": {
"policyType": "Custom",
"parameters": {
},
"policyRule": {
"if": {
"field": "location",
"equals": "northeurope"
},
"then": {
"effect": "deny"
}
}
}
},
{
"type": "Microsoft.Authorization/policyAssignments",
"apiVersion": "2020-09-01",
"name": "location-lock",
"dependsOn": [
"policy2"
],
"properties": {
"scope": "[variables('mgScope')]",
"policyDefinitionId": "[concat(variables('mgScope'), '/providers/', 'Microsoft.Authorization/policyDefinitions/', 'policy2')]"
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2021-04-01",
"name": "ps_test_management_group_deployment",
"location": "[parameters('location')]",
"subscriptionId": "[parameters('nestedSubId')]",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
},
"variables": {
},
"resources": [
{
"type": "Microsoft.Resources/resourceGroups",
"apiVersion": "2021-04-01",
"name": "[parameters('nestedRG')]",
"location": "[parameters('location')]"
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2021-04-01",
"name": "ps_test_management_group_deployment",
"resourceGroup": "[parameters('nestedRG')]",
"dependsOn": [
"[parameters('nestedRG')]"
],
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2021-04-01",
"name": "[parameters('storageAccountName')]",
"location": "[parameters('location')]",
"sku": {
"name": "Standard_LRS"
}
}
]
}
}
}
]
}
}
}
]
}