apiops icon indicating copy to clipboard operation
apiops copied to clipboard

[BUG]Duplicate subscriptions created when publishing to multiple environments

Open CARLOSMECK opened this issue 7 months ago • 2 comments

Release version

v6.0.1.7

Describe the bug

When using the APIOps publisher to deploy APIs across multiple environments (e.g., Dev → Test → Prod), subscriptions included in the Git repository result in duplicate subscriptions being created in each environment, even if the displayName and scope are the same.

Expected behavior

Subscriptions with the same displayName and scope should be treated as the same logical entity and not duplicated in other environments.

Alternatively, subscriptions could be considered runtime-only data and excluded entirely by default, unless explicitly managed.

Actual behavior

Publishing creates duplicate subscriptions with the same display name but separate keys and internal IDs, leading to confusion and clutter across environments.

Reproduction Steps

  1. Extract from Dev APIM instance using the extractor pipeline — this includes subscriptions/ artifacts.
  2. Commit the extracted subscriptions into the APIOps Git repo.
  3. Run the publisher pipeline against a different environment (e.g., Test).
  4. Observe that new subscriptions with identical displayName are created in Test, instead of reusing or matching existing ones.

CARLOSMECK avatar Jun 03 '25 12:06 CARLOSMECK

  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.

github-actions[bot] avatar Jun 03 '25 12:06 github-actions[bot]

I just updated from v4.10.3 to v6.0.1.9. Deploy to Dev env works fine, but subsequent deploy to Prod results in a 400 trying to create a subscription:

##[debug]Processed: ##vso[task.issue type=error;source=CustomerScript;correlationId=342fd338-0487-407e-94dc-9c7c47c1001b;] System.Net.Http.HttpRequestException: HTTP request to URI https://management.azure.com/subscriptions/***/resourceGroups/prod-resource-group-name/providers/Microsoft.ApiManagement/service/apim-instance-name/subscriptions/subid123?api-version=2023-09-01-preview failed with status code 400. Content is '{"error":{"code":"ValidationError","message":"Subscriptions limit reached for same user","details":null}}'.

MattCorwin avatar Sep 09 '25 13:09 MattCorwin