The driver supports Azure Active Directory authentication (Azure AD). Azure AD authentication is an alternative to SQL Server Authentication that allows administrators to centrally manage user permissions to Azure SQL Database data stores.
Note: Azure Active Directory authentication requires Java SE 7 or higher.
Note: When using Azure AD authentication, the driver requires root CA certificates to establish an SSL connection to a database. The driver determines the location of the truststore containing the required certificates by using the default JRE cacerts file unless a different file has been specified by the javax.net.ssl.trustStore java system property. The truststore location cannot be specified using the driver's Truststore property.

To configure the driver to use Azure AD authentication:

  1. Set the AuthenticationMethod property to specify a value of ActiveDirectoryPassword.
  2. Set the HostNameInCertificate property to specify the host name for SSL certificate validation. For example, *.database.windows.net.
    Note: If the root certificates obtained from the default JRE certificate path contain a different host name in certificate string, then the connection will fail with an error that indicates the correct value to use for this connection property.
  3. Set the User property to specify your Active Directory username using the userid@domain.com format.
  4. Set the Password property to specify your Active Directory password.
  5. Specify values for minimum required properties for establishing a connection:
    1. Set the ServerName property to specify either the IP address in IPv4 or IPv6 format, or the server name for your Azure server. For example, your_server.database.windows.net.
    2. Set the PortNumber property to specify the TCP port of the primary database server that is listening for connections to the database.
For example, the following is a connection string with only the required options for making a connection using Azure AD authentication:
Connection conn = DriverManager.getConnection 
("jdbc:datadirect:sqlserver://your_server.database.windows:1433;
AuthenticationMethod=ActiveDirectoryPassword;HostNameInCertificate=*.database.windows;
User=test@mydomain.com;Password=secret");