richard Stephenson
richard Stephenson

Reputation: 507

API Management - <authentication-managed-identity resource> passing client-id as a variable

Im trying to create an APIM policy. in the policy i want to generate a token from the metadata server

the APIM I am using has multiple user managed identities. I want to pass the managed identity id in the request. i have already extracted it to a variable. whatever i try i cant expand the variable in the authentication-managed-identity. if i hard code the vaule, this works fine. but it isnt what i want. Is this possible, if so, how?

<authentication-managed-identity resource="my-api" client-id="@((string)context.Variables["clientid"])" output-token-variable-name="token-variable" ignore-error="false" />

Upvotes: 0

Views: 35

Answers (1)

Vitaliy Kurokhtin
Vitaliy Kurokhtin

Reputation: 7810

This policy does not support expressions for client-id attribute. Your best option is to use choose policy to have multiple policies with hard coded client IDs and use conditional logic to decide which should be executed. This block may become big, so if you need to reuse it across multiple scopes, see if policy fragments would simplify maintenance for you.

Upvotes: 0

Related Questions