Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch policy library for Azure China #253

Merged
merged 69 commits into from
Jun 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
56a093d
Update Policy Library for Azure China (automated)
actions-user Jan 11, 2022
cf85d6f
Update Policy Library for Azure China (automated)
actions-user Jan 28, 2022
2e9b87d
Update Policy Library for Azure China (automated)
actions-user Jan 31, 2022
be7e5b3
Update Policy Library for Azure China (automated)
actions-user Feb 23, 2022
ceba1a9
Update Policy Library for Azure China (automated)
actions-user Apr 12, 2022
20d646c
Update Policy Library for Azure China (automated)
actions-user May 5, 2022
34d477b
fixed conflicts
faister May 25, 2022
36f693f
Merge branch 'patch-policy-library-china' of https://github.com/Azure…
faister May 25, 2022
8ecf1ec
Create main.yml
faister May 27, 2022
e5ee956
Update Invoke-PolicyToBicep-China.ps1
faister May 27, 2022
20995e2
creating lib\china\policy_assignments folder structure for workflow t…
faister May 27, 2022
3c4a097
update to Invoke-PolicyToBicep-China.ps1
faister May 27, 2022
ef929db
Update Invoke-PolicyToBicep-China.ps1
faister May 27, 2022
240eaf7
updated policy assignment section for Mooncake
faister May 27, 2022
52d74a4
creating lib/china/policy_assignments path
faister May 27, 2022
94f36ee
Update Policy Library for Azure China (automated)
actions-user May 27, 2022
345a089
adding source policy assignment path for China
faister May 27, 2022
7e03389
Merge branch 'patch-policy-library-china' of https://github.com/faist…
faister May 27, 2022
cc36eed
Adding policy assignments folder for China
faister May 27, 2022
613ae3b
populate assignments folder from es source
faister May 27, 2022
49f14cd
Merge branch 'Azure:main' into main
faister May 29, 2022
b4d925b
Merge branch 'main' of https://github.com/Azure/ALZ-Bicep
faister May 30, 2022
7220c04
Merge branch 'main' of https://github.com/faister/ALZ-Bicep
faister May 30, 2022
c202d4b
added _mc_policyAssignmentsBicepInput.txt
faister May 30, 2022
98dc776
test
faister May 30, 2022
af4061a
test
faister May 30, 2022
5977270
Update Policy Library for Azure China (automated)
actions-user May 30, 2022
465f0d0
try parsing policyAssignments for global regions
faister May 30, 2022
cdbb835
update
faister May 30, 2022
2567dcf
populated policy assignment files for Mooncake
faister May 30, 2022
4f0fcea
hand populated policy assignment files for Mooncake
faister May 30, 2022
83c85ad
Update Policy Library for Azure China (automated)
actions-user May 30, 2022
65afb7b
Update Policy Library for Azure China (automated)
actions-user May 30, 2022
99358e0
Update Policy Library for Azure China (automated)
actions-user May 31, 2022
0f970ee
tested entire deployment flow in Azure China
faister Jun 1, 2022
3c93f48
Merge branch 'patch-policy-library-china' of https://github.com/faist…
faister Jun 1, 2022
271cb41
added separate lib/china folder for policy assignments
faister Jun 1, 2022
cea4c8a
Update Policy Library for Azure China (automated)
actions-user Jun 1, 2022
10723a7
fixes
faister Jun 1, 2022
2a594e6
fix
faister Jun 1, 2022
1763db8
Update Policy Library for Azure China (automated)
actions-user Jun 1, 2022
eb57286
changing alzDefaultPolicyAssignments.parameters.example.json back to …
faister Jun 1, 2022
ad678d8
cleaned up default pol assignments bicep file
faister Jun 1, 2022
69fe3d2
Update infra-as-code/bicep/modules/policy/assignments/alzDefaults/REA…
faister Jun 8, 2022
3ddbc73
Merge branch 'main' of https://github.com/faister/ALZ-Bicep into patc…
faister Jun 15, 2022
c9db21e
Update Policy Library for Azure China (automated)
actions-user Jun 20, 2022
d827f12
merged incoming changes
faister Jun 22, 2022
ac630a2
more incoming changes - from es upstream repo
faister Jun 22, 2022
6e8a49d
Update Policy Library for Azure China (automated)
actions-user Jun 22, 2022
ab19408
Merge branch 'main' of https://github.com/Azure/ALZ-Bicep into patch-…
faister Jun 23, 2022
ab8aa20
more fetched updates from upstream
faister Jun 23, 2022
038a52c
updated variables for policy definition and policy set definitions
faister Jun 23, 2022
a48bd7d
Update Policy Library for Azure China (automated)
actions-user Jun 23, 2022
032f3aa
law worspace account location is chinaeast2 for mc
faister Jun 24, 2022
6c15846
Merge branch 'patch-policy-library-china' of https://github.com/faist…
faister Jun 24, 2022
7214af8
fixes in alzDefaults and identation in json files
faister Jun 24, 2022
af97f6f
removed test yml file
faister Jun 24, 2022
0d89dc5
reverted change to params file in hubPeeredSpoke orchestration module
faister Jun 24, 2022
e4dd3a6
reverted change
faister Jun 24, 2022
cf5f305
Changed indent size
faister Jun 27, 2022
11e70bb
Update _mc_policySetDefinitionsBicepInput.txt
faister Jun 27, 2022
76987cb
Update Policy Library for Azure China (automated)
actions-user Jun 27, 2022
03e6873
Merge branch 'main' of https://github.com/Azure/ALZ-Bicep into patch-…
faister Jun 28, 2022
1503b98
Update infra-as-code/bicep/modules/policy/assignments/alzDefaults/mc-…
faister Jun 28, 2022
37f2e64
Merge branch 'patch-policy-library-china' of https://github.com/faist…
faister Jun 28, 2022
4282d98
reinserting modPolicyAssignmentConnEnableDDoSVNET
faister Jun 28, 2022
9942e90
reinserted modPolicyAssignmentConnEnableDdosVnet
faister Jun 28, 2022
0e61fc7
updated ValidateMcCloud yaml file
faister Jun 29, 2022
e00d8d6
Merge branch 'main' into patch-policy-library-china
jfaurskov Jun 29, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/scripts/Invoke-PolicyToBicep-China.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ $policyDefCount = Get-ChildItem -Recurse -Path "./infra-as-code/bicep/modules/po
$policyDefCountString = $policyDefCount.Count
Write-Information "====> Policy Set/Initiative Definitions Total: $policyDefCountString" -InformationAction Continue

# Policy Asssignments - no separate policy assignments for Azure China, reusing the same assignments as Azure global regions
# Policy Asssignments - separate policy assignments for Azure China due to different policy definitions - missing built-in policies, and features

Write-Information "====> Creating/Emptying '_policyAssignmentsBicepInput.txt'" -InformationAction Continue
Set-Content -Path "./infra-as-code/bicep/modules/policy/assignments/lib/policy_assignments/_policyAssignmentsBicepInput.txt" -Value $null -Encoding "utf8"
Write-Information "====> Creating/Emptying '_mc_policyAssignmentsBicepInput.txt'" -InformationAction Continue
Set-Content -Path "./infra-as-code/bicep/modules/policy/assignments/lib/china/policy_assignments/_mc_policyAssignmentsBicepInput.txt" -Value $null -Encoding "utf8"

Write-Information "====> Looping Through Policy Assignments:" -InformationAction Continue
Get-ChildItem -Recurse -Path "./infra-as-code/bicep/modules/policy/assignments/lib/policy_assignments" -Filter "*.json" | ForEach-Object {
Get-ChildItem -Recurse -Path "./infra-as-code/bicep/modules/policy/assignments/lib/china/policy_assignments" -Filter "*.json" | ForEach-Object {
$policyAssignment = Get-Content $_.FullName | ConvertFrom-Json -Depth 100

$policyAssignmentName = $policyAssignment.name
Expand All @@ -127,10 +127,10 @@ Get-ChildItem -Recurse -Path "./infra-as-code/bicep/modules/policy/assignments/l
# Remove hyphens from Policy Assignment Name
$policyAssignmentNameNoHyphens = $policyAssignmentName.replace("-","")

Write-Information "==> Adding '$policyAssignmentName' to '$PWD/_policyAssignmentsBicepInput.txt'" -InformationAction Continue
Add-Content -Path "./infra-as-code/bicep/modules/policy/assignments/lib/policy_assignments/_policyAssignmentsBicepInput.txt" -Encoding "utf8" -Value "var varPolicyAssignment$policyAssignmentNameNoHyphens = {`r`n`tdefinitionId: '$policyAssignmentDefinitionID'`r`n`tlibDefinition: json(loadTextContent('../../policy/assignments/lib/policy_assignments/$fileName'))`r`n}`r`n"
Write-Information "==> Adding '$policyAssignmentName' to '$PWD/_mc_policyAssignmentsBicepInput.txt'" -InformationAction Continue
Add-Content -Path "./infra-as-code/bicep/modules/policy/assignments/lib/china/policy_assignments/_mc_policyAssignmentsBicepInput.txt" -Encoding "utf8" -Value "var varPolicyAssignment$policyAssignmentNameNoHyphens = {`r`n`tdefinitionID: '$policyAssignmentDefinitionID'`r`n`tlibDefinition: json(loadTextContent('../../policy/assignments/lib/china/policy_assignments/$fileName'))`r`n}`r`n"
}

$policyAssignmentCount = Get-ChildItem -Recurse -Path "./infra-as-code/bicep/modules/policy/assignments/lib/policy_assignments" -Filter "*.json" | Measure-Object
$policyAssignmentCount = Get-ChildItem -Recurse -Path "./infra-as-code/bicep/modules/policy/assignments/lib/china/policy_assignments" -Filter "*.json" | Measure-Object
$policyAssignmentCountString = $policyAssignmentCount.Count
Write-Information "====> Policy Assignments Total: $policyAssignmentCountString" -InformationAction Continue
Write-Information "====> Policy Assignments Total: $policyAssignmentCountString" -InformationAction Continue
2 changes: 1 addition & 1 deletion .github/workflows/update-policy-china.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
run: |
echo "Pushing changes to origin..."
git add infra-as-code/bicep/modules/policy/definitions/lib/china
git add infra-as-code/bicep/modules/policy/assignments/lib
git add infra-as-code/bicep/modules/policy/assignments/lib/china
git commit -m '${{ env.pr_title }}'
git push origin ${{ env.branch_name }}
working-directory: ${{ github.repository }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The module does not generate any outputs.

> For the examples below we assume you have downloaded or cloned the Git repo as-is and are in the root of the repository as your selected directory in your terminal of choice.
<!-- markdownlint-disable -->
> **Important:** If you decide to not use a DDoS Standard plan in your environment and therefore leave the parameter `parDdosProtectionPlanId` as an empty string (`''`) then the policy Enable-DDoS-VNET will not be assigned at connectivity or landing zone Management Groups to avoid VNET deployment issues.
> **Important:** If you decide to not use a DDoS Standard plan in your environment and therefore leave the parameter `parDdosProtectionPlanId` as an empty string (`''`) then the policy Enable-DDoS-VNET will not be assigned at connectivity or landing zone Management Groups to avoid VNET deployment issues. For deployment in Azure China, leave the parameter `parDdosProtectionPlanId` as an empty string (`''`) because the DDoS Protection feature is not available in Azure China.
>
> However, if you later do decide to deploy an DDoS Standard Plan, you will need to remember to come back and update the parameter `parDdosProtectionPlanId` with the resource ID of the DDoS Standard Plan to ensure the policy is applied to the relevant Management Groups. You can then use a policy [remediation task](https://docs.microsoft.com/azure/governance/policy/how-to/remediate-resources) to bring all non-compliant VNETs back into compliance, once a [compliance scan](https://docs.microsoft.com/azure/governance/policy/how-to/get-compliance-data#evaluation-triggers) has taken place.
<!-- markdownlint-restore -->
Expand All @@ -47,7 +47,7 @@ OR
```bash
# For Azure China regions
az deployment mg create \
--template-file infra-as-code/bicep/modules/policy/assignments/alzDefaults/alzDefaultPolicyAssignments.bicep \
--template-file infra-as-code/bicep/modules/policy/assignments/alzDefaults/mc-alzDefaultPolicyAssignments.bicep \
--parameters @infra-as-code/bicep/modules/policy/assignments/alzDefaults/parameters/alzDefaultPolicyAssignments.parameters.all.json \
--location chinaeast2 \
--management-group-id alz
Expand All @@ -67,7 +67,7 @@ OR
```powershell
# For Azure China regions
New-AzManagementGroupDeployment `
-TemplateFile infra-as-code/bicep/modules/policy/assignments/alzDefaults/alzDefaultPolicyAssignments.bicep `
-TemplateFile infra-as-code/bicep/modules/policy/assignments/alzDefaults/mc-alzDefaultPolicyAssignments.bicep `
-TemplateParameterFile infra-as-code/bicep/modules/policy/assignments/alzDefaults/parameters/alzDefaultPolicyAssignments.parameters.all.json `
-Location chinaeast2 `
-ManagementGroupId alz
Expand Down
Loading