Prerequisites
Make sure you have:
-
Dynamics 365 CE On-premises.
-
AD FS 3.0 (Windows Server 2012 R2).
-
Local administrator access on the AD FS server.
-
PowerShell opened as Administrator.
-
The Redirect URI shown in the Smart Flows connector screen.
Step 1 – Verify OAuth endpoints on AD FS 3.0
-
Log on to the AD FS server.
-
Open PowerShell as Administrator.
-
Run the following command:
Get-AdfsEndpoint | Where-Object -Property Protocol -Match OAuth -
Confirm that OAuth endpoints are returned.
This validates that OAuth is enabled on the AD FS instance.
Step 2 – Determine the OAuth Base URL
For AD FS 3.0, the OAuth Base URL must point to your AD FS service URL, for example:
https://adfs.yourdomain.com
Step 3 – Create the AD FS OAuth client
-
In the same PowerShell (Administrator) session, execute:
Add-AdfsClient ` -RedirectUri "https://login.demo.smartflows.com/oauth/callback"
-
Replace the RedirectUri with the exact value shown in the Smart Flows connector UI.
-
The Client ID is generated automatically.
Step 4 – Retrieve the Client ID
-
Run:
Get-AdfsClient -
Identify the newly created client (typically the most recent one).
-
Copy the value of ClientId.
This is the only value required for AD FS 3.0.
Step 5 – Grant OAuth token permissions
Grant the client permission to request OAuth tokens:
Grant-AdfsApplicationPermission `
-ClientRoleIdentifier "<ClientId>" `
-ServerRoleIdentifier "urn:microsoft:adfs:oauth:token"
Replace <ClientId> with the value retrieved in Step 4 – Retrieve the Client ID.
Step 6 – Configure the Smart Flows connector
-
Return to the Smart Flows – Edit connector (AD FS Client) screen.
-
Enter:
-
OAuthBaseUrl → AD FS service URL (for example, https://adfs.yourdomain.com).
-
AD FS Client ID → Client ID from Step 4 – Retrieve the Client ID.
-
Step 7 – Validate the connection
-
Complete the connector setup wizard.
-
Perform a test authentication or trigger a Smart Flow that accesses Dynamics 365 CE.
-
Confirm that authentication is successful and data can be retrieved.
Notes & Best Practices
-
Ensure HTTPS is correctly configured on AD FS.
-
The redirect URI must match exactly (case-sensitive).
-
The AD FS service account must be healthy and time-synchronized.
-
For production environments, consider:
-
Dedicated AD FS client per environment.
-
Periodic rotation of client secrets.
-