13

We have an Azure SQL server. From some machines in our Azure subscription we cannot connect to our SQL server, but from other machines it's fine. From machines outside of Azure we have no issues at all.

The error thrown is

Login failed for user 'SQLAdminUser'

And the SQL log itself shows:

<login_information><error_code>18456</error_code><error_state>113</error_state></login_information>

Reproduction is very simple. From an affected machine, in Powershell, execute:

$sqlConnection = New-Object System.Data.SqlClient.SqlConnection  "Server=tcp:ourdb-sql.database.windows.net,1433;Initial Catalog=SitesEE;Persist Security Info=False;User ID=SQLAdminUser;Password=[password]"
$sqlConnection.Open()

Exception calling "Open" with "0" argument(s): "Login failed for user 'SQLAdminUser'."

I don't see Error 113 documented anywhere on the official documentation. I'm assuming it's related to a VM somehow as other machines can execute that code without issues.

Mark Henderson
  • 2,586
  • 1
  • 33
  • 44

1 Answers1

20

After a support call with Microsoft, they confirmed that Error 113 is a temporary firewall ban of the connections IP address.

We had a process that had an invalid password configured, and it got enough attempts wrong that the IP address got on a ban list. It kept retrying, so it stayed on the ban list. Every VM that used that outbound IP address was thus also banned.

Fixing the errant process cleared the ban within a matter of minutes.

Documenting that here in the hope that it can save someone else the hassle of opening a support ticket to find out something that should be public documentation.

Mark Henderson
  • 2,586
  • 1
  • 33
  • 44
  • 3
    thanks for contacting Microsoft on this issue as I can confirm it was the same issue for us. We have a service on an Azure VM calling an out of process PDF optimizer we did not think hit the SQL Azure but an error handler did. There were no credentials configured and it would cause failed logins. Our main service would then start failing with same error. The IP Firewall ban must reset after a few minutes which added to the confusion. Had to turn diagnostic logging on the SQL Azure instance to find the 113 error message. – tawman Dec 11 '18 at 14:42
  • 2
    Yes! Thank you SO MUCH! We've been chasing down error 18456 but didn't think to check error_state = 113. Once we added that into the search we found this answer which described exactly what was happening. We had a dev app that had the wrong user/pass and was causing this firewall ban. Fixed that and now all good... – Marcus May 04 '21 at 17:42