To resolve the issue please make sure that you have one application user in your Dynamics CRM tied with application ID used in client credentials flow.
To verify this, below are the steps:
1. Login to the your Dynamics CRM online instance via browser. The login user should be a system admin in order to create/edit application users if need be
2. Click on Settings tab and under systems category select Security. Please refer below image:
3. Click on Users and in the page that opens, change System view to Application Users. Please refer below images:
4. Check if any of the registered Application User is tied to the application ID of the Azure application created for client credentials flow in TIBCO BW Dynamics CRM Plugin. Check the 'Application ID' field of the application users. Suppose the application id used in DCRM REST connection is "ea63ca37-f449-493a-z031-0f6dc810594c" then this application id should be tied with one of the application user in Dynamics CRM. Please refer below image:
5. In case no such application users exist, create a new Application User or edit an existing user so that the application ID of the app is tied to that user and re-verify Test Connection.