Closed SvenSowa closed 4 months ago
Hi @SvenSowa, many thanks for your submission. I delighted to see engagement from our community! Regrettably though, we cannot merge this due to several reason relating to how Azure Policy and ALZ (this repo) handles policy.
escape
template functions which include parameters
hence the double [[
. This is required for ALZ purposes, and you will see this in every policy/initiative in this repo. DeployIfNotExists
and one with lower d deployIfNotExists
. These are not evaluated the same and is related to how the built-in policy defined the allowed effect parameter. I hope this makes sense, and feel free to comment on this, I really don't want to discourage you from contributing! I'll close the PR for now, as we can't proceed.
Fixed double square brackets "[[parameters". Fixed double "effect, effect1", removed "effect1". Fixed "defaultValue": "" and removed it, since all parameters are really required.
Overview/Summary
The updated template can be deployed via the REST API without an error. Also, it will show the parameters correctly in the Azure portal.
This PR fixes/adds/changes/removes
Breaking Changes
Testing Evidence
When deployed with "[[parameters" syntax error, the REST API throws this error: url: https://learn.microsoft.com/en-us/rest/api/policy/policy-set-definitions/create-or-update?view=rest-policy-2023-04-01&tabs=HTTP&tryIt=true&source=docs#code-try-0 body: { "error": { "code": "UnusedPolicyParameters", "message": "The policy set '' has defined parameters 'azureFilePrivateDnsZoneId,azureAutomationWebhookPrivateDnsZoneId,azureAutomationDSCHybridPrivateDnsZoneId,azureCosmosSQLPrivateDnsZoneId,azureCosmosMongoPrivateDnsZoneId,azureIotCentralPrivateDnsZoneId,azureStorageTablePrivateDnsZoneId,azureStorageTableSecondaryPrivateDnsZoneId,azureSiteRecoveryBackupPrivateDnsZoneID,azureSiteRecoveryBlobPrivateDnsZoneID,azureSiteRecoveryQueuePrivateDnsZoneID' which are not used in referenced policy definitions. Please either remove these parameters from the definition or ensure that they are used."
}
}
When deployed with "effect" and "effect1", it will show double in the Azure portal:
When deployed with "defaultValue": "", it will not show the parameters in the Azure portal, even though they are really required:
The fixed version can be deployed trough the REST API, plus it will show the parameters correctly and the effect shows up only once:
Azure Public
[](https://portal.azure.com/#blade/Microsoft_Azure_CreateUIDef/CustomDeploymentBlade/uri/https%3A%2F%2Fraw.githubusercontent.com%2F{YOUR GITHUB ORG/ACCOUNT HERE - Remove Curly Brackets Also}%2FEnterprise-Scale%2F{YOUR GITHUB BRANCH NAME HERE - Remove Curly Brackets Also}%2FeslzArm%2FeslzArm.json/uiFormDefinitionUri/https%3A%2F%2Fraw.githubusercontent.com%2F{YOUR GITHUB ORG/ACCOUNT HERE - Remove Curly Brackets Also}%2FEnterprise-Scale%2F{YOUR GITHUB BRANCH NAME HERE - Remove Curly Brackets Also}%2FeslzArm%2Feslz-portal.json)
Azure US Gov (Fairfax)
[](https://portal.azure.us/#blade/Microsoft_Azure_CreateUIDef/CustomDeploymentBlade/uri/https%3A%2F%2Fraw.githubusercontent.com%2F{YOUR GITHUB ORG/ACCOUNT HERE - Remove Curly Brackets Also}%2FEnterprise-Scale%2F{YOUR GITHUB BRANCH NAME HERE - Remove Curly Brackets Also}%2FeslzArm%2FeslzArm.json/uiFormDefinitionUri/https%3A%2F%2Fraw.githubusercontent.com%2F{YOUR GITHUB ORG/ACCOUNT HERE - Remove Curly Brackets Also}%2FEnterprise-Scale%2F{YOUR GITHUB BRANCH NAME HERE - Remove Curly Brackets Also}%2FeslzArm%2Ffairfaxeslz-portal.json)
As part of this Pull Request I have
main
branch/docs/wiki/whats-new.md
)