Unable to Create Connection - Invalid SQL Credentials Error

Nazim Abdul Rahman 0 Reputation points
2025-06-09T10:10:05.1633333+00:00

Hello Microsoft Support Team,

I am encountering an issue when trying to create a connection to my Azure SQL database. The error message indicates that the credentials are missing or not valid. Below is the detailed error message received:

Failed to create connection: {

"status": 401,

"message": "Credentials are missing or not valid.\r\n inner exception: The credentials provided for the SQL source are invalid. (Source at tcp:peoplecounterserver.database.windows.net;lotDB.)\r\nclientRequestId: e84cd4b5-229a-458c-b356-e912880cbc70",

"error": {

"message": "Credentials are missing or not valid.\r\n inner exception: The credentials provided for the SQL source are invalid. (Source at tcp:peoplecounterserver.database.windows.net;lotDB.)"

},

"source": "sql-qc.azconn-qc-001.p.azurewebsites.net"

}

I have verified the username and password for the SQL database, but the connection still fails with this error. Could you please assist in resolving this authentication issue or guide me on any additional configuration that might be required?

Azure Database for MySQL
Azure Database for MySQL
An Azure managed MySQL database service for app development and deployment.
977 questions
{count} votes

1 answer

Sort by: Newest
  1. PratikLad 1,585 Reputation points Microsoft External Staff Moderator
    2025-06-11T16:52:38.7533333+00:00

    Hi Nazim Abdul Rahman,

    Credentials are missing or not valid.\r\n inner exception: The credentials provided for the SQL source are invalid. (Source at tcp:peoplecounterserver.database.windows.net;lotDB.

    The error message you're encountering suggests that Azure is unable to authenticate your credentials when trying to connect to the SQL Server. Even if you've verified the username and password, there are several other factors that might cause this.

    Ensure your connection string is correct. For Azure SQL, the format is typically:

    Server=tcp:peoplecounterserver.database.windows.net,1433;Initial Catalog=lotDB;Persist Security  Info=False;User ID=<your_username>;Password=<your_password>;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
    
    • Server ends in .database.windows.net
    • Try User ID is in the format username@servername
    • You do not have a semicolon ; or whitespace in the password.

    If you are using SQL Authentication it requires a SQL login explicitly defined on the server. For Azure Active Directory (AAD) authentication requires AAD users to be granted roles on the database (e.g., db_datareader, db_owner) and configured appropriately in the connection client.

    When accessing the SQL Database from Azure-hosted services (e.g., Logic Apps, App Services), ensure that Managed Identity is configured and granted access on the SQL Database. Required role-based access control (RBAC) and database-level permissions to authenticate.

    As we can see you are connecting azure SQL from web app for that you can refer below documentations:

    https://learn.microsoft.com/en-us/azure/static-web-apps/database-azure-sql?tabs=bash&pivots=static-web-apps-rest

    https://learn.microsoft.com/en-us/azure/app-service/tutorial-connect-app-access-sql-database-as-user-dotnet?tabs=ef%2Cdotnet

    Please review the scenarios mentioned above. If the issue still persists, feel free to reach out with the requested details so we can assist you further.


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.