-
Notifications
You must be signed in to change notification settings - Fork 202
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
[Question] Multiple Subscriptions.... Why? Need help!!! #493
Comments
|
Hi @marcovanluyk, I had the same issue, my apim are in different subscription depending on the environment. To make ApiOps tool work in my context, I did the following:
Let me know if this solves your issue. |
@vandriot Thanks for your reply! I implented your code snippets but I still get the message: "Multiple subscriptions are accessible. Please set the AZURE_SUBSCRIPTION_ID environment variable manually." I see in the Set publishing variable section of the PROD deployment that the process is finding 2 subscriptions but I still don't know why. In the first steps of the same pipeline (deploy to Dev and Uat) the pipeline is referencing only 1 subscription.... Here is the code of the publisher pipeline: |
The powershell script we have causes this. You may have to modify it to adapt to your use case. Our code assumes a single subscription target otherwise it would be confusing. |
Search the code base for the message you are receiving about setting the subscription manually. This way you will locate the code. |
Ok. I found it. Thanks.... |
@marcovanluyk so it means that your PROD service account has access to more than 1 subscription. You might want to check if it is normal. I had a similar issue before, I didn't modify the PowerShell script in run-publisher-with-env.yaml. I added a environment variable named AZURE_SUBSCRIPTION_ID and gave it the value of the target subscription. |
@vandriot I will check it and give you a feedback. |
Just for information, the publisher needs to know which subscription ID to use. It gets it from the
If you've set the If you have not, the publisher will check which subscriptions can be accessed by the pipeline agent. If it can only access one subscription, the publisher will use that subscription. Otherwise, it will throw an error message.
|
Release version
APIOPS 5.1.1
Question Details
Hi all, I am fighting a lot of hours with these problem.
I have 2 Subscriptions: 1 for PROD, and 1 for NonProd. Therefore I have 2 ServiceConnections in DevOps and different variables in my variable group.
Expected behavior
Connection to my Prod Service Connection will be connected to my PROD subscription and the deployment is working fine.
Actual behavior
The Service Connection is connected to 2 Subscritions (PROD and NONPROD). Why? This is the root cause.
Publisher is asking for a subscription-id (set it manually). But if I sent it manually I get the following error: System.Net.Http.HttpRequestException: HTTP request to URI https://management.azure.com/subscriptions/$(AZURE_SUBSCRIPTION_ID)/resourceGroups/API-Management-prod-rg/providers/Microsoft.ApiManagement/service/mxxxx-prod-apim/namedValues/trxxxlity-url?api-version=2022-04-01-preview failed with status code 400. Content is '{"error":{"code":"InvalidSubscriptionId","message":"The provided subscription identifier '$(AZURE_SUBSCRIPTION_ID)' is malformed or invalid."}}'.
at common.HttpPipelineExtensions.Validate(Response response, Uri requestUri)
Reproduction Steps
Start publisher with 2 or more stages with different subscriptions.
The text was updated successfully, but these errors were encountered: