msaleme/mulesoft-powerbi-integration-examples
MuleSoft integration examples demonstrating PowerBI and Salesforce connectivity with OAuth2 authentication, comprehensive documentation, and production-ready patterns for enterprise integration scenarios.
MuleSoft PowerBI Integration Examples
This repository contains three MuleSoft integration examples demonstrating different connectivity patterns and use cases for modern enterprise integration scenarios.
Projects Overview
1. Authenticating Salesforce using OAuth2
Path: authenticating-salesforce-using-oauth2/
A comprehensive example demonstrating OAuth2 authentication with Salesforce using the MuleSoft Salesforce Connector. This example showcases secure authentication patterns and data retrieval from Salesforce CRM.
Key Features:
- OAuth2 authentication flow with Salesforce
- Secure credential management
- Contact data retrieval and processing
- Error handling and logging patterns
Technologies Used:
- MuleSoft Salesforce Connector
- OAuth2 authentication
- HTTP connectors for callback handling
- DataWeave transformations
2. MuleSoft PowerBI Example
Path: mulesoft-power-bi-example/
A basic integration example showing how to connect to Microsoft PowerBI using the PowerBI REST connector. Demonstrates essential PowerBI operations including token generation, report retrieval, and dataset refreshing.
Key Features:
- PowerBI token generation
- Report listing and retrieval
- Dataset refresh operations
- REST API integration patterns
Technologies Used:
- MuleSoft PowerBI REST Connector
- HTTP connectors
- OAuth2 for PowerBI authentication
3. PowerBI Integration
Path: powerbi/
An advanced PowerBI integration example with complete OAuth2 flow implementation, including authorization callbacks and comprehensive error handling.
Key Features:
- Complete OAuth2 authorization flow
- PowerBI report management
- Callback handling for authentication
- Comprehensive logging and monitoring
- DataWeave transformations for response formatting
Technologies Used:
- MuleSoft PowerBI REST Connector (v1.0.0)
- HTTP Listener configurations
- OAuth2 authorization code flow
- DataWeave 2.0 transformations
Getting Started
Prerequisites
- MuleSoft Anypoint Studio 7.x
- Mule Runtime 4.3+
- Java 8 or 11
- Maven 3.6+
- Access to Salesforce and/or PowerBI accounts for testing
Setup Instructions
-
Clone the repository:
git clone <repository-url> cd PowerBI
-
Import projects into Anypoint Studio:
- Open Anypoint Studio
- File > Import > Anypoint Studio > Anypoint Studio Project from File System
- Select the project folder you want to import
-
Configure credentials:
- Update configuration properties files with your Salesforce/PowerBI credentials
- Set up OAuth2 applications in respective platforms
- Configure callback URLs according to your environment
-
Build and run:
mvn clean package
Architecture Overview
These examples follow MuleSoft's API-led connectivity approach and demonstrate:
- System APIs: Direct integration with Salesforce and PowerBI
- Process APIs: Business logic and data transformation
- Experience APIs: Consumer-facing endpoints
Common Patterns Demonstrated
-
OAuth2 Authentication Flow:
- Authorization code grant type
- Token refresh mechanisms
- Secure credential storage
-
Error Handling:
- Global error handlers
- Specific exception handling
- Logging and monitoring
-
Data Transformation:
- DataWeave 2.0 transformations
- JSON/XML processing
- Response formatting
-
Configuration Management:
- Environment-specific properties
- Secure property handling
- External configuration files
Security Considerations
- Credential Management: All sensitive credentials should be externalized
- OAuth2 Flows: Proper implementation of authorization flows
- HTTPS: All external communications should use HTTPS
- Token Management: Proper token refresh and expiration handling
Deployment
These applications can be deployed to:
- CloudHub: MuleSoft's cloud platform
- Runtime Fabric: Container-based deployment
- On-premises: Standalone Mule runtime
Contributing
- Fork the repository
- Create a feature branch
- Make your changes following MuleSoft best practices
- Test thoroughly
- Submit a pull request
Documentation
Each project contains:
- Detailed README with setup instructions
- Flow documentation
- Configuration examples
- Testing guidelines
Support
For issues and questions:
- Check the individual project READMEs
- Review MuleSoft documentation
- Open an issue in this repository
License
This project is licensed under the MIT License - see the LICENSE file for details.