Get Azure AD app-only access token using certificate on .NET Core

Building daemon applications that communicate with SharePoint Online? Here is how you can get an Azure AD app-only access token in .NET Core.