Azure SQl Database

Jayaprakash Pulugovinda 0 Reputation points
2023-02-16T04:27:52.3533333+00:00

Hi Team,

 

I have created a sample database in azure cloud using azure sql database using single database approach.

Now issue is the particular database is not able to access through Azure VM or other machines but able to access through my local machine . For this i have set the fire wall rule to allow the access to all from start ip 0.0.0.0 to end ip 255.255.255.255 but still the azure Vm is not able to access the DB . Kindly let me know what is the mistake i am doing or any help is grateful .

Azure SQL Database
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Balmukund 176 Reputation points Microsoft Employee
    2023-02-16T04:55:37.17+00:00

    What is the error message you are getting? What do you see when you ping logical server name?

    for testing, can you try "Allow Azure Services" and share the behavior?


  2. Bas Pruijn 956 Reputation points
    2023-02-16T07:49:24.31+00:00

    Most likely this issue is not caused by the SQL Server/Database. I would expect the virtual network your VM is connected to is the culprit. I would expect there to be either a firewall or a NSG that is blocking internet access for this VM, or the DNS settings for this VM are preventing it to find the SQL Server.

    You could try to do a NSLOOKUP <SQL server name>.database.windows.net or ping the SQL Server from the VM. That might give you insights in if there is a network block going on.

    If you are using a windows VM, you could also use powershell to check the connection on port 1433. https://learn.microsoft.com/en-us/powershell/module/nettcpip/test-netconnection?view=windowsserver2022-ps


  3. RahulRandive 10,486 Reputation points Volunteer Moderator
    2023-02-16T11:33:19.1133333+00:00

    Hi,

    To get the meaningful network error/details, you can execute below Azure SQL Connectivity Checker from the VM 

    https://github.com/Azure/SQL-Connectivity-Checker

     

    Please follow the instruction from the blog

    You need to pass below details in the script and run from PowerShell ISE

     Server = ''

    Database = '' 

    User = '' 

    Password = '' 

    Once the script executes, it will generate an output in the folder and the folder opens automatically after the script completes.


  4. SSingh-MSFT 16,371 Reputation points Moderator
    2023-02-17T05:00:03.7233333+00:00

    Hi @Jayaprakash Pulugovinda,

    I suppose you have followed the documentation: Configure the Azure VPN Client - Azure AD authentication - Windows

    For Azure SQL Server to be accessed from Azure VM, could you please try below mentioned steps and let us know your results:

    1. Navigate to "Firewalls and virtual networks" of you SQL server and make sure to set "Deny public network access" to yes.
    2. Create an Azure private endpoint. It will create endpoint for SQL server within your virtual network and it'll be assigned a private IP from within subnet's IP range. You will use this private IP to connect to SQL server.
    3. On your local machine, make sure you're connected to VPN and open SQL Server Management Studio:
    • Under "Server name" enter private IP address of Azure private endpoint created in step 2.
    • Under "Login" field, enter username in format "username@public_sql_server_name" (e.g. ******@my-sql-server.database.windows.net). For password, just enter your password.
    • Last thing to do is to click on "Options" and navigate to "Connection properties". Make sure to check "Encrypt connection" and "Trust server certificate". This is required as server's certificate is issued to "my-sql-server.database.windows.net" and you're accessing it via private IP. If this wasn't checked, management studio wouldn't trust server's certificate and would refuse connection.

    Let us know at which step you get error.

    Please try and we can further check on this. Thanks.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.