Gallery › Cache › Azure built-in policies
Azure Cache for Redis should use private link
Converted Policy AuditIfNotExists Disabled Mode Indexed Version 1.0.0
Private endpoints lets you connect your virtual network to Azure services without a public IP address at the source or destination. By mapping private endpoints to your Azure Cache for Redis instances, data leakage risks are reduced. Learn more at: https://docs.microsoft.com/azure/azure-cache-for-redis/cache-private-link.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONRedisCache_PrivateEndpoint_AINE.json · 48 lines
{
"properties": {
"displayName": "Azure Cache for Redis should use private link",
"description": "Private endpoints lets you connect your virtual network to Azure services without a public IP address at the source or destination. By mapping private endpoints to your Azure Cache for Redis instances, data leakage risks are reduced. Learn more at: https://docs.microsoft.com/azure/azure-cache-for-redis/cache-private-link.",
"metadata": {
"version": "1.0.0",
"category": "Cache"
},
"version": "1.0.0",
"policyType": "BuiltIn",
"mode": "Indexed",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"AuditIfNotExists",
"Disabled"
],
"defaultValue": "AuditIfNotExists"
}
},
"policyRule": {
"if": {
"field": "type",
"equals": "Microsoft.Cache/redis"
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.Cache/redis/privateEndpointConnections",
"existenceCondition": {
"field": "Microsoft.Cache/redis/privateEndpointConnections/privateLinkServiceConnectionState.status",
"equals": "Approved"
}
}
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/7803067c-7d34-46e3-8c79-0ca68fc4036d",
"name": "7803067c-7d34-46e3-8c79-0ca68fc4036d"
}Bylaw7803067c-7d34-46e3-8c79-0ca68fc4036d.bylaw.ps1 · 27 lines
# Converted from RedisCache_PrivateEndpoint_AINE.json by ConvertTo-Bylaw.
Policy '7803067c-7d34-46e3-8c79-0ca68fc4036d' {
Properties @{
DisplayName = 'Azure Cache for Redis should use private link'
Description = 'Private endpoints lets you connect your virtual network to Azure services without a public IP address at the source or destination. By mapping private endpoints to your Azure Cache for Redis instances, data leakage risks are reduced. Learn more at: https://docs.microsoft.com/azure/azure-cache-for-redis/cache-private-link.'
Version = '1.0.0'
Category = 'Cache'
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('AuditIfNotExists', 'Disabled')
Default = 'AuditIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Cache/redis'
AuditIfNotExists 'Microsoft.Cache/redis/privateEndpointConnections' -Effect (Param Effect) {
Require 'privateLinkServiceConnectionState.status is Approved' {
Field privateLinkServiceConnectionState.status | Must -Be 'Approved'
}
}
}Source: built-in-policies/policyDefinitions/Cache/RedisCache_PrivateEndpoint_AINE.json in Azure/azure-policy, under the MIT licence.
Bylaw