Skip to main content

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.