-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update managementGroups.jq Switching to template based * Add managementGroups.template.jq Initial template structure * Update AzOpsScope.ps1 Remove parameter file generation for templates * Delete managementGroups.jq Replace with jq template file * Update managementGroups.template.jq Add support for nested deployments of Management Groups * Update managementGroups.template.jq Add condition for subscription resources * Update managementGroups.template.jq Fix schema link * Update managementGroups.template.jq Add control flows for empty arrays * Update managementGroups.template.jq Replace deployment name * Update Strings.psd1 Add WhatIfWarning message * Update New-AzOpsDeployment.ps1 Add control flows for WhatIf API errors
- Loading branch information
Showing
5 changed files
with
126 additions
and
30 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
80 changes: 80 additions & 0 deletions
80
src/data/template/Microsoft.Management/managementGroups.template.jq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
. | . as $input | | ||
|
||
[ | ||
if $input.Children != null | ||
then | ||
foreach $input.Children[] as $item ([[],[]]; | ||
if $item.Type == "/providers/Microsoft.Management/managementGroups" | ||
then | ||
{ | ||
"type": "Microsoft.Management/managementGroups", | ||
"apiVersion": "2020-05-01", | ||
"name": $item.Name, | ||
"scope": "/", | ||
"properties": { | ||
"displayName": $item.DisplayName, | ||
"details": { | ||
"parent": { | ||
"id": ($input.Type + "/" + $input.Name) | ||
} | ||
} | ||
} | ||
} | ||
elif $item.Type == "/subscriptions" | ||
then | ||
{ | ||
"type": "Microsoft.Management/managementGroups/subscriptions", | ||
"apiVersion": "2021-04-01", | ||
"name": ($input.Name + "/" + $item.Name), | ||
"scope": "/" | ||
} | ||
else | ||
empty | ||
end | ||
) | ||
else | ||
empty | ||
end | ||
] as $resources | | ||
|
||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2019-08-01/tenantDeploymentTemplate.json#", | ||
"contentVersion": "1.0.0.0", | ||
"parameters": {}, | ||
"variables": {}, | ||
"resources": [ | ||
{ | ||
"type": "Microsoft.Management/managementGroups", | ||
"name": .Name, | ||
"apiVersion": "0000-00-00", | ||
"scope": "/", | ||
"properties": { | ||
"displayName": .DisplayName, | ||
"details": { | ||
"parent": { | ||
"id": .ParentId | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "Microsoft.Resources/deployments", | ||
"apiVersion": "2020-10-01", | ||
"name": "AzOps-microsoft.management_managementgroups-nested", | ||
"location": "northeurope", | ||
"properties": { | ||
"mode": "Incremental", | ||
"template": { | ||
"$schema": "https://schema.management.azure.com/schemas/2019-08-01/tenantDeploymentTemplate.json#", | ||
"contentVersion": "1.0.0.0", | ||
"resources": $resources, | ||
"outputs": {} | ||
} | ||
}, | ||
"dependsOn": [ | ||
(.Type + "/" + .Name) | ||
] | ||
} | ||
], | ||
"outputs": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters