See Microsoft's documentation on granting permissions to a custom developed application within Azure.
https://docs.microsoft.com/en-us/azure/active-directory/application-dev-registration-config-grant-permissions-how-to
Below is an example of a consent link with the Client ID and Redirect URI of the Service Application set correctly:
https://login.microsoftonline.com/{OAUTH 2.0 AUTHORIZATION ENDPOINT GUID}/oauth2/authorize?client_id={Application ID}&response_type=code&redirect_uri=https://{YourDomain}/CMSModules/BTKConnect/UI/DynamicsCrm365ConnectorOAuth.aspx&response_mode=query&resource=https://{YourDynamics365Url}/&prompt=admin_consent
Once you've entered the above URL in with your information, you will be asked to login as an Admin to your Microsoft account and asked to Accept. Click Accept to continue.