debugsqlMinor
Can't connect to Azure SQL with error 18456
Viewed 0 times
canerrorconnectsqlwithazure18456
Problem
I'm trying to grant access to my Azure SQL database (on an elastic pool) to an external developer using SQL Authentication.
In the database (not master) I ran the following commands:
He can't access the database, he gets the error:
Both our IPs have been whitelisted, but only I can login to the database with those credentials. Any idea where things are going wrong?
In the database (not master) I ran the following commands:
create user [UserName] with password='Password', default_schema=[dbo]alter role db_owner add member [UserName]He can't access the database, he gets the error:
Login failed for user 'UserName'. (.Net SqlClient Data Provider) Error Number: 18456 Severity: 14 State: 1 Line Number: 65536Both our IPs have been whitelisted, but only I can login to the database with those credentials. Any idea where things are going wrong?
Solution
There are a bunch of reasons their attempt to log in could fail, chief among them being they are just not typing the username or password correctly
Check the
This will let you know if they are having firewall issues (
Check the
sys.event_log DMV for a more detailed reason for the login failure. You should be able to filter to connection_failed events:SELECT *
FROM sys.event_log
WHERE event_type = 'connection_failed'
ORDER BY start_time DESC;This will let you know if they are having firewall issues (
blocked_by_firewall), timeouts (client_close), typos (invalid_login_name), etc.Code Snippets
SELECT *
FROM sys.event_log
WHERE event_type = 'connection_failed'
ORDER BY start_time DESC;Context
StackExchange Database Administrators Q#271503, answer score: 3
Revisions (0)
No revisions yet.