user20584398
user20584398

Reputation: 1

Unable to connect to Azure SQL database via Azure AD user when Azure AD authentication only feature enabled?

I have an Azure SQL server to which I need to connect via SSMS using some Azure AD user. [Azure Active Directory authentication only feature is enabled]

The admin of the Azure SQL server instance is the Service Principal, with the help of which I add the necessary AD user during the creation and configuration of the Azure SQL server/database.

Then I tried to connect to the database using this added user and getting following error:

Cannot connect to XXXXXX.database.windows.net.

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.) (.Net SqlClient Data Provider)

Error Number: 10060; Severity: 20; State: 0

I tried to connect to the Azure SQL database via portal and run some queries in Query editor with the same AD user, it is working perfectly.

I've checked an access to the database for my user using this query:

SELECT name as username, type_desc as type FROM sys.database_principals

And my AD user is there as an EXTERNAL_USER.

Upvotes: 0

Views: 1126

Answers (1)

Bhavani
Bhavani

Reputation: 5317

I created Azure sql database and set the admin as service principal in Azure portal and I enabled Azure Active Directory authentication only feature is enabled. Image for reference:

enter image description here

I connected database via portal and run query with AD It run successfully.

enter image description here

I tried to connect the database in SSMS using Active directory user. Image for reference:

enter image description here

I got the same error.

image for reference:

enter image description here

When I connected with V-Net I got error. When I connect to My personal hotspot and try to connect database it connected successfully. Image for reference:

enter image description here

enter image description here

enter image description here

I run the query it run successfully in SSMS.

SELECT name as username, type_desc as type FROM sys.database_principals

enter image description here

Note: Kindly check your network connection.

It worked from my end kindly check from your end.

Upvotes: 0

Related Questions