Refering to not answered Questions:
401- Unauthorized authentication using REST API Dynamics CRM with Azure AD
and
Dynamics CRM Online 2016 - Daemon
Thanks IntegerWolf for the detailed post/answer. I already wasted a lot of time trying to connect to the CRM Web API without any luck, until I ran into your post!
Please be aware that ClientId in the code sample is the ClientId provided when registering your application in AAD. At first my connection failed, because in the explanation the value for client_id is YourTenantGuid, so I used my Office 365 TenantId, but this should be your AAD application ClientId.