how to login to Azure Database for MySQL flexible server using aad user

Rakesh Negi 20 Reputation points
2025-01-29T18:03:48.35+00:00

i have created a Azure Database for MySQL flexible server and assigned a umi to it and assign access to mode is mysql and microsoft entra authentication. The microsoft entra admin group is able to login to MySQL flexible server using entra group name as user and token as password but the users added under entra group are not able to login to the sql server with their email id getting error as :

MySQL Workbench

X Cannot Connect to Database Server

Your connection attempt failed for user '******@domain.com' to the MySQL server at

cd-usw-sql.mysql.database.azure.com:3306:

Access denied for user (using password: YES)

Please:

1 Check that MySQL is running on address cd-usw-sql.mysql.database.azure.com

2 Check that MySQL is reachable on port 3306 (note: 3306 is the default, but this can be changed)

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

Accepted answer
  1. Mahesh Kurva 5,025 Reputation points Microsoft External Staff Moderator
    2025-01-30T17:43:30.0133333+00:00

    Hi @Rakesh Negi,

    Thanks for the response.Given that you've already verified the key points, let's delve deeper into potential causes for the "Access denied for user (using password: YES)" error:

    • Ensure that the token being used by the users is not expired. Tokens have a limited lifespan, and an expired token will result in an access denied error.
    • Verify that the token has the correct scope. The token should include the necessary permissions to access the MySQL server. Users can obtain the token using the Azure CLI with the appropriate scope.
    • Confirm that the users are using the correct format for their User Principal Name (UPN). It should match the format expected by the MySQL server, typically ******@domain.com.
    • Double-check the server configuration to ensure that it is set to allow Microsoft Entra authentication. The aad_auth_only parameter should be set correctly based on your authentication mode.
    • Ensure that there are no firewall rules blocking the connection from the users' IP addresses. The MySQL server should be accessible from the users' network.
    • Verify that MySQL Workbench is configured correctly to use the token as the password. Sometimes, configuration issues in the client tool can lead to authentication errors. For more information, please refer the documents:

    https://learn.microsoft.com/en-us/azure/mysql/flexible-server/how-to-azure-ad

    https://learn.microsoft.com/en-us/azure/mysql/flexible-server/concepts-azure-ad-authentication

    Hope this helps. Do let us know if you any further queries.

    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.


0 additional answers

Sort by: Most helpful

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.