Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Policies through arm not applied correctly #36

Open
lazowmich opened this issue Jul 14, 2020 · 0 comments
Open

Policies through arm not applied correctly #36

lazowmich opened this issue Jul 14, 2020 · 0 comments

Comments

@lazowmich
Copy link

I am deploying an arm template for an existing APIM service and modifying the inbound policies for one of the apis to include a conditional :

 <policies>
          <inbound>
              <choose>
                <when condition=\"@(context.Request.Url.Path.Contains(&quot;ABC&quot;))\">
                    <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/.well-known/openid-configuration\" />
                        <required-claims>
                            <claim name=\"aud\">
                                <value>',
                                  parameters('audience'),
                                '</value> 
                            </claim>
                            <claim name=\"roles\" match=\"all\">
                                <value>Read</value>
                                <value>Write</value>
                            </claim>
                        </required-claims>
                    </validate-jwt>
                </when>
                <otherwise>
                    <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/.well-known/openid-configuration\" />
                        <required-claims>
                            <claim name=\"aud\">
                              <value>',
                                parameters('audience'),
                            ' </value>
                            </claim>
                            <claim name=\"roles\" match=\"any\">
                                <value>Read</value>
                            </claim>
                        </required-claims>
                    </validate-jwt>
                </otherwise>
            </choose>
            <base />
          </inbound>
            <backend>
                <base />
            </backend>
            <outbound>
              <base />
            </outbound>
            <on-error>
                <base />
              </on-error>
        </policies>

Validation for the first condition works after deployment but the second one does not.
Ex:
test.com/abc -validation works
test.com/xyz -validation always fails with a valid access token error

After I go in through the web portal I see the policy is there just as in the arm template. All I do is re-save the policy and it works as expected again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant