Hi Adhitya Ravi • ,
Welcome to Microsoft Q&A forum and thanks for using Azure Services.
As I understand, you Cannot ping Azure SQL server from WSL2. We are sorry about the inconvenience you are facing.
We need to open the ports from the WSL2 please read this article. Here you will find more information about networking and WSL2.
Please check if you have added the public IP address of your Internet connection to the whitelist of Azure SQL Database firewall. Please read here to know how.
It could be also related to DNS resolution. If you the server [ServerName].database.windows.net, the ping should fail but when the ping fails it returns the current IP address of the Azure SQL Database server. If you don't see that then the issue may be related to DNS resolution from your computer.
Here you will find all steps to configure WSL2 to access a SQL Server/SQL Azure instance.
- In your connection string, use the IP address from
cat /etc/resolv.conf
- open the
1433
port in Windows Firewall. Go to New rule - Port - Next - Specific ports: 1433 - Next - Allow - Next - Next - Name "WSL2 sql" - Disconnect all VPN software in Windows (if any) - it might brake WSL2/Windows network connectivity
Make sure the corporate network allows outbound traffic on port TCP 1433.
Let us know if above information helps.
Thank you.