0

Is it possible to have a single API in APIM that either accepts AAD token or subscription, based on what product it belongs to?

Default, this does not work, since unchecking "require subscription" on API-level will override setting product to require subscription.

So, I see two solutions.. create two APIs in APIM and place them in separate products (same backend), or write a custom policy. Is there a way to check context.Subscription.Key and match with the product subscriptions?

1 Answer 1

2

Should be possible by adding your API to two products:

  • One with subscription requirement enabled
  • Another without subscription requirement enabled, but with validate-jwt policy added at product level to require AAD token
Sign up to request clarification or add additional context in comments.

1 Comment

Oh, yes didn’t realize that one API can only be part of one open product and because of this, it will execute the policy from the open product! And having subscription required on API level makes this work!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.