Gallery › Mission › Azure built-in policies
Virtual Network should Deny private endpoints linked to services in other tenants
Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0
This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. Prevents private endpoints from connecting to services in other Azure AD tenants to ensure data doesn't leave the organization's control and reduce the risk of data exfiltration.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONVNETRestrictInternalPE_Audit.json · 106 lines
{
"properties": {
"displayName": "Virtual Network should Deny private endpoints linked to services in other tenants",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. Prevents private endpoints from connecting to services in other Azure AD tenants to ensure data doesn't leave the organization's control and reduce the risk of data exfiltration.",
"metadata": {
"version": "1.0.0",
"category": "Mission"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Audit"
},
"exemptPeExternalSubIds": {
"type": "Array",
"metadata": {
"displayName": "Exempt Private Endpoint External Subscription IDs",
"description": "List of external subscription IDs that are exempted from the policy"
},
"defaultValue": []
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Network/privateEndpoints"
},
{
"anyOf": [
{
"count": {
"field": "Microsoft.Network/privateEndpoints/manualprivateLinkServiceConnections[*]",
"where": {
"allOf": [
{
"field": "Microsoft.Network/privateEndpoints/manualprivateLinkServiceConnections[*].privateLinkServiceId",
"notEquals": ""
},
{
"value": "[split(concat(current('Microsoft.Network/privateEndpoints/manualprivateLinkServiceConnections[*].privateLinkServiceId'), '//'), '/')[2]]",
"notEquals": "[subscription().subscriptionId]"
},
{
"not": {
"value": "[split(concat(current('Microsoft.Network/privateEndpoints/manualprivateLinkServiceConnections[*].privateLinkServiceId'), '//'), '/')[2]]",
"in": "[parameters('exemptPeExternalSubIds')]"
}
}
]
}
},
"greaterOrEquals": 1
},
{
"count": {
"field": "Microsoft.Network/privateEndpoints/privateLinkServiceConnections[*]",
"where": {
"allOf": [
{
"field": "Microsoft.Network/privateEndpoints/privateLinkServiceConnections[*].privateLinkServiceId",
"notEquals": ""
},
{
"value": "[split(concat(current('Microsoft.Network/privateEndpoints/privateLinkServiceConnections[*].privateLinkServiceId'), '//'), '/')[2]]",
"notEquals": "[subscription().subscriptionId]"
},
{
"not": {
"value": "[split(concat(current('Microsoft.Network/privateEndpoints/privateLinkServiceConnections[*].privateLinkServiceId'), '//'), '/')[2]]",
"in": "[parameters('exemptPeExternalSubIds')]"
}
}
]
}
},
"greaterOrEquals": 1
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/ee59ea13-92cf-4d3f-acf4-009bf9702aab",
"name": "ee59ea13-92cf-4d3f-acf4-009bf9702aab"
}Bylawee59ea13-92cf-4d3f-acf4-009bf9702aab.bylaw.ps1 · 46 lines
# Converted from VNETRestrictInternalPE_Audit.json by ConvertTo-Bylaw.
Policy 'ee59ea13-92cf-4d3f-acf4-009bf9702aab' {
Properties @{
DisplayName = 'Virtual Network should Deny private endpoints linked to services in other tenants'
Description = 'This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. Prevents private endpoints from connecting to services in other Azure AD tenants to ensure data doesn''t leave the organization''s control and reduce the risk of data exfiltration.'
Version = '1.0.0'
Category = 'Mission'
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Parameter ExemptPeExternalSubIds @{
Type = 'Array'
Default = @()
DisplayName = 'Exempt Private Endpoint External Subscription IDs'
Description = 'List of external subscription IDs that are exempted from the policy'
}
Resource 'Microsoft.Network/privateEndpoints' {
Require 'manualprivateLinkServiceConnections and privateLinkServiceId are as required' {
Count 'manualprivateLinkServiceConnections[*]' -Where {
Field privateLinkServiceId | Must -Not -Be ''
Arm '[split(concat(current(''Microsoft.Network/privateEndpoints/manualprivateLinkServiceConnections[*].privateLinkServiceId''), ''//''), ''/'')[2]]' | Must -Not -Be (Arm '[subscription().subscriptionId]')
Arm '[split(concat(current(''Microsoft.Network/privateEndpoints/manualprivateLinkServiceConnections[*].privateLinkServiceId''), ''//''), ''/'')[2]]' | Must -Not -BeIn (Param ExemptPeExternalSubIds)
} | Must -Be 0
}
Require 'privateLinkServiceConnections and privateLinkServiceId are as required' {
Count 'privateLinkServiceConnections[*]' -Where {
Field privateLinkServiceId | Must -Not -Be ''
Arm '[split(concat(current(''Microsoft.Network/privateEndpoints/privateLinkServiceConnections[*].privateLinkServiceId''), ''//''), ''/'')[2]]' | Must -Not -Be (Arm '[subscription().subscriptionId]')
Arm '[split(concat(current(''Microsoft.Network/privateEndpoints/privateLinkServiceConnections[*].privateLinkServiceId''), ''//''), ''/'')[2]]' | Must -Not -BeIn (Param ExemptPeExternalSubIds)
} | Must -Be 0
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Mission/VNETRestrictInternalPE_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw