Skip to content

Commit

Permalink
Flexible policy assignment parameters JSON files (Azure#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
SenthuranSivananthan authored Mar 31, 2022
1 parent f25f957 commit 0210df4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
1 change: 0 additions & 1 deletion .pipelines/policy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,3 @@ stages:
deployOperation: ${{ variables['deployOperation'] }}
policyAssignmentManagementGroupScope: $(var-topLevelManagementGroupName)
workingDir: $(System.DefaultWorkingDirectory)/policy/builtin/assignments

13 changes: 11 additions & 2 deletions .pipelines/templates/steps/assign-policy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,18 @@ steps:
inlineScript: |
$(var-bashPreInjectScript)
echo "Populating templated parameters in ${{ policy }}.parameters.json"
parameterFileName=''
cp ${{ policy }}.parameters.json ${{ policy }}.populated.parameters.json
if [ -f '${{ policy }}-${{ parameters.policyAssignmentManagementGroupScope }}.parameters.json' ]
then
parameterFileName='${{ policy }}-${{ parameters.policyAssignmentManagementGroupScope }}.parameters.json'
else
parameterFileName='${{ policy }}.parameters.json'
fi
echo "Populating templated parameters: $parameterFileName"
cp $parameterFileName ${{ policy }}.populated.parameters.json
sed -i 's~{{var-topLevelManagementGroupName}}~$(var-topLevelManagementGroupName)~g' ${{ policy }}.populated.parameters.json
Expand Down

0 comments on commit 0210df4

Please sign in to comment.