Connecting MuleSoft and Azure SQL with Entra ID

Introduction Establishing a secure connection between MuleSoft and Azure SQL Database can be challenging, especially if you are using Entra ID (formerly known as Azure Active Directory) for authentication. This blog walks through a fully working configuration for connecting to Azure SQL using ActiveDirectoryServicePrincipal in Mule runtime 4.7.4 with Java 8 — addressing driver setup,… Continue reading Connecting MuleSoft and Azure SQL with Entra ID
Introduction
Establishing a secure connection between MuleSoft and Azure SQL Database can be challenging, especially if you are using Entra ID (formerly known as Azure Active Directory) for authentication. This blog walks through a fully working configuration for connecting to Azure SQL using ActiveDirectoryServicePrincipal in Mule runtime 4.7.4 with Java 8 — addressing driver setup, token-based authentication, and dependency alignment.
If you’re looking to ditch hardcore credentials and adopt token-based authentication via Azure AD, then this guide is for you.
Why Use Entra ID for Azure SQL Integration?
Using Entra ID offers a more secure and manageable way to connect applications to Azure resources. Here are some of the key benefits of using it:
- Centralized Identity Management across the cloud infrastructure
- Service Principal Security without exposing sensitive credentials
- No hard coded SQL credentials (Usernames or Passwords)
- Access governance via Azure AD
Tools & Environment Used
Step-by-Step Configuration Guide
A. Set up Entra ID App Registration
- Go to Azure Portal → Azure Active Directory → App registrations → New Registration
- Note down the following details:
– Client ID
– Tenant ID
– Client Secret - Assign the app as a SQL user:
CREATE USER [app-name] FROM EXTERNAL PROVIDER;ALTER ROLE db_datareader ADD MEMBER [app-name];ALTER ROLE db_datawriter ADD MEMBER [app-name];
B. Set Up Maven Dependencies
You only need to add mssql-jdbc manually to the Mule app classpath. All other related libraries (required by MSAL4J) can be resolved through Maven.
<!– Required for Azure AD (Entra ID) Authentication –>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>9.2.1.jre8</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>msal4j</artifactId>
<version>1.11.0</version>
</dependency>
<dependency>
<groupId>com.nimbusds</groupId>
<artifactId>oauth2-oidc-sdk</artifactId>
<version>9.15</version>
</dependency>
<dependency>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
<version>2.3</version>
</dependency>
C. Configure MuleSoft Generic Database Connector
Use the following parameters:
Driver Class:com.microsoft.sqlserver.jdbc.SQLServerDriver
JDBC URL:
jdbc:sqlserver://<your-server>.database.windows.net:1433;database=<your-database>;authentication=ActiveDirectoryServicePrincipal;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;AADSecurePrincipalId=<client-id>;AADSecurePrincipalSecret=<client-secret>
Note: Leave Username & Password fields blank.
D. Avoid “Test Connection” Button
The GUI test button often fail for token-based connections. Instead, run a simple test flow in MuleSoft to validate the connection.

Troubleshooting Tips
Final Thoughts
If done correctly, integrating MuleSoft with Azure SQL using token-based authentication offers a secure, scalable, and enterprise-ready integration architecture. This setup not only improves security but also ensures better scalability across environments. If you’re working within a MuleSoft ecosystem and aiming to meet enterprise security requirements, configuring Entra ID authentication is a powerful step forward.
Looking to explore more real-world integration patterns, expert tips, and implementation guides like this? Visit our Resource Center.
Recent Blogs

Understanding Salesforce Flow Approval Processes
Introduction: Salesforce introduced Flow Approval Processes in the Spring '25 release. This is an evolved version of the classic approval process model, powered by Flow Orchestrator. The new approach brings unprecedented flexibility, enabling the creation of dynamic, multi-level, and logic-driven approval workflows that are entirely declarative. Continue reading the blog to get a deeper understanding… Continue reading Understanding Salesforce Flow Approval Processes
Understanding Salesforce Flow Approval Processes
Introduction: Salesforce introduced Flow Approval Processes in the Spring '25 release. This is an evolved version of the classic approval process model, powered by Flow Orchestrator. The new approach brings unprecedented flexibility, enabling the creation of dynamic, multi-level, and logic-driven approval workflows that are entirely declarative. Continue reading the blog to get a deeper understanding… Continue reading Understanding Salesforce Flow Approval Processes

Capturing Real-time Record Updation Using LWC
Introduction In modern CRM ecosystems, real-time Salesforce integration and seamless user experiences are no longer optional but fundamental for driving operational efficiency. Imagine your sales reps making important Opportunity changes, but the ERP remains out of sync, leading to confusion and data errors. We understood the necessity to bridge this data gap and implemented a… Continue reading Capturing Real-time Record Updation Using LWC
Capturing Real-time Record Updation Using LWC
Introduction In modern CRM ecosystems, real-time Salesforce integration and seamless user experiences are no longer optional but fundamental for driving operational efficiency. Imagine your sales reps making important Opportunity changes, but the ERP remains out of sync, leading to confusion and data errors. We understood the necessity to bridge this data gap and implemented a… Continue reading Capturing Real-time Record Updation Using LWC

All About Schedulers: Mule 4
In the world of Mule 4, automating repetitive tasks and triggering flows at defined intervals is necessary for building efficient and robust integration solutions. This is where Mule 4 schedulers come into use. This blog post explores the intricacies of scheduling in Mule 4, providing practical examples and best practices to help you get deeper… Continue reading All About Schedulers: Mule 4
All About Schedulers: Mule 4
In the world of Mule 4, automating repetitive tasks and triggering flows at defined intervals is necessary for building efficient and robust integration solutions. This is where Mule 4 schedulers come into use. This blog post explores the intricacies of scheduling in Mule 4, providing practical examples and best practices to help you get deeper… Continue reading All About Schedulers: Mule 4

Demystifying CloudHub 2.0 Networking
CloudHub 2.0 is the latest version of MuleSoft's powerful managed runtime platform, designed for seamless deployment of APIs and integrations. Unlike the original CloudHub 1.0, which relied on shared runtime workers within a single AWS region, CloudHub 2.0 offered a better upgrade. It provides a dedicated, isolated infrastructure with more granular control over networking, security,… Continue reading Demystifying CloudHub 2.0 Networking
Demystifying CloudHub 2.0 Networking
CloudHub 2.0 is the latest version of MuleSoft's powerful managed runtime platform, designed for seamless deployment of APIs and integrations. Unlike the original CloudHub 1.0, which relied on shared runtime workers within a single AWS region, CloudHub 2.0 offered a better upgrade. It provides a dedicated, isolated infrastructure with more granular control over networking, security,… Continue reading Demystifying CloudHub 2.0 Networking