Gallery › Cache › Azure built-in policies
Configure Azure Cache for Redis to disable non SSL ports
Converted Policy Disabled Modify Mode Indexed Version 1.0.0
Enable SSL only connections to Azure Cache for Redis. Use of secure connections ensures authentication between the server and the service and protects data in transit from network layer attacks such as man-in-the-middle, eavesdropping, and session-hijacking
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONRedisCache_EnableNonSSLPort_Modify.json · 62 lines
{
"properties": {
"displayName": "Configure Azure Cache for Redis to disable non SSL ports",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Enable SSL only connections to Azure Cache for Redis. Use of secure connections ensures authentication between the server and the service and protects data in transit from network layer attacks such as man-in-the-middle, eavesdropping, and session-hijacking",
"metadata": {
"category": "Cache",
"version": "1.0.0"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"Modify",
"Disabled"
],
"defaultValue": "Modify"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Cache/Redis"
},
{
"field": "Microsoft.Cache/Redis/enableNonSslPort",
"equals": "true"
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"conflictEffect": "audit",
"roleDefinitionIds": [
"/providers/microsoft.authorization/roleDefinitions/e0f68234-74aa-48ed-b826-c38b57376e17"
],
"operations": [
{
"operation": "addOrReplace",
"field": "Microsoft.Cache/Redis/enableNonSslPort",
"value": false
}
]
}
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/766f5de3-c6c0-4327-9f4d-042ab8ae846c",
"name": "766f5de3-c6c0-4327-9f4d-042ab8ae846c"
}Bylaw766f5de3-c6c0-4327-9f4d-042ab8ae846c.bylaw.ps1 · 30 lines
# Converted from RedisCache_EnableNonSSLPort_Modify.json by ConvertTo-Bylaw.
Policy '766f5de3-c6c0-4327-9f4d-042ab8ae846c' {
Properties @{
DisplayName = 'Configure Azure Cache for Redis to disable non SSL ports'
Description = 'Enable SSL only connections to Azure Cache for Redis. Use of secure connections ensures authentication between the server and the service and protects data in transit from network layer attacks such as man-in-the-middle, eavesdropping, and session-hijacking'
Category = 'Cache'
Version = '1.0.0'
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Modify', 'Disabled')
Default = 'Modify'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Cache/Redis' {
Require 'enableNonSslPort is not true' {
Field enableNonSslPort | Must -Not -Be 'true' -IfPresent
}
}
Modify -Role 'Redis Cache Contributor' -ConflictEffect Audit -Effect (Param Effect) {
Field enableNonSslPort | AddOrReplace $false
}
}Source: built-in-policies/policyDefinitions/Cache/RedisCache_EnableNonSSLPort_Modify.json in Azure/azure-policy, under the MIT licence.
Bylaw