This might happen because the test conn and runtime execution use different contexts.
Check these first:
Ensure the Linked Service domain URL matches your Salesforce environment (login
, test
, or custom domain).
Verify the integration runtime used at runtime has access and uses the same credentials.
Confirm the Connected App allows client credentials flow with correct scopes (api
, maybe full
), and regenerate the secret if needed.
If using Managed Identity, ensure it is correctly mapped during runtime.
Most often, the mismatch is the Salesforce URL or different runtime authentication path.
Fix to try:
- Check your Salesforce domain
- Use
https://login.salesforce.com
for production. - Use
https://test.salesforce.com
for sandbox. - Use custom domain URL if your org enforces it.
- Use
- Recreate and update credentials
- Regenerate the Consumer Secret in Salesforce.
- Update the Linked Service with the new Client ID and Secret.
- Validate Integration Runtime
- Make sure the pipeline runs on the same IR as the test connection.
- If using Managed Identity, confirm proper permissions are assigned.
- Test outside Synapse
- Use Postman with the same credentials to confirm token retrieval works.
- Rerun the pipeline
- Debug run with detailed logging to confirm token generation is successful.
Please 'Upvote'(Thumbs-up) and 'Accept' as answer if the reply was helpful. This will be benefitting other community members who face the same issue.