I am unable to access SQL Azure DB from Azure website even though same connection string works from local website. The error is as follows:
System.Data.SqlClient.SqlException (0x80131904): Login failed for user 'XYZ'.
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception,
Boolean breakConnection, Action`1 wrapCloseInAction) at
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj,
Boolean callerHasConnectionLock, Boolean asyncClose) <...>
Error Number:18456,State:1,Class:14 <...>
After checking previous answers,


ApplicationDbContext is built using correct connection string.What else I could try?
The website code is here.
I'm not sure which portal you're using, but... in the preview portal (portal.azure.com), your database settings page will have a link to the server, and there you'll find firewall settings. And aside from IP ranges, there's an option to allow Azure services to have access to your database. You'll need that enabled.
Same thing in manage.windowsazure.com - the settings are accessible through the Configure tab.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With