Connecting to Azure SQL with Azure Active Directory Integration

Thanks for documenting this! Would you mind if I re-used your content on the main site? 

Steve Donie
Principal Software Engineer
Liquibase Community Engagement
Datical, Inc.

Not at all. Happy to help contribute!

I posted this on SO, but also wanted to draw attention to the post from this community:

I am trying to connect to an Azure SQL database using Azure Active Directory. Specifically, I want to use the ActiveDirectoryPassword authentication mode which is documented here:

How can I construct my parameters to Liquibase to make this work?

I was able to get this to work. I am not very familiar with Java (we use Liquibase with a C# project), so I think some of the Java pieces tripped me up.

There were a few things I had to do to make this work:

  1. I needed to add some properties to the URL I sent to Liquibase:


ActiveDirectoryPassword is what tells the driver to use the authentication mechanism I wanted. I also had to add encrypt=true and trustServerCertificate=true to avoid some SSL errors I was getting (from:

  1. I needed the MSAL4J (Azure Active Directory) libraries in my classpath. I added them to the liquibase/lib directory so that the default Liquibase launcher scripts would add them for me. I got caught on this, too, because I needed to use Maven which we do not use. After downloading Maven, I used the copy-dependencies plugin to download the dependencies I needed.

mvn dependency:copy-dependencies

Here was the simple pom.xml I used:

Hope that is useful to future people!