0
votes

I have two subscription plans QA-##### and Prod-########. First is used for QA environment and second one is used for the production environment. I am able to connect the Azure database on QA-###### subscription after adding my client IP in the server firewall list.

But I am not able to connect Azure SQL Database on Prod-######## subscription. When I am going to add my client IP in a server firewall rule, It's showing a success message but not listed there.

I also submitted a support ticket on azure help and support section but no response.

1

1 Answers

0
votes

Sometimes there are issues with Azure portal that affect a small set of Azure customers. My suggestion is to use PowerShell to add the firewall rule needed while you wait for the issue to be fixed by Azure Support.

# Connect-AzAccount
# The SubscriptionId in which to create these objects
$SubscriptionId = ''
# Set the resource group name and location for your server
$resourceGroupName = "myResourceGroup-$(Get-Random)"
$location = "westus2"
# Set an admin login and password for your server
$adminSqlLogin = "SqlAdmin"
$password = "ChangeYourAdminPassword1"
# Set server name - the logical server name has to be unique in the system
$serverName = "server-$(Get-Random)"


$startIp = "0.0.0.0"
$endIp = "0.0.0.0"

# Set subscription 
Set-AzContext -SubscriptionId $subscriptionId 

# Create a resource group
$resourceGroup = New-AzResourceGroup -Name $resourceGroupName -Location $location

# Create a server with a system wide unique server name
$server = New-AzSqlServer -ResourceGroupName $resourceGroupName `
    -ServerName $serverName `
    -Location $location `
    -SqlAdministratorCredentials $(New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $adminSqlLogin, $(ConvertTo-SecureString -String $password -AsPlainText -Force))

# Create a server firewall rule that allows access from the specified IP range
$serverFirewallRule = New-AzSqlServerFirewallRule -ResourceGroupName $resourceGroupName `
    -ServerName $serverName `
    -FirewallRuleName "AllowedIPs" -StartIpAddress $startIp -EndIpAddress $endIp