For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/code_security/iac_security/iac_rules/terraform-azure-redis-publicly-accessible.md.
A documentation index is available at /llms.txt.
Azure Redis Cache instances with firewall rules that allow access from public IP addresses are vulnerable to unauthorized access and potential data breaches. When configuring firewall rules, using public IP ranges (such as 1.2.3.4 to 2.3.4.5) exposes your Redis Cache to the internet, increasing the risk of brute force attacks or exploitation of vulnerabilities.
Instead, limit access to private IP ranges within your internal network (such as 10.2.3.4 to 10.3.4.5), as shown below:
resource"azurerm_redis_firewall_rule""example"{name="someIPrange"redis_cache_name=azurerm_redis_cache.example.nameresource_group_name=azurerm_resource_group.example.namestart_ip="10.2.3.4" // Private IP range
end_ip="10.3.4.5" // Private IP range
}
This ensures your Redis Cache is only accessible from within your virtual network, significantly reducing the attack surface.