-1

My Azure web app crashes on startup when trying to connect to Azure SQL. This is a blazor web app, the azure sql server firewall is not allowing traffic through from the web app. I find the web app ip ranges, add them to firewall exceptions on the sql side, and it works until I redeploy the app. How can I give my Web app permanent access to the azure SQL server? I thought checking the box for 'Allow azure services and resources to access this server' would work, but it seems to do nothing AFAIK. The connection string the web app uses is in the format:

Server=tcp:xxxx.database.windows.net,1433;Initial Catalog=xxxx;Persist Security Info=False;User ID=xxxxx;Password=xxxxxx;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;

enter image description here

enter image description here

enter image description here

9
  • You don't need to touch the Azure SQL firewall rules: that's for incoming connections from outside Azure's network; if you're using Azure AppServices then you won't need to do anything. Also, please share the actual error you get.
    – Dai
    Commented Jul 8 at 23:17
  • ...and why did you tag this with azure-devops? Your post doesn't talk about TFS at all.
    – Dai
    Commented Jul 8 at 23:17
  • The error is in the screenshot @Dai Commented Jul 8 at 23:22
  • An error occurred using the connection to database 'xxx' on server 'tcp:xxx.database.windows.net,1433'. This is literally all that azure will give me. I had to add application insights even to see this. Why would adding network exceptions get it to work for a short time if this isn't a firewall problem? Commented Jul 8 at 23:23
  • Is the Azure App Service in the same Azure Region as the DB?
    – Dai
    Commented Jul 8 at 23:57

0