Skip to main content

More Info:

Ensure that your Microsoft Azure SQL database servers are accessible through private endpoints instead of public IP addresses or service endpoints, in order to eliminate the exposure from the public Internet.

Risk Level

Medium

Address

Security

Compliance Standards

  • APRA CPS 234 (Australia)
  • BSI C5 (Germany)
  • Brazil LGPD
  • CCPA / CPRA (California)
  • CIS AZURE
  • CIS Critical Security Controls v8
  • CMMC 2.0
  • CSA Cloud Controls Matrix v4
  • Cloudanix Best Practice
  • DPDPA
  • Digital Operational Resilience Act (EU)
  • GDPR
  • HITRUST CSF
  • ISO/IEC 27017
  • ISO/IEC 27018
  • ISO/IEC 27701
  • KSA PDPL
  • MAS Technology Risk Management (Singapore)
  • MITRE ATT&CK (Cloud)
  • NIS2 Directive
  • NIST SP 800-171
  • NYDFS 23 NYCRR 500
  • Reserve Bank of India (RBI) Master Direction – Information Technology Framework
  • SOC2
  • SWIFT Customer Security Controls Framework
  • Sarbanes-Oxley IT General Controls
  • Securities and Exchange Board of India (SEBI) - Cloud Security Adoption Framework
  • UK NCSC Cyber Assessment Framework

Triage and Remediation

Remediation

Using Console

Sure, here are the step-by-step instructions to remediate the misconfiguration of “Publicly Accessible SQL Servers” in Azure:
  1. Log in to the Azure Portal (https://portal.azure.com/).
  2. Navigate to the SQL servers page by clicking on “SQL servers” in the left-hand menu.
  3. Select the SQL server that is publicly accessible.
  4. Click on the “Firewalls and virtual networks” tab.
  5. Under “Firewall settings,” select “Selected networks.”
  6. Click on the “Add client IP” button to add the IP address of your computer to the list of allowed IPs.
  7. If you want to allow access from other IPs, you can add them by clicking on the “Add IP range” button.
  8. Click on the “Save” button to save the changes.
By following these steps, you have now remediated the misconfiguration of “Publicly Accessible SQL Servers” in Azure and restricted access to only the allowed IPs.

Sure, here are the step-by-step instructions to remediate the “Publicly Accessible SQL Servers” misconfiguration in AZURE using AZURE CLI:
  1. Open the AZURE CLI and login to your AZURE account using the following command:
  1. Run the following command to list all the SQL servers in your subscription:
  1. Identify the SQL server(s) that are publicly accessible and note down their resource group name and server name.
  2. Run the following command to set the “public network access” property to “Disabled” for the identified SQL server(s):
Make sure to replace <resource-group-name> and <server-name> with the actual names of the resource group and server that you identified in step 3.
  1. Verify that the “public network access” property has been set to “Disabled” for the SQL server(s) by running the following command:
This command should return “Disabled” for the identified SQL server(s).That’s it! You have successfully remediated the “Publicly Accessible SQL Servers” misconfiguration in AZURE using AZURE CLI.
To remediate publicly accessible SQL servers in Azure using Python, you can follow these steps:
  1. First, you need to import the necessary libraries:
  1. Next, you need to authenticate with Azure using the DefaultAzureCredential class.
  1. Then, you need to create an instance of the SqlManagementClient class.
  1. After that, you can use the sql_client instance to get a list of all the SQL servers in your subscription.
  1. For each SQL server, you can check if it is publicly accessible by getting its firewall rules.
  1. If you find a SQL server with a publicly accessible firewall rule, you can delete the rule using the delete method of the FirewallRulesOperations class.
  1. Finally, you can confirm that the firewall rule has been deleted by checking the list of firewall rules again.
Note: You will need to replace <resource-group-name> with the name of the resource group containing your SQL servers.
No changes above force replacement of the existing azurerm_mssql_server resource; they are in‑place updates and additions.Verification: terraform plan should show public_network_access_enabled changing from true to false (or being added as false), plus new azurerm_private_endpoint, azurerm_private_dns_zone, and related link resources being created, with no -/+ replacement on the SQL server.