Get Shared Access Token for API Management, using Postman

SKate 136 Reputation points
2022-08-30T19:59:03.01+00:00

I'm trying to run this POST in Postman to get the shared access token for API Management
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/token?api-version=2021-08-01
I'm using the documentation from here.

Where in APIM can I find the value for "{userId}" ? The description says "User identifier. Must be unique in the current API Management service instance.", it doesn't describe where to get this value from.
What do I use for "api-version". The description says "Version of the API to be used with the client request.", where can I find this?
What do I set in Authorization, and in the Body, if anything.
Thank you

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
0 comments No comments
{count} votes

Answer accepted by question author
  1. JananiRamesh-MSFT 29,436 Reputation points Moderator
    2022-08-31T05:22:42.137+00:00

    Hi @SKate Thanks for reaching out. From the description I understand that you were trying to get a shared access token for an user using a below request url
    POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/token?api-version=2021-08-01

    Get the user id by using the below rest api call
    https://learn.microsoft.com/en-us/rest/api/apimanagement/current-ga/user/list-by-service?tabs=HTTP

    API version : you can use latest api version (api-version=2021-08-01)

    you need to pass the Bearer token in Authorization header and payload as below

    Body:
    {
    "properties": {
    "keyType": "primary",
    "expiry": "2022-09-21T00:44:24.2845269Z"
    }
    }

    please refer the below sample request:

    236368-image.png

    let me know incase of further queries, I would be happy to assist you.

    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.


1 additional answer

Sort by: Most helpful
  1. Efthimis Skouras 0 Reputation points
    2023-08-17T07:34:32.8333333+00:00

    The bearer token should be the user's token that authenticates using delegation sign-in, right?

    0 comments No comments

Your answer

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