param name string param location string = resourceGroup().location param tags object = {} @description('The email address of the owner of the service') @minLength(1) param publisherEmail string = 'noreply@microsoft.com' @description('The name of the owner of the service') @minLength(1) param publisherName string = 'n/a' @description('The pricing tier of this API Management service') @allowed([ 'Consumption' 'Developer' 'Standard' 'Premium' ]) param sku string = 'Consumption' @description('The instance size of this API Management service.') @allowed([ 0, 1, 2 ]) param skuCount int = 0 @description('Azure Application Insights Name') param applicationInsightsName string resource apimService 'Microsoft.ApiManagement/service@2021-08-01' = { name: name location: location tags: union(tags, { 'azd-service-name': name }) sku: { name: sku capacity: (sku == 'Consumption') ? 0 : ((sku == 'Developer') ? 1 : skuCount) } properties: { publisherEmail: publisherEmail publisherName: publisherName } } resource apimLogger 'Microsoft.ApiManagement/service/loggers@2021-12-01-preview' = if (!empty(applicationInsightsName)) { name: 'app-insights-logger' parent: apimService properties: { credentials: { instrumentationKey: applicationInsights.properties.InstrumentationKey } description: 'Logger to Azure Application Insights' isBuffered: false loggerType: 'applicationInsights' resourceId: applicationInsights.id } } resource applicationInsights 'Microsoft.Insights/components@2020-02-02' existing = if (!empty(applicationInsightsName)) { name: applicationInsightsName } output apimServiceName string = apimService.name