I got a simple task that is killing me as information is almost impossible to find.
There is an API created manually in APIM, that I try coding in Bicep
I need to set the backend, and I cannot.
The backend is an app service.
clicking on policies gives this XML, in which "WebApp_myjax_marlin_api_dev" is nowhere to be found in the APIM, it is something internal and not exposed.
Following whichever samples I can find, I'm creating following Bicep for the APIM
// APIM
resource apiManagementService 'Microsoft.ApiManagement/service@2024-05-01' = {
location: resourceGroup().location
name: 'myjax-api-apim${suffix}'
sku: {
name: isTestEnv ? 'Developer' : 'Basic'
capacity: 1
}
properties: {
publisherEmail: ''
publisherName: ''
}
@description('Create the backend for the app service')
resource marlinApiBackend 'backends@2022-08-01' = {
name: 'marlin-api-backend'
properties: {
protocol: 'http'
url: 'https://${webApp.properties.defaultHostName}'
resourceId: uri(environment().resourceManager, webApp.id)
}
}
@description('create APIM API for app service')
resource marlinApi 'apis@2022-08-01' = {
name: 'marlin-api'
properties: {
path: ''
displayName: 'myjax-marlin-api-dev'
subscriptionRequired: false
protocols: ['https']
}
@description('Create a policy for the Marlin API - linking the app service backend')
resource marlinApiBackendPolicy 'policies@2022-08-01' = {
name: 'policy'
properties: {
value: '''<policies>
<inbound>
<base />
<set-backend-service id="webapp-backend-policy" backend-id="marlin-api" />
</inbound>
<backend>
<base />
</backend>
<outbound>
<base />
</outbound>
<on-error>
<base />
</on-error>
</policies>'''
format: 'xml'
}
}
the problem is with the "backend-id"
it neither wants seeing name of the api, not of the backend.
[{"code":"ValidationError","target":"set-backend-service","message":"Error in element 'set-backend-service' on line 4, column 18: Backend with id 'marlin-api-backend' could not be found."}]
or
[{"code":"ValidationError","target":"set-backend-service","message":"Error in element 'set-backend-service' on line 4, column 18: Backend with id 'marlin-api' could not be found."}]
Can someone please help!!!