Connection to SQL Database in Azure

Reid Archibald 1 Reputation point
2022-03-31T10:54:49.287+00:00

I am trying to set up a simple web site using Azure. My program simply links to a database and lists the contents.
I am getting an error message which says that it can't connect the User to the database and provides an error schedule as follows :

SqlException: Login failed for user 'RArch'.
Microsoft.Data.ProviderBase.DbConnectionPool.CheckPoolBlockingPeriod(Exception e)

I can access the remote db from SQL Server management studio and I can run the program locally and access the database remotely.

I would think from this that the Connection string is correct and the user details are correct.

I don't understand the DbConnectionPool issue - it is beyond my current knowledge level.

Can anyone assist with sorting this out. thanks.

Azure SQL Database
{count} votes

2 answers

Sort by: Most helpful
  1. GeethaThatipatri-MSFT 29,482 Reputation points Microsoft Employee
    2022-04-12T23:01:53.297+00:00

    Hi @Reid Archibald Thanks for sharing the screenshot, I am attaching the sample code which is working for AAD connection.
    I have added the connection string to your code and I hope you are using the correct dependency192389-image.png

    Here is the connection string
    string ConnectionString = @"Server=****.database.windows.net; Authentication=Active Directory Default; Database=mytestdb1;";

            using (SqlConnection conn = new SqlConnection(ConnectionString))  
            {  
                conn.Open();  
            }  
    

    Document for reference

    Sample code192368-program.txt

    Please let me know if the information is helpful.

    Regards
    Geetha


  2. Alberto Morillo 34,151 Reputation points MVP
    2022-05-02T17:56:07.527+00:00

    Please try to set Connection Timeout=60. Other users have reported this as solution.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.