Azure/apiops

[BUG] publishing an API fails with `code":"ValidationError","message":"Cannot use OAuth2AuthenticationSettings in combination with OAuth2 nor openid.` using v6.0.1-rc1

Closed this issue · 7 comments

Release version

v6.0.1-rc1

Describe the bug

Publishing an API fails with the error message: code":"ValidationError","message":"Cannot use OAuth2AuthenticationSettings in combination with OAuth2 nor openid.

In the apiInformation.json of the failing API, there are these lines:

    "authenticationSettings": {
      "oAuth2": {
        "authorizationServerId": "oauth2b2b"
      },
      "oAuth2AuthenticationSettings": [
        {
          "authorizationServerId": "oauth2b2b"
        }
      ],
      "openidAuthenticationSettings": []
    },

This is produced by the extractor, with no modification.

In the APIM portal, User authorization setting is set to OAuth 2.0

image

The API will publish successfully if oAuth2 and openidAuthenticationSettings field is removed, leaving only oAuth2AuthenticationSettings. But since these files are produced by the extractor, these modifications should not be necessary.

Expected behavior

The API to be published successfully.

Actual behavior

API fails to publish

Reproduction Steps

  1. Create an API with User authorization set to OAuth 2, and provide an OAuth 2.0 server
  2. Use the extractor to extract the API
  3. Use the publisher to publish the API the extractor just extracted
  Thank you for opening this issue! Please be patient while we will look into it and get back to you as this is an open source project. In the meantime make sure you take a look at the [closed issues](https://github.com/Azure/apiops/issues?q=is%3Aissue+is%3Aclosed) in case your question has already been answered. Don't forget to provide any additional information if needed (e.g. scrubbed logs, detailed feature requests,etc.).
  Whenever it's feasible, please don't hesitate to send a Pull Request (PR) our way. We'd greatly appreciate it, and we'll gladly assess and incorporate your changes.

We are getting the same issue. @waelkdouh any fix for this issue ?

Thanks, was able to replicate the issue. Will roll out a fix.

I have three env's, and I'm facing this with only one. I'm not sure if it's related to APIOps or an Azure side issue. my all envs are on same version. Thanks!

ref: Azure/azure-cli#26895

It's an issue with the Azure REST API. Retrieving an API returns both oAuth2 and oAuth2AuthenticationSettings. Information is duplicated in both properties.

Making a PUT request with both properties fails with the error message above. Workaround is to remove one of the two properties.

Hi, I can see some fix is merged in v6-rc2 branch by @guythetechie and I tested this scenario again, I'm no longer facing this issue.

I am still seeing this issue with 'az apim api update' in my yaml pipeline. I am trying to update resource-group, service-name and service-url @guythetechie