I have already created an application that hits the link " GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byRequest?$filter={$filter}&api-version=2022-08-01 "
provided by Microsoft in the try out link here
In this link, after we sign in with our Azure credentials and add our subscriptionid
+ resource names and filter, we can get information about our API calls etc.
The problem that I face is that there after we sign in, it gives us a bearer token that can be used also to my application to bring those data. But I cannot find a way to take this bearer token programmatically without having to do the sign in. Is there such a way?
I tried to ask chatgpt, I tried also from postman some post links with client credentials but the bearer token that I took back and used gave me a response of unauthenticated.
Please add user_impersonation
permission to the registered app in Azure Entra ID.
You can generate the Bearer token as shown below-
Add resource: https://management.azure.com/
Access the API GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/reports/byRequest?$filter={$filter}&api-version=2022-08-01
using the above generated token.