Gallery › Network › Azure Community Policy
Prevent cross tenant Private Link for eventgrid domains
Converted Policy Audit Deny Disabled Mode All Version 1.0.0
This policy prevents private link between tenants for eventgrid domains.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONazurepolicy.json · 56 lines
{
"name": "d733d766-d5d7-46e3-88fa-2cf5dff0db3d",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Prevent cross tenant Private Link for eventgrid domains",
"description": "This policy prevents private link between tenants for eventgrid domains.",
"metadata": {
"category": "Network",
"createdBy": "",
"updatedBy": null,
"updatedOn": null,
"version": "1.0.0"
},
"mode": "All",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Deny, Audit or Disabled the execution of the Policy"
},
"allowedValues": [
"Deny",
"Audit",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"equals": "Microsoft.EventGrid/domains/privateEndpointConnections",
"field": "type"
},
{
"anyOf": [
{
"exists": false,
"field": "Microsoft.EventGrid/domains/privateEndpointConnections/privateEndpoint.id"
},
{
"notEquals": "[subscription().subscriptionId]",
"value": "[split(concat(field('Microsoft.EventGrid/domains/privateEndpointConnections/privateEndpoint.id'), '//'), '/')[2]]"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
}
}Bylawd733d766-d5d7-46e3-88fa-2cf5dff0db3d.bylaw.ps1 · 31 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy 'd733d766-d5d7-46e3-88fa-2cf5dff0db3d' {
Properties @{
DisplayName = 'Prevent cross tenant Private Link for eventgrid domains'
Description = 'This policy prevents private link between tenants for eventgrid domains.'
Category = 'Network'
Version = '1.0.0'
Mode = 'All'
}
Parameter Effect @{
AllowedValues = @('Deny', 'Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Deny, Audit or Disabled the execution of the Policy'
}
Resource 'Microsoft.EventGrid/domains/privateEndpointConnections' {
Require 'privateEndpoint.id exists' {
Field privateEndpoint.id | Must -Exist
}
Require 'privateEndpoint.id is as required' {
Arm '[split(concat(field(''Microsoft.EventGrid/domains/privateEndpointConnections/privateEndpoint.id''), ''//''), ''/'')[2]]' | Must -Be (Arm '[subscription().subscriptionId]')
}
}
Effect (Param Effect)
}Source: policyDefinitions/Network/prevent-cross-tenant-private-link-for-eventgrid-domains/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw