Access is denied connecting to SQL Azure database

3.1k views Asked by At

I've deployed my project to Azure and my login page loads. When I attempt to login, it hangs for a moment and returns an "Access is denied" error. I've double and triple checked my connection string and it matches the one provided by Azure.

I've deployed to Azure in the past but it's been a while. Is there something I need to do in order to make my DB accessible? I read a couple articles about similar problems people had with remote connections. It involved turning on remote connection accessibility in SSMS, but I don't see that being the case in my situation as it's not being accessed thru Sql Server.

Are there modifications I must make to my DB to make it accessible on Azure?

Here's my error: enter image description here

EDIT - I am using forms authentication for user handling if it makes a difference.

2

There are 2 answers

1
astaykov On

This error indicates that your Azure SQL Database is not configured to accept connections from the service you are trying to connect.

You have to Enable Windows Azure Services to connect to your Azure SQL Database Server.

To achieve that, navigate to your Azure SQL Database Dashboard and click on Manage Allowed IP Addresses, as shown bellow: enter image description here

Then On this new page, make sure that Windows Azure Services are enabled (YES): enter image description here

0
Brendan Maunder On

I had the same problem and found that I didn't have the database and the app service in the same location. One was in Australia East while the other was in Australia South East. I moved my app service to be in the same location as the DB and bingo. :)