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

[BUG] 'failed with status code 400' Subscriptions limit reached for same user #623

Closed
jblaaa-codes opened this issue Aug 10, 2024 · 6 comments

Comments

@jblaaa-codes
Copy link

jblaaa-codes commented Aug 10, 2024

Release version

v6.0.1

Describe the bug

I'm trying to follow the walkthrough and I have a dev and a prod APIM instance (brand new config). The dev instance publishes as expected but the prod one continuously errors saying

  System.Net.Http.HttpRequestException: HTTP request to URI https://management.azure.com/subscriptions/***/resourceGroups/***/providers/Microsoft.ApiManagement/service/***/subscriptions/xxxxxxxxxxxxxxx?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}}'.

I've tried replacing the APIM instance twice, changed region, also attempted to upgrade the SKU from developer to basic but I get the same issue.

Expected behavior

prod instance should publish successfully.

Actual behavior

build failure on job 'Push-Changes-To-APIM-Prod-With-Commit-ID'

Reproduction Steps

deploy two APIMs, same RG but with different SPNs. create two seperate github environments with the variables from the documention

Copy link

  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.

@waelkdouh
Copy link
Contributor

waelkdouh commented Aug 10, 2024

Seems like an issue with your subscription. I don't think it's an APIOps issue. I will let @guythetechie comment on this.

@guythetechie
Copy link
Contributor

I believe APIM has a limit of one subscription per scope per user. Using the screenshot below as an example, if I create a new subscription and scope it to the product YMRGWH.., I cannot make Administrator the owner of the new subscription.
image

In your scenario, check the owner/scope of your failing subscription. Then ensure that the owner is not already associated with another subscription in the same scope.

@madebynavi
Copy link

https://learn.microsoft.com/en-us/answers/questions/1857706/(apim)-http-400-subsciptions-limit-reached-for-sam

I posted a similar question on MS Learn, and it seems to be a "bug" in DevOps for APIOps. That error is related to the subcriptions in the APIM instance.
Each instance can only have 1 subscription per scope per user. When creating a new apim instance, one gets "Product : Starter" with a subscription and "Product : Unlimited" with and subscription by default. Then when the publisher tries to copy dev to prod it tries to create a subscription for Product ; Starter and Product : Unlimited again, but since they are already there you get this error.
Short term solution according to the answer was to delete the subscriptions for Unlimited and Starter that are there by default, and let the publisher pipeline create them from scratch.

@jblaaa-codes
Copy link
Author

That did it! Thank you. I deleted the two starter subscriptions and the sync worked for production as expected. Appreciate the help all!

@CandidNitz
Copy link

@madebynavi @jblaaa-codes glad to see the suggested solution has been helpful.

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

5 participants