Microsoft Dynamics 365 Integration
Connect AuthScape to Microsoft Dynamics 365 for bidirectional contact sync
Microsoft Dynamics 365 Integration
This guide covers setting up bidirectional synchronization between AuthScape and Microsoft Dynamics 365 CRM.
Prerequisites
Before you begin, ensure you have:
- An Azure Active Directory tenant
- A Dynamics 365 environment with the Web API enabled
- Admin access to register an application in Azure AD
Azure AD App Registration
Step 1: Create the App Registration
- Go to the Azure Portal
- Navigate to Azure Active Directory > App registrations
- Click New registration
- Enter a name (e.g., "AuthScape CRM Integration")
- Set Supported account types to "Accounts in this organizational directory only"
- Click Register
Step 2: Configure API Permissions
- In your app registration, go to API permissions
- Click Add a permission
- Select Dynamics CRM
- Choose Delegated permissions and check user_impersonation
- Click Add permissions
- Click Grant admin consent for [your tenant]
Step 3: Create Client Secret
- Go to Certificates & secrets
- Click New client secret
- Enter a description and choose an expiration period
- Click Add
- Copy the secret value immediately (it won't be shown again)
Step 4: Note Your Credentials
You'll need these values for AuthScape configuration:
- Application (client) ID: Found on the Overview page
- Directory (tenant) ID: Found on the Overview page
- Client Secret: The value you copied in Step 3
- Dynamics Environment URL: e.g.,
yourorg.crm.dynamics.com
AuthScape Configuration
Add the Dynamics 365 credentials to your appsettings.json:
{"CRM": {"Dynamics365": {"ClientId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","ClientSecret": "your-client-secret-value","TenantId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","Environment": "yourorg.crm.dynamics.com"}}}
Never commit secrets to source control. Use User Secrets, Azure Key Vault, or environment variables for production deployments.
Creating a Connection
- In AuthScape, navigate to User Management > CRM Integration
- Click Add Connection
- Select Dynamics 365 as the provider
- Enter a name for the connection (e.g., "Production Dynamics")
- Enter your Dynamics environment URL
- Click Create
The connection will use the credentials from your appsettings.json.
Entity Mapping
After creating a connection, configure which entities to sync:
- Click on your connection to open it
- Click Add Entity Mapping
- For user synchronization, use:
- AuthScape Entity: User
- CRM Entity: contact (or account for company sync)
- Click Save
Field Mapping
Configure how fields map between systems:
| AuthScape Field | Dynamics Field | Direction |
|---|---|---|
| FirstName | firstname | Bidirectional |
| LastName | lastname | Bidirectional |
| emailaddress1 | Bidirectional | |
| PhoneNumber | telephone1 | Bidirectional |
| IsActive | statecode | Bidirectional |
State Code Mapping
Dynamics uses numeric state codes:
0= Active (maps toIsActive = true)1= Inactive (maps toIsActive = false)
Manual Sync Operations
Full Sync
To perform a full synchronization of all records:
- Go to User Management > CRM Integration
- Click on your connection
- Click Sync Now > Full Sync
Sync Individual User
To sync a specific user:
- Go to User Management > Users
- Find the user and click to edit
- Click Sync to CRM in the actions menu
Troubleshooting
Authentication Errors
If you see "Invalid client credentials" errors:
- Verify the Client ID and Tenant ID are correct
- Check that the client secret hasn't expired
- Ensure the app has been granted admin consent
Permission Errors
If you see "Access denied" errors:
- Verify the app has the
user_impersonationpermission - Check that admin consent has been granted
- Ensure the app user has sufficient privileges in Dynamics
Connection Timeout
If sync operations time out:
- Check your network connectivity to Dynamics
- Verify the environment URL is correct (should be just the domain, not a full URL)
- Consider breaking large syncs into smaller batches
Next Steps
- Set up real-time webhooks for instant synchronization
- Configure field mappings for custom fields