> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/appsec-rules/iac-security/public-exposure/appsec2-azure-34.md).

# Azure SQL Server allow access to any Azure internal resources misconfiguration detected in code

## Rule Details

|                        |                                      |
| ---------------------- | ------------------------------------ |
| Cortex AppSec Rule ID  | APPSEC2\_AZURE\_34                   |
| Category - Subcategory | Public Exposure - Database Endpoints |
| Provider               | AZURE                                |
| Severity               | LOW                                  |
| Framework              | Terraform, Terraform Plan            |
| Mapped CSPM/KSPM Rule  | 7f47b618-4e96-459e-bfe3-9e6f48fec533 |

## Impact

This rule pertains to Azure SQL server firewall settings and it checks to ensure the firewall is not set in an overly permissive way. This means that the firewall settings should not allow unrestricted access from any IP address to your SQL server. Allowing such wide-reaching access is bad because it significantly increases the security risk by offering potential hackers numerous opportunities to exploit your system. Instead, access should be limited to specific, trusted IP addresses to maintain a robust security posture.

## How to Fix

*Resource:* azurerm\_sql\_firewall\_rule

* *Arguments:* start\_ip\_address, end\_ip\_address

To fix this rule issue, you should define firewall rules to restrict source IP ranges of Azure SQL server. The start and end IP address in the firewall rule should not be from 0.0.0.0 to 255.255.255.255 except when the access type is AzureServices.

## The provided code now follows security best practices by employing input validation for the IP range. It restricts the IP range to a single IP instead of allowing all, thus reducing the risk of unauthorized access. A smaller IP range minimizes the surface area for attacks and decreases the chance that traffic comes from undesirable locations. \[source,go]

## resource "azurerm\_sql\_firewall\_rule" "example" { name = "firewall\_rule" resource\_group\_name = azurerm\_resource\_group.example.name server\_name = azurerm\_sql\_server.example.name start\_ip\_address = "40.112.8.12" end\_ip\_address = "40.112.8.12" }


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://cortex-docs.paloaltonetworks.com/appsec-rules/iac-security/public-exposure/appsec2-azure-34.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
