Skip to content

Instantly share code, notes, and snippets.

@mattruma
Last active October 28, 2020 12:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattruma/8dd3161be0caab5418b77eedf44e0c09 to your computer and use it in GitHub Desktop.
Save mattruma/8dd3161be0caab5418b77eedf44e0c09 to your computer and use it in GitHub Desktop.
Adventures in Azure API Management: Pay Attention to Order in Policies
<policies>
<inbound>
<base />
<authentication-managed-identity resource="https://MY_WEB_APP.azurewebsites.net" />
</inbound>
<backend>
<base />
</backend>
<outbound>
<base />
</outbound>
<on-error>
<base />
</on-error>
</policies>
<policies>
<inbound>
<base />
<authentication-managed-identity resource="https://MY_WEB_APP.azurewebsites.net" />
<validate-jwt header-name="Authorization" failed-validation-httpcode="401" failed-validation-error-message="Unauthorized. Access token is missing or invalid.">
<openid-config url="https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration" />
<required-claims>
<claim name="aud">
<value>API_APP_REGISTRATION_APP_CLIENT_ID</value>
</claim>
</required-claims>
</validate-jwt>
</inbound>
<backend>
<base />
</backend>
<outbound>
<base />
</outbound>
<on-error>
<base />
</on-error>
</policies>
<policies>
<inbound>
<base />
<validate-jwt header-name="Authorization" failed-validation-httpcode="401" failed-validation-error-message="Unauthorized. Access token is missing or invalid.">
<openid-config url="https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration" />
<required-claims>
<claim name="aud">
<value>d5070be4-48dc-4618-beb4-853df62818dc</value>
</claim>
</required-claims>
</validate-jwt>
<authentication-managed-identity resource="https://MY_WEB_APP.azurewebsites.net" />
</inbound>
<backend>
<base />
</backend>
<outbound>
<base />
</outbound>
<on-error>
<base />
</on-error>
</policies>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment