If the HTTP status is a 401 you should first make sure any code path you have is not returning the 401. A 401 is an HTTP status code where as SQL would return an access denied message or another SQL specific message if there was an issue talking to the SQL server.
Trouble connecting azure web app to azure sql database
I was able to connect to my azure SQL database from my local host using the connection string. My get call returns a 200 response with data. However, when I publish the web application to azure and change the base url to my web application site, I get a 401 unauthorized response for the same get call.
I have added the connection string to the web application configuration and clicked the button to "Allow Azure services and resources to access this server" but saw no change after saving and restarting the application. Still a 401 response.
Am I missing something in terms of adding another client IP in the SQL server firewall for the published web application?
Is there perhaps a specific format that my connection string should be in that I'm unaware of?
Thanks for any help.
1 answer
Sort by: Most helpful
-
Jeremy Brooks 572 Reputation points Microsoft Employee
2020-08-05T01:20:29.32+00:00