How to generate the Bearer Token to access the cache Delete endpoint of Azure API Management

Nishra Nasar 0 Reputation points
2024-09-30T07:05:36.6633333+00:00

I want to clarify how to generate the Bearer token from azure Portal to access the Azure API Managment Cache Delete endpoint.

DELETE https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/caches/{cacheId}?api-version=2022-08-01

documentation : https://learn.microsoft.com/en-us/rest/api/apimanagement/cache/delete?view=rest-apimanagement-2022-08-01&tabs=HTTP

When I use the try-out button it is generating a bearer token, but in the azure portal under Direct Managment API, its generating only SAS token. How to get this bearer token or how can i use the SAS token to access this endpoint.

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,111 questions
{count} votes

2 answers

Sort by: Most helpful
  1. LeelaRajeshSayana-MSFT 15,076 Reputation points Microsoft Employee
    2024-10-01T21:25:05.4833333+00:00

    Hi @Nishra Nasar Greetings! Welcome to Microsoft Q&A forum. Thank you for posting this question here.

    You can create a new Service principal role and assign Reader/Contributor permissions for that role to your API Management instance. You can add this role assignment through Access Control -> Add role assignment tab of your APIM instance.

    Once you assign the access, you can generate a Bearer token for this role by calling the https://login.microsoftonline.com/{{tenantId}}/oauth2/token endpoint from postman. Please refer the article Azure REST API - Create a bearer token which outlines all the steps needed to get and test the token.

    Hope this helps! Please let us know if you have any additional questions or need further assistance.


    If the response helped, please do click Accept Answer and Yes for the answer provided. Doing so would help other community members with similar issue identify the solution. I highly appreciate your contribution to the community.


  2. Nishra Nasar 0 Reputation points
    2024-10-03T10:09:00.1166667+00:00

    Thank you Leela for the response. I was able to generate a bearer token by following the steps mentioned above.

    Even though I have contributor access to APIM and the resource group, I'm getting 403 forbidden error for the generated bearer token.

    APIM

    Any idea on what can cause this issue.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.