Share via

Troubleshooting Azure SQL Database Connectivity Issue in Web Job

Ancy 6 Reputation points
2023-10-13T06:40:30.47+00:00

Hello All,

 

We have written a .NET framework 4.8 C# code to connect the Azure SQL Database using the Username and Password and this code needs to be uploaded to Azure Web Jobs. The thing is, whenever we are running this code from Visual Studio debug mode, the code is working fine absolutely fine but after deploying this code as Web Jobs in Azure, we cannot connect SQL from that. Please note: we have also whitelisted the IPs of our local network as well as Azure Web Jobs outbound IPs in the Azure SQL server.

We are seeking assistance to resolve this connectivity problem and ensure our Web Job can connect to the Azure SQL Database seamlessly.

 

Any help would much be appreciated.

Azure SQL Database
Azure
Azure

A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.

Azure App Service
Azure App Service

Azure App Service is a service used to create and deploy scalable, mission-critical web apps.

Developer technologies | .NET | Other

1 answer

Sort by: Most helpful
  1. Ajay Kumar N 28,261 Reputation points Microsoft Employee Moderator
    2023-10-17T18:16:52.1466667+00:00

    @Ancy , Just following-up on this, as I understand, you have already allowed' the IPs of your local network as well as Azure Web Jobs outbound IPs in the Azure SQL server.

    As Olaf mentioned, please share the complete error details.
    To isolate the issue ( some additional pointers), if you haven't done already so, you may try these steps:

    1. Please review the the connection string for correctness and has the right credentials to connect to the Azure SQL Database. You can double-check/validate the connection string in the Azure portal under the Application Settings of your Web Job.
    2. Kindly double-check that the firewall rules for the Azure SQL Database are configured correctly to allow connections from the Web Job.
    3. You may always leverage App Service diagnostics from Azure Portal> Navigate to your App Service app in the Azure Portal. -In the left navigation, click on Diagnose and solve problems - Review and run – Network troubleshooter and ““Configuration and Management”  (IP address configuration)

     

    Also, you may connect your Azure App Service/WebJob to Azure SQL PaaS using Managed Identity. Please checkout Tutorial: Secure Azure SQL Database connection from App Service using a managed identity

    Kindly let us know, we will be happy to assist you further.

    Was this answer helpful?

    0 comments No comments

Your answer

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