Microsoft.ApiManagement/service/products/apiLinks #12395
Replies: 1 comment
-
Managed to solve this by using a loop instead: param apiManagementServiceName string
param APIProductInfo object
// ################################
// || ||
// || Get existing resources ||
// || ||
// ################################
resource apimInstance 'Microsoft.ApiManagement/service@2022-08-01' existing = {
name: apiManagementServiceName
}
// ################################
// || ||
// || Set API Product Unlimited ||
// || ||
// ################################
resource getapiproduct 'Microsoft.ApiManagement/service/products@2022-08-01' existing = {
parent: apimInstance
name: 'Unlimited'
}
resource getapi 'Microsoft.ApiManagement/service/apis@2023-03-01-preview' existing = [for (API, index) in array (APIProductInfo.assignments): {
parent: apimInstance
name: API.name
}]
var getApiIds = [for (API, index) in array (APIProductInfo.assignments): getapi[index].id]
resource setAPIProduct 'Microsoft.ApiManagement/service/products/apiLinks@2023-03-01-preview' = [for (apiId, index) in getApiIds: {
name: 'APIProduct_Unlimited${index}'
parent: getapiproduct
properties: {
apiId: getapi[index].id
}
}] |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi Everyone,
I'm using Bicep to implement an API Management module three times to create three separate APIs, and I want to associate these APIs with the "Unlimited" Product.
Here's the relevant Bicep code:
In the first module that runs, the Azure deployment logs shows:
"Status": Created
The first API will be associated successfully.
However, for subsequent deployments, it returns:
"Status": OK
And the two other APIs will remain unassociated to a product.
If I run the deployment pipeline again, it won't detect any changes because it doesn't realize that the other two runs haven't been updated.
If I comment out the first module where this code runs, the next module will deploy correctly, however, the last API product association still fails.
The same code is being used throughout.
Beta Was this translation helpful? Give feedback.
All reactions