Skip to content

Download MSAL4J And AKV Dependencies with Apache Maven

Wei Zhang edited this page Apr 21, 2021 · 11 revisions

The Microsoft JDBC Driver for SQL Server has 2 compile time dependencies:

  • azure-security-keyvault-keys : Microsoft Azure Client Library For KeyVault Keys for Always Encrypted Azure Key Vault feature (optional).
  • azure-identity : Microsoft Azure Client Library For Identity Library for Azure Active Directory Authentication feature and Azure Key Vault feature (optional).

Those 2 dependencies are not required at run time if users do not use Azure Key Vault or Azure Active Directory Authentication. However, if users want to use those features, they need to download the dependencies and include them into their classpath.

Steps to download dependencies with Apache Maven:

  1. Download and install Apache Maven
  2. Download the Microsoft JDBC Driver for SQL Server from GitHub, there is a file called pom.xml in the root directory. It contains all the dependency definitions
  3. In pom.xml file, all dependencies are listed in <dependencies>...</dependencies> block. Comment out all test dependencies and keep azure-security-keyvault-keys and azure-identity intact. In this case, it will download both azure-security-keyvault-keys and azure-identity and their dependencies as well.
  4. Open Termial/CMD and cd to the directory that contains pom.xml, run command <maven_installation_path>/bin/mvn dependency:copy-dependencies. It will download all the dependencies into target/dependency folder. Now, you have all the dependencies you need to use Azure Key Vault and Azure Active Directory Authentication feature.
  5. The pom.xml file will default to a profile targeting the latest version of JRE that we support. If you need to use older versions you can move the <activation>...</activation> block to the appropriate profile.
Clone this wiki locally