Hi Shruti Chandra •,
Welcome to Microsoft Q&A forum.
As I understand, you are not able to connect via authentication type ActiveDirectoryServicePrincipal to Azure SQL Database.
In Active Directory Service Principal
authentication mode, the client application can connect to Azure SQL data sources by providing the client ID and secret of a service principal identity. Service principal authentication involves:
- Setting up an app registration with a secret.
- Granting permissions to the app in the Azure SQL Database instance.
- Connecting with the correct credential.
The following example shows how to use Active Directory Service Principal
authentication.
// Use your own server, database, app ID, and secret.
string ConnectionString = @"Server=demo.database.windows.net; Authentication=Active Directory Service Principal; Encrypt=True; Database=testdb; User Id=AppId; Password=secret";
using (SqlConnection conn = new SqlConnection(ConnectionString)) {
conn.Open(); }
Could you please also ensure you have required dependent libraries from the Client setup requirements?
Awaiting your reply, thanks.