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

Support multiple private dns zone configuration when updating private DNS Zones through Azure Policy #246

Merged
merged 5 commits into from
Apr 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 18 additions & 2 deletions policy/custom/definitions/policyset/DNSPrivateEndpoints.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,20 @@ Format of the array of objects
{
privateLinkServiceNamespace: 'Microsoft.AzureCosmosDB/databaseAccounts'
zone: 'privatelink.documents.azure.com'
filterLocationLike: "*" // when Private DNS Zone is not scoped to a region
filterLocationLike: '*' // when Private DNS Zone is not scoped to a region
groupId: 'SQL'
privateDnsZoneConfigs: [
'privatelink.documents.azure.com'
]
}
{
privateLinkServiceNamespace: 'Microsoft.ContainerService/managedCluster'
zone: 'privatelink.canadacentral.azmk8s.io'
filterLocationLike: "canadacentral" // when Private DNS Zone is scoped to a region
filterLocationLike: 'canadacentral' // when Private DNS Zone is scoped to a region
groupId: 'management'
privateDnsZoneConfigs: [
'privatelink.canadacentral.azmk8s.io'
]
}
]
*/
Expand Down Expand Up @@ -57,6 +63,15 @@ var policySetDefinitionsPrivateDNSZonesDINE = [for (privateDNSZone, i) in privat
filterLocationLike: {
value: privateDNSZone.filterLocationLike
}
privateDnsZoneSubscriptionId: {
value: '[[parameters(\'privateDNSZoneSubscriptionId\')]'
}
privateDnsZoneResourceGroupName: {
value: '[[parameters(\'privateDNSZoneResourceGroupName\')]'
}
privateDnsZoneConfigs: {
value: privateDNSZone.privateDnsZoneConfigs
}
}
}]

Expand All @@ -82,6 +97,7 @@ resource policy 'Microsoft.Authorization/policyDefinitions@2020-09-01' = [for pr
zone: privateDNSZone.zone
groupId: privateDNSZone.groupId
filterLocationLike: privateDNSZone.filterLocationLike
privateDnsZoneConfigs: privateDNSZone.privateDnsZoneConfigs
}
displayName: '${customPolicyDefinition.properties.displayName} - ${privateDNSZone.zone} - ${privateDNSZone.privateLinkServiceNamespace} - ${privateDNSZone.groupId}'
mode: customPolicyDefinition.properties.mode
Expand Down
Loading