How can I locally develop my Spring Boot application against an Azure SQL DB using passwordless connections?

Oblio 26 Reputation points
2025-01-16T13:58:23.9933333+00:00

According to the documentation, the passwordless option is only for the hosted environment. This creates a challenge for developing locally because the authentication mechanism is different. How do I set up my local development so that it works the same way (perhaps uses the current user's credentials)?

Azure SQL Database
Azure Spring Apps
Azure Spring Apps
An Azure platform as a service for running Spring Boot applications at cloud scale. Previously known as Azure Spring Cloud.
133 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Amira Bedhiafi 28,141 Reputation points
    2025-01-16T15:56:56.5766667+00:00

    You can configure AAD authentication to use your current user credentials. So you need to set up a Managed Identity or Service Principal for your hosted environment and levrage AAD Integrated Authentication locally.

    Then update your application to use the azure-identity library to fetch AAD tokens and include the AAD URL in your JDBC connection string.

    In your local machine, verify that you're authenticated with az login and enable AAD authentication by adding the Authentication=ActiveDirectoryIntegrated parameter in your connection string which will allow your app to use your AAD credentials during local development.


  2. Oury Ba-MSFT 20,101 Reputation points Microsoft Employee
    2025-01-23T22:57:38.4533333+00:00

    Hi Oblio Thank you for reaching out.

    For local development, Java developer can use Azure Identity client library for Java | Microsoft Learn. Azure CLI, device login all supports password-less authentication in local development.

    Are you trying to use Azure Identity or use MSAL4j directly? We recommend the former. You should be able to use DefaultAzureCredential as the document you pointed to instructs so that users running locally will be able to use credentials from their IDE or one of the CLI tools.

     Are you using azure-identity-extensions at all?

     Regards,

    Oury

    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.