Following below document provided by Microsoft, I have registered both apps, setup OAuth 2.0 service with client-credentials and added "validate-jwt" inbound policy. I have tested it with postman generating bearer token and calling my backend API under APIM instance passing with token. It works fine.
https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-protect-backend-with-aad
But just along with Apim, I want to secure my backend API also and pass to same token to backend API. so I have some questions here -
- Does APIM forward same bearer token to backend API automatically or do we need to configure any policy for it?
- If it does, how can I check trace logs? Also how can I authorize that same token in backend API code?
Here is my "validate-jwt" policy -
<inbound>
<validate-jwt header-name="Authorization" failed-validation-httpcode="401" failed-validation-error-message="Unauthorized. Access token is missing or invalid.">
<openid-config url="https://login.microsoftonline.com/{AAD Tenant ID}/v2.0/.well-known/openid-configuration" />
<audiences>
<audience>{App Id of backend App}</audience>
</audiences>
</validate-jwt>
<base />
</inbound>
Please help.