From 4b2f44a79a73213f2f1a69e2e9add07d9fc4fcb9 Mon Sep 17 00:00:00 2001 From: "Menghua Chen (WICRESOFT NORTH AMERICA LTD)" Date: Mon, 24 Jun 2024 18:09:03 +0800 Subject: [PATCH] update apim service toavm module --- .../infra/bicep/app/apim-api-settings.bicep | 99 ------------------- .../infra/bicep/app/website-config.bicep | 21 ++++ .../.repo/bicep/infra/main.bicep | 68 +++++++++++-- .../csharp-cosmos-sql/.repo/bicep/repo.yaml | 4 +- .../.repo/bicep/infra/main.bicep | 68 +++++++++++-- .../csharp-sql-swa-func/.repo/bicep/repo.yaml | 4 +- .../csharp-sql/.repo/bicep/infra/main.bicep | 68 +++++++++++-- .../projects/csharp-sql/.repo/bicep/repo.yaml | 4 +- .../.repo/bicep/infra/main.bicep | 68 +++++++++++-- .../java-mongo-aca/.repo/bicep/repo.yaml | 4 +- .../java-mongo/.repo/bicep/infra/main.bicep | 68 +++++++++++-- .../projects/java-mongo/.repo/bicep/repo.yaml | 4 +- .../.repo/bicep/infra/main.bicep | 68 +++++++++++-- .../nodejs-mongo-aca/.repo/bicep/repo.yaml | 4 +- .../.repo/bicep/infra/main.bicep | 68 +++++++++++-- .../.repo/bicep/repo.yaml | 4 +- .../nodejs-mongo/.repo/bicep/infra/main.bicep | 68 +++++++++++-- .../nodejs-mongo/.repo/bicep/repo.yaml | 4 +- .../.repo/bicep/infra/main.bicep | 68 +++++++++++-- .../python-mongo-aca/.repo/bicep/repo.yaml | 4 +- .../.repo/bicep/infra/main.bicep | 68 +++++++++++-- .../.repo/bicep/repo.yaml | 4 +- .../python-mongo/.repo/bicep/infra/main.bicep | 68 +++++++++++-- .../python-mongo/.repo/bicep/repo.yaml | 4 +- 24 files changed, 692 insertions(+), 220 deletions(-) delete mode 100644 templates/todo/common/infra/bicep/app/apim-api-settings.bicep create mode 100644 templates/todo/common/infra/bicep/app/website-config.bicep diff --git a/templates/todo/common/infra/bicep/app/apim-api-settings.bicep b/templates/todo/common/infra/bicep/app/apim-api-settings.bicep deleted file mode 100644 index c0e6da3a5ad..00000000000 --- a/templates/todo/common/infra/bicep/app/apim-api-settings.bicep +++ /dev/null @@ -1,99 +0,0 @@ -@description('Resource name for the existing apim service') -param name string - -@description('Resource name to uniquely identify this API within the API Management service instance') -@minLength(1) -param apiName string - -@description('Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API.') -@minLength(1) -param apiPath string - -@description('Resource name for the existing applicationInsights service') -param applicationInsightsName string - -@description('Resource name for backend Web App or Function App') -param apiAppName string = '' - -// Necessary due to https://github.com/Azure/bicep/issues/3750 -// placeholderName is never deployed, it is merely used to make the child name validation pass -var appNameForBicep = !empty(apiAppName) ? apiAppName : 'placeholderName' - -resource apiDiagnostics 'Microsoft.ApiManagement/service/apis/diagnostics@2021-12-01-preview' = { - name: 'applicationinsights' - parent: apimService::restApi - properties: { - alwaysLog: 'allErrors' - backend: { - request: { - body: { - bytes: 1024 - } - } - response: { - body: { - bytes: 1024 - } - } - } - frontend: { - request: { - body: { - bytes: 1024 - } - } - response: { - body: { - bytes: 1024 - } - } - } - httpCorrelationProtocol: 'W3C' - logClientIp: true - loggerId: apimLogger.id - metrics: true - sampling: { - percentage: 100 - samplingType: 'fixed' - } - verbosity: 'verbose' - } -} - -resource apiAppProperties 'Microsoft.Web/sites/config@2022-03-01' = if (!empty(apiAppName)) { - name: '${appNameForBicep}/web' - kind: 'string' - properties: { - apiManagementConfig: { - id: '${apimService.id}/apis/${apiName}' - } - } -} - -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 -} - -resource apimService 'Microsoft.ApiManagement/service@2021-08-01' existing = { - name: name - - resource restApi 'apis@2021-12-01-preview' existing = { - name: apiName - } -} - -output SERVICE_API_URI string = '${apimService.properties.gatewayUrl}/${apiPath}' diff --git a/templates/todo/common/infra/bicep/app/website-config.bicep b/templates/todo/common/infra/bicep/app/website-config.bicep new file mode 100644 index 00000000000..3c0e70a66ee --- /dev/null +++ b/templates/todo/common/infra/bicep/app/website-config.bicep @@ -0,0 +1,21 @@ +@description('Resource name for backend Web App or Function App') +param apiAppName string = '' + +@description('Resource name to uniquely identify this API within the API Management service instance') +@minLength(1) +param apiName string + +@description('Resource ID for the existing apim service') +param apimServiceId string + +var appNameForBicep = !empty(apiAppName) ? apiAppName : 'placeholderName' + +resource apiAppProperties 'Microsoft.Web/sites/config@2022-03-01' = if (!empty(apiAppName)) { + name: '${appNameForBicep}/web' + kind: 'string' + properties: { + apiManagementConfig: { + id: '${apimServiceId}/apis/${apiName}' + } + } +} diff --git a/templates/todo/projects/csharp-cosmos-sql/.repo/bicep/infra/main.bicep b/templates/todo/projects/csharp-cosmos-sql/.repo/bicep/infra/main.bicep index 1baf85ff856..9ff77f88afa 100644 --- a/templates/todo/projects/csharp-cosmos-sql/.repo/bicep/infra/main.bicep +++ b/templates/todo/projects/csharp-cosmos-sql/.repo/bicep/infra/main.bicep @@ -25,6 +25,8 @@ param resourceGroupName string = '' param webServiceName string = '' param apimServiceName string = '' param connectionStringKey string = 'AZURE-COSMOS-CONNECTION-STRING' +param apimApiName string = 'todo-api' +param apimLoggerName string = 'app-insights-logger' @description('Flag to use Azure API Management to mediate the calls between the Web frontend and the backend API') param useAPIM bool = false @@ -250,7 +252,7 @@ module applicationInsightsDashboard '../../../../../common/infra/bicep/app/appli } // Creates Azure API Management (APIM) service to mediate the requests between the frontend and the backend API -module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { +module apim 'br/public:avm/res/api-management/service:0.2.0' = if (useAPIM) { name: 'apim-deployment' scope: rg params: { @@ -261,9 +263,59 @@ module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { tags: tags sku: apimSku skuCount: 0 + customProperties: {} + zones: [] + apiDiagnostics: [ + { + apiName: apimApiName + alwaysLog: 'allErrors' + backend: { + request: { + body: { + bytes: 1024 + } + } + response: { + body: { + bytes: 1024 + } + } + } + frontend: { + request: { + body: { + bytes: 1024 + } + } + response: { + body: { + bytes: 1024 + } + } + } + httpCorrelationProtocol: 'W3C' + logClientIp: true + loggerName: apimLoggerName + metrics: true + verbosity: 'verbose' + name: 'applicationinsights' + } + ] + loggers: [ + { + name: apimLoggerName + credentials: { + instrumentationKey: applicationInsights.outputs.instrumentationKey + } + loggerDescription: 'Logger to Azure Application Insights' + isBuffered: false + loggerType: 'applicationInsights' + targetResourceId: applicationInsights.outputs.resourceId + } + ] apis: [ { - name: 'todo-api' + name: apimApiName path: 'todo' displayName: 'Simple Todo API' apiDescription: 'This is a simple Todo API' @@ -283,16 +335,14 @@ module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { } } -// Configures the API in the Azure API Management (APIM) service -module apimSettings '../../../../../common/infra/bicep/app/apim-api-settings.bicep' = if (useAPIM) { - name: 'apim-api-settings' +//Configures the API settings for an api app within the Azure API Management (APIM) service. +module apiConfig '../../../../../common/infra/bicep/app/website-config.bicep' = if (useAPIM) { + name: 'apiconfig' scope: rg params: { + apimServiceId: apim.outputs.resourceId + apiName: apimApiName apiAppName: api.outputs.name - apiName: 'todo-api' - name: useAPIM ? apim.outputs.name : '' - apiPath: 'todo' - applicationInsightsName: applicationInsights.outputs.name } } diff --git a/templates/todo/projects/csharp-cosmos-sql/.repo/bicep/repo.yaml b/templates/todo/projects/csharp-cosmos-sql/.repo/bicep/repo.yaml index 52b3f09367b..09c50707958 100644 --- a/templates/todo/projects/csharp-cosmos-sql/.repo/bicep/repo.yaml +++ b/templates/todo/projects/csharp-cosmos-sql/.repo/bicep/repo.yaml @@ -118,8 +118,8 @@ repo: - from: ../../../../common/infra/bicep/app/applicationinsights-dashboard.bicep to: ./infra/app/applicationinsights-dashboard.bicep - - from: ../../../../common/infra/bicep/app/apim-api-settings.bicep - to: ./infra/app/apim-api-settings.bicep + - from: ../../../../common/infra/bicep/app/website-config.bicep + to: ./infra/app/website-config.bicep - from: ./../../ to: ./ diff --git a/templates/todo/projects/csharp-sql-swa-func/.repo/bicep/infra/main.bicep b/templates/todo/projects/csharp-sql-swa-func/.repo/bicep/infra/main.bicep index 3feeb5717c5..571af251b5a 100644 --- a/templates/todo/projects/csharp-sql-swa-func/.repo/bicep/infra/main.bicep +++ b/templates/todo/projects/csharp-sql-swa-func/.repo/bicep/infra/main.bicep @@ -28,6 +28,8 @@ param apimServiceName string = '' param appUser string = 'appUser' param sqlAdmin string = 'sqlAdmin' param connectionStringKey string = 'AZURE-SQL-CONNECTION-STRING' +param apimApiName string = 'todo-api' +param apimLoggerName string = 'app-insights-logger' @description('Flag to use Azure API Management to mediate the calls between the Web frontend and the backend API') param useAPIM bool = false @@ -269,7 +271,7 @@ module applicationInsightsDashboard '../../../../../common/infra/bicep/app/appli } // Creates Azure API Management (APIM) service to mediate the requests between the frontend and the backend API -module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { +module apim 'br/public:avm/res/api-management/service:0.2.0' = if (useAPIM) { name: 'apim-deployment' scope: rg params: { @@ -280,9 +282,59 @@ module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { tags: tags sku: apimSku skuCount: 0 + customProperties: {} + zones: [] + apiDiagnostics: [ + { + apiName: apimApiName + alwaysLog: 'allErrors' + backend: { + request: { + body: { + bytes: 1024 + } + } + response: { + body: { + bytes: 1024 + } + } + } + frontend: { + request: { + body: { + bytes: 1024 + } + } + response: { + body: { + bytes: 1024 + } + } + } + httpCorrelationProtocol: 'W3C' + logClientIp: true + loggerName: apimLoggerName + metrics: true + verbosity: 'verbose' + name: 'applicationinsights' + } + ] + loggers: [ + { + name: apimLoggerName + credentials: { + instrumentationKey: applicationInsights.outputs.instrumentationKey + } + loggerDescription: 'Logger to Azure Application Insights' + isBuffered: false + loggerType: 'applicationInsights' + targetResourceId: applicationInsights.outputs.resourceId + } + ] apis: [ { - name: 'todo-api' + name: apimApiName path: 'todo' displayName: 'Simple Todo API' apiDescription: 'This is a simple Todo API' @@ -302,16 +354,14 @@ module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { } } -// Configures the API in the Azure API Management (APIM) service -module apimSettings '../../../../../common/infra/bicep/app/apim-api-settings.bicep' = if (useAPIM) { - name: 'apim-api-settings' +//Configures the API settings for an api app within the Azure API Management (APIM) service. +module apiConfig '../../../../../common/infra/bicep/app/website-config.bicep' = if (useAPIM) { + name: 'apiconfig' scope: rg params: { + apimServiceId: apim.outputs.resourceId + apiName: apimApiName apiAppName: api.outputs.name - apiName: 'todo-api' - name: useAPIM ? apim.outputs.name : '' - apiPath: 'todo' - applicationInsightsName: applicationInsights.outputs.name } } diff --git a/templates/todo/projects/csharp-sql-swa-func/.repo/bicep/repo.yaml b/templates/todo/projects/csharp-sql-swa-func/.repo/bicep/repo.yaml index 688bdc7e4cf..13aea658a7c 100644 --- a/templates/todo/projects/csharp-sql-swa-func/.repo/bicep/repo.yaml +++ b/templates/todo/projects/csharp-sql-swa-func/.repo/bicep/repo.yaml @@ -118,8 +118,8 @@ repo: - from: ../../../../common/infra/bicep/app/applicationinsights-dashboard.bicep to: ./infra/app/applicationinsights-dashboard.bicep - - from: ../../../../common/infra/bicep/app/apim-api-settings.bicep - to: ./infra/app/apim-api-settings.bicep + - from: ../../../../common/infra/bicep/app/website-config.bicep + to: ./infra/app/website-config.bicep - from: ../../../../common/infra/bicep/app/sql-deployment-script.bicep to: ./infra/app/sql-deployment-script.bicep diff --git a/templates/todo/projects/csharp-sql/.repo/bicep/infra/main.bicep b/templates/todo/projects/csharp-sql/.repo/bicep/infra/main.bicep index 82de4d4c803..11ed1433574 100644 --- a/templates/todo/projects/csharp-sql/.repo/bicep/infra/main.bicep +++ b/templates/todo/projects/csharp-sql/.repo/bicep/infra/main.bicep @@ -25,6 +25,8 @@ param sqlDatabaseName string = '' param webServiceName string = '' param apimServiceName string = '' param connectionStringKey string = 'AZURE-SQL-CONNECTION-STRING' +param apimApiName string = 'todo-api' +param apimLoggerName string = 'app-insights-logger' @description('Flag to use Azure API Management to mediate the calls between the Web frontend and the backend API') param useAPIM bool = false @@ -252,7 +254,7 @@ module applicationInsightsDashboard '../../../../../common/infra/bicep/app/appli } // Creates Azure API Management (APIM) service to mediate the requests between the frontend and the backend API -module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { +module apim 'br/public:avm/res/api-management/service:0.2.0' = if (useAPIM) { name: 'apim-deployment' scope: rg params: { @@ -263,9 +265,59 @@ module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { tags: tags sku: apimSku skuCount: 0 + customProperties: {} + zones: [] + apiDiagnostics: [ + { + apiName: apimApiName + alwaysLog: 'allErrors' + backend: { + request: { + body: { + bytes: 1024 + } + } + response: { + body: { + bytes: 1024 + } + } + } + frontend: { + request: { + body: { + bytes: 1024 + } + } + response: { + body: { + bytes: 1024 + } + } + } + httpCorrelationProtocol: 'W3C' + logClientIp: true + loggerName: apimLoggerName + metrics: true + verbosity: 'verbose' + name: 'applicationinsights' + } + ] + loggers: [ + { + name: apimLoggerName + credentials: { + instrumentationKey: applicationInsights.outputs.instrumentationKey + } + loggerDescription: 'Logger to Azure Application Insights' + isBuffered: false + loggerType: 'applicationInsights' + targetResourceId: applicationInsights.outputs.resourceId + } + ] apis: [ { - name: 'todo-api' + name: apimApiName path: 'todo' displayName: 'Simple Todo API' apiDescription: 'This is a simple Todo API' @@ -285,16 +337,14 @@ module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { } } -// Configures the API in the Azure API Management (APIM) service -module apimSettings '../../../../../common/infra/bicep/app/apim-api-settings.bicep' = if (useAPIM) { - name: 'apim-api-settings' +//Configures the API settings for an api app within the Azure API Management (APIM) service. +module apiConfig '../../../../../common/infra/bicep/app/website-config.bicep' = if (useAPIM) { + name: 'apiconfig' scope: rg params: { + apimServiceId: apim.outputs.resourceId + apiName: apimApiName apiAppName: api.outputs.name - apiName: 'todo-api' - name: useAPIM ? apim.outputs.name : '' - apiPath: 'todo' - applicationInsightsName: applicationInsights.outputs.name } } diff --git a/templates/todo/projects/csharp-sql/.repo/bicep/repo.yaml b/templates/todo/projects/csharp-sql/.repo/bicep/repo.yaml index 49bcad057b8..ef5ca0d314f 100644 --- a/templates/todo/projects/csharp-sql/.repo/bicep/repo.yaml +++ b/templates/todo/projects/csharp-sql/.repo/bicep/repo.yaml @@ -119,8 +119,8 @@ repo: - from: ../../../../common/infra/bicep/app/applicationinsights-dashboard.bicep to: ./infra/app/applicationinsights-dashboard.bicep - - from: ../../../../common/infra/bicep/app/apim-api-settings.bicep - to: ./infra/app/apim-api-settings.bicep + - from: ../../../../common/infra/bicep/app/website-config.bicep + to: ./infra/app/website-config.bicep - from: ../../../../common/infra/bicep/app/sql-deployment-script.bicep to: ./infra/app/sql-deployment-script.bicep diff --git a/templates/todo/projects/java-mongo-aca/.repo/bicep/infra/main.bicep b/templates/todo/projects/java-mongo-aca/.repo/bicep/infra/main.bicep index 2dcafcda2f1..a0894ac6084 100644 --- a/templates/todo/projects/java-mongo-aca/.repo/bicep/infra/main.bicep +++ b/templates/todo/projects/java-mongo-aca/.repo/bicep/infra/main.bicep @@ -26,6 +26,8 @@ param resourceGroupName string = '' param webContainerAppName string = '' param apimServiceName string = '' param connectionStringKey string = 'AZURE-COSMOS-CONNECTION-STRING' +param apimApiName string = 'todo-api' +param apimLoggerName string = 'app-insights-logger' param collections array = [ { name: 'TodoList' @@ -327,7 +329,7 @@ module applicationInsightsDashboard '../../../../../common/infra/bicep/app/appli } // Creates Azure API Management (APIM) service to mediate the requests between the frontend and the backend API -module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { +module apim 'br/public:avm/res/api-management/service:0.2.0' = if (useAPIM) { name: 'apim-deployment' scope: rg params: { @@ -338,9 +340,59 @@ module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { tags: tags sku: apimSku skuCount: 0 + customProperties: {} + zones: [] + apiDiagnostics: [ + { + apiName: apimApiName + alwaysLog: 'allErrors' + backend: { + request: { + body: { + bytes: 1024 + } + } + response: { + body: { + bytes: 1024 + } + } + } + frontend: { + request: { + body: { + bytes: 1024 + } + } + response: { + body: { + bytes: 1024 + } + } + } + httpCorrelationProtocol: 'W3C' + logClientIp: true + loggerName: apimLoggerName + metrics: true + verbosity: 'verbose' + name: 'applicationinsights' + } + ] + loggers: [ + { + name: apimLoggerName + credentials: { + instrumentationKey: applicationInsights.outputs.instrumentationKey + } + loggerDescription: 'Logger to Azure Application Insights' + isBuffered: false + loggerType: 'applicationInsights' + targetResourceId: applicationInsights.outputs.resourceId + } + ] apis: [ { - name: 'todo-api' + name: apimApiName path: 'todo' displayName: 'Simple Todo API' apiDescription: 'This is a simple Todo API' @@ -360,15 +412,13 @@ module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { } } -// Configures the API in the Azure API Management (APIM) service -module apimSettings '../../../../../common/infra/bicep/app/apim-api-settings.bicep' = if (useAPIM) { - name: 'apim-api-settings' +//Configures the API settings for an api app within the Azure API Management (APIM) service. +module apiConfig '../../../../../common/infra/bicep/app/website-config.bicep' = if (useAPIM) { + name: 'apiconfig' scope: rg params: { - apiName: 'todo-api' - name: useAPIM ? apim.outputs.name : '' - apiPath: 'todo' - applicationInsightsName: applicationInsights.outputs.name + apimServiceId: apim.outputs.resourceId + apiName: apimApiName } } diff --git a/templates/todo/projects/java-mongo-aca/.repo/bicep/repo.yaml b/templates/todo/projects/java-mongo-aca/.repo/bicep/repo.yaml index 6a352cc1978..9a0674b9461 100644 --- a/templates/todo/projects/java-mongo-aca/.repo/bicep/repo.yaml +++ b/templates/todo/projects/java-mongo-aca/.repo/bicep/repo.yaml @@ -122,8 +122,8 @@ repo: - from: ../../../../common/infra/bicep/app/applicationinsights-dashboard.bicep to: ./infra/app/applicationinsights-dashboard.bicep - - from: ../../../../common/infra/bicep/app/apim-api-settings.bicep - to: ./infra/app/apim-api-settings.bicep + - from: ../../../../common/infra/bicep/app/website-config.bicep + to: ./infra/app/website-config.bicep - from: ./../../ to: ./ diff --git a/templates/todo/projects/java-mongo/.repo/bicep/infra/main.bicep b/templates/todo/projects/java-mongo/.repo/bicep/infra/main.bicep index 12c716c921d..a0778df106f 100644 --- a/templates/todo/projects/java-mongo/.repo/bicep/infra/main.bicep +++ b/templates/todo/projects/java-mongo/.repo/bicep/infra/main.bicep @@ -25,6 +25,8 @@ param resourceGroupName string = '' param webServiceName string = '' param apimServiceName string = '' param connectionStringKey string = 'AZURE-COSMOS-CONNECTION-STRING' +param apimApiName string = 'todo-api' +param apimLoggerName string = 'app-insights-logger' param collections array = [ { name: 'TodoList' @@ -258,7 +260,7 @@ module applicationInsightsDashboard '../../../../../common/infra/bicep/app/appli } // Creates Azure API Management (APIM) service to mediate the requests between the frontend and the backend API -module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { +module apim 'br/public:avm/res/api-management/service:0.2.0' = if (useAPIM) { name: 'apim-deployment' scope: rg params: { @@ -269,9 +271,59 @@ module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { tags: tags sku: apimSku skuCount: 0 + customProperties: {} + zones: [] + apiDiagnostics: [ + { + apiName: apimApiName + alwaysLog: 'allErrors' + backend: { + request: { + body: { + bytes: 1024 + } + } + response: { + body: { + bytes: 1024 + } + } + } + frontend: { + request: { + body: { + bytes: 1024 + } + } + response: { + body: { + bytes: 1024 + } + } + } + httpCorrelationProtocol: 'W3C' + logClientIp: true + loggerName: apimLoggerName + metrics: true + verbosity: 'verbose' + name: 'applicationinsights' + } + ] + loggers: [ + { + name: apimLoggerName + credentials: { + instrumentationKey: applicationInsights.outputs.instrumentationKey + } + loggerDescription: 'Logger to Azure Application Insights' + isBuffered: false + loggerType: 'applicationInsights' + targetResourceId: applicationInsights.outputs.resourceId + } + ] apis: [ { - name: 'todo-api' + name: apimApiName path: 'todo' displayName: 'Simple Todo API' apiDescription: 'This is a simple Todo API' @@ -291,16 +343,14 @@ module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { } } -// Configures the API in the Azure API Management (APIM) service -module apimSettings '../../../../../common/infra/bicep/app/apim-api-settings.bicep' = if (useAPIM) { - name: 'apim-api-settings' +//Configures the API settings for an api app within the Azure API Management (APIM) service. +module apiConfig '../../../../../common/infra/bicep/app/website-config.bicep' = if (useAPIM) { + name: 'apiconfig' scope: rg params: { + apimServiceId: apim.outputs.resourceId + apiName: apimApiName apiAppName: api.outputs.name - apiName: 'todo-api' - name: useAPIM ? apim.outputs.name : '' - apiPath: 'todo' - applicationInsightsName: applicationInsights.outputs.name } } diff --git a/templates/todo/projects/java-mongo/.repo/bicep/repo.yaml b/templates/todo/projects/java-mongo/.repo/bicep/repo.yaml index 94d486625cb..f062acd6657 100644 --- a/templates/todo/projects/java-mongo/.repo/bicep/repo.yaml +++ b/templates/todo/projects/java-mongo/.repo/bicep/repo.yaml @@ -115,8 +115,8 @@ repo: - from: ../../../../common/infra/bicep/app/applicationinsights-dashboard.bicep to: ./infra/app/applicationinsights-dashboard.bicep - - from: ../../../../common/infra/bicep/app/apim-api-settings.bicep - to: ./infra/app/apim-api-settings.bicep + - from: ../../../../common/infra/bicep/app/website-config.bicep + to: ./infra/app/website-config.bicep - from: ./../../ to: ./ diff --git a/templates/todo/projects/nodejs-mongo-aca/.repo/bicep/infra/main.bicep b/templates/todo/projects/nodejs-mongo-aca/.repo/bicep/infra/main.bicep index 2dcafcda2f1..a0894ac6084 100644 --- a/templates/todo/projects/nodejs-mongo-aca/.repo/bicep/infra/main.bicep +++ b/templates/todo/projects/nodejs-mongo-aca/.repo/bicep/infra/main.bicep @@ -26,6 +26,8 @@ param resourceGroupName string = '' param webContainerAppName string = '' param apimServiceName string = '' param connectionStringKey string = 'AZURE-COSMOS-CONNECTION-STRING' +param apimApiName string = 'todo-api' +param apimLoggerName string = 'app-insights-logger' param collections array = [ { name: 'TodoList' @@ -327,7 +329,7 @@ module applicationInsightsDashboard '../../../../../common/infra/bicep/app/appli } // Creates Azure API Management (APIM) service to mediate the requests between the frontend and the backend API -module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { +module apim 'br/public:avm/res/api-management/service:0.2.0' = if (useAPIM) { name: 'apim-deployment' scope: rg params: { @@ -338,9 +340,59 @@ module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { tags: tags sku: apimSku skuCount: 0 + customProperties: {} + zones: [] + apiDiagnostics: [ + { + apiName: apimApiName + alwaysLog: 'allErrors' + backend: { + request: { + body: { + bytes: 1024 + } + } + response: { + body: { + bytes: 1024 + } + } + } + frontend: { + request: { + body: { + bytes: 1024 + } + } + response: { + body: { + bytes: 1024 + } + } + } + httpCorrelationProtocol: 'W3C' + logClientIp: true + loggerName: apimLoggerName + metrics: true + verbosity: 'verbose' + name: 'applicationinsights' + } + ] + loggers: [ + { + name: apimLoggerName + credentials: { + instrumentationKey: applicationInsights.outputs.instrumentationKey + } + loggerDescription: 'Logger to Azure Application Insights' + isBuffered: false + loggerType: 'applicationInsights' + targetResourceId: applicationInsights.outputs.resourceId + } + ] apis: [ { - name: 'todo-api' + name: apimApiName path: 'todo' displayName: 'Simple Todo API' apiDescription: 'This is a simple Todo API' @@ -360,15 +412,13 @@ module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { } } -// Configures the API in the Azure API Management (APIM) service -module apimSettings '../../../../../common/infra/bicep/app/apim-api-settings.bicep' = if (useAPIM) { - name: 'apim-api-settings' +//Configures the API settings for an api app within the Azure API Management (APIM) service. +module apiConfig '../../../../../common/infra/bicep/app/website-config.bicep' = if (useAPIM) { + name: 'apiconfig' scope: rg params: { - apiName: 'todo-api' - name: useAPIM ? apim.outputs.name : '' - apiPath: 'todo' - applicationInsightsName: applicationInsights.outputs.name + apimServiceId: apim.outputs.resourceId + apiName: apimApiName } } diff --git a/templates/todo/projects/nodejs-mongo-aca/.repo/bicep/repo.yaml b/templates/todo/projects/nodejs-mongo-aca/.repo/bicep/repo.yaml index 262af9dc33f..c36c2f513f9 100644 --- a/templates/todo/projects/nodejs-mongo-aca/.repo/bicep/repo.yaml +++ b/templates/todo/projects/nodejs-mongo-aca/.repo/bicep/repo.yaml @@ -125,8 +125,8 @@ repo: - from: ../../../../common/infra/bicep/app/applicationinsights-dashboard.bicep to: ./infra/app/applicationinsights-dashboard.bicep - - from: ../../../../common/infra/bicep/app/apim-api-settings.bicep - to: ./infra/app/apim-api-settings.bicep + - from: ../../../../common/infra/bicep/app/website-config.bicep + to: ./infra/app/website-config.bicep - from: ./../../ to: ./ diff --git a/templates/todo/projects/nodejs-mongo-swa-func/.repo/bicep/infra/main.bicep b/templates/todo/projects/nodejs-mongo-swa-func/.repo/bicep/infra/main.bicep index 79a0c2795f7..63e70b66beb 100644 --- a/templates/todo/projects/nodejs-mongo-swa-func/.repo/bicep/infra/main.bicep +++ b/templates/todo/projects/nodejs-mongo-swa-func/.repo/bicep/infra/main.bicep @@ -26,6 +26,8 @@ param storageAccountName string = '' param webServiceName string = '' param apimServiceName string = '' param connectionStringKey string = 'AZURE-COSMOS-CONNECTION-STRING' +param apimApiName string = 'todo-api' +param apimLoggerName string = 'app-insights-logger' param collections array = [ { name: 'TodoList' @@ -268,7 +270,7 @@ module applicationInsightsDashboard '../../../../../common/infra/bicep/app/appli } // Creates Azure API Management (APIM) service to mediate the requests between the frontend and the backend API -module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { +module apim 'br/public:avm/res/api-management/service:0.2.0' = if (useAPIM) { name: 'apim-deployment' scope: rg params: { @@ -279,9 +281,59 @@ module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { tags: tags sku: apimSku skuCount: 0 + customProperties: {} + zones: [] + apiDiagnostics: [ + { + apiName: apimApiName + alwaysLog: 'allErrors' + backend: { + request: { + body: { + bytes: 1024 + } + } + response: { + body: { + bytes: 1024 + } + } + } + frontend: { + request: { + body: { + bytes: 1024 + } + } + response: { + body: { + bytes: 1024 + } + } + } + httpCorrelationProtocol: 'W3C' + logClientIp: true + loggerName: apimLoggerName + metrics: true + verbosity: 'verbose' + name: 'applicationinsights' + } + ] + loggers: [ + { + name: apimLoggerName + credentials: { + instrumentationKey: applicationInsights.outputs.instrumentationKey + } + loggerDescription: 'Logger to Azure Application Insights' + isBuffered: false + loggerType: 'applicationInsights' + targetResourceId: applicationInsights.outputs.resourceId + } + ] apis: [ { - name: 'todo-api' + name: apimApiName path: 'todo' displayName: 'Simple Todo API' apiDescription: 'This is a simple Todo API' @@ -301,15 +353,13 @@ module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { } } -// Configures the API in the Azure API Management (APIM) service -module apimSettings '../../../../../common/infra/bicep/app/apim-api-settings.bicep' = if (useAPIM) { - name: 'apim-api-settings' +//Configures the API settings for an api app within the Azure API Management (APIM) service. +module apiConfig '../../../../../common/infra/bicep/app/website-config.bicep' = if (useAPIM) { + name: 'apiconfig' scope: rg params: { - apiName: 'todo-api' - name: useAPIM ? apim.outputs.name : '' - apiPath: 'todo' - applicationInsightsName: applicationInsights.outputs.name + apimServiceId: apim.outputs.resourceId + apiName: apimApiName } } diff --git a/templates/todo/projects/nodejs-mongo-swa-func/.repo/bicep/repo.yaml b/templates/todo/projects/nodejs-mongo-swa-func/.repo/bicep/repo.yaml index eddc307ff63..1e4a47a439f 100644 --- a/templates/todo/projects/nodejs-mongo-swa-func/.repo/bicep/repo.yaml +++ b/templates/todo/projects/nodejs-mongo-swa-func/.repo/bicep/repo.yaml @@ -118,8 +118,8 @@ repo: - from: ../../../../common/infra/bicep/app/applicationinsights-dashboard.bicep to: ./infra/app/applicationinsights-dashboard.bicep - - from: ../../../../common/infra/bicep/app/apim-api-settings.bicep - to: ./infra/app/apim-api-settings.bicep + - from: ../../../../common/infra/bicep/app/website-config.bicep + to: ./infra/app/website-config.bicep - from: ./../../ to: ./ diff --git a/templates/todo/projects/nodejs-mongo/.repo/bicep/infra/main.bicep b/templates/todo/projects/nodejs-mongo/.repo/bicep/infra/main.bicep index 1c094ca8606..8ef14f471e9 100644 --- a/templates/todo/projects/nodejs-mongo/.repo/bicep/infra/main.bicep +++ b/templates/todo/projects/nodejs-mongo/.repo/bicep/infra/main.bicep @@ -25,6 +25,8 @@ param resourceGroupName string = '' param webServiceName string = '' param apimServiceName string = '' param connectionStringKey string = 'AZURE-COSMOS-CONNECTION-STRING' +param apimApiName string = 'todo-api' +param apimLoggerName string = 'app-insights-logger' param collections array = [ { name: 'TodoList' @@ -253,7 +255,7 @@ module applicationInsightsDashboard '../../../../../common/infra/bicep/app/appli } // Creates Azure API Management (APIM) service to mediate the requests between the frontend and the backend API -module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { +module apim 'br/public:avm/res/api-management/service:0.2.0' = if (useAPIM) { name: 'apim-deployment' scope: rg params: { @@ -264,9 +266,59 @@ module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { tags: tags sku: apimSku skuCount: 0 + customProperties: {} + zones: [] + apiDiagnostics: [ + { + apiName: apimApiName + alwaysLog: 'allErrors' + backend: { + request: { + body: { + bytes: 1024 + } + } + response: { + body: { + bytes: 1024 + } + } + } + frontend: { + request: { + body: { + bytes: 1024 + } + } + response: { + body: { + bytes: 1024 + } + } + } + httpCorrelationProtocol: 'W3C' + logClientIp: true + loggerName: apimLoggerName + metrics: true + verbosity: 'verbose' + name: 'applicationinsights' + } + ] + loggers: [ + { + name: apimLoggerName + credentials: { + instrumentationKey: applicationInsights.outputs.instrumentationKey + } + loggerDescription: 'Logger to Azure Application Insights' + isBuffered: false + loggerType: 'applicationInsights' + targetResourceId: applicationInsights.outputs.resourceId + } + ] apis: [ { - name: 'todo-api' + name: apimApiName path: 'todo' displayName: 'Simple Todo API' apiDescription: 'This is a simple Todo API' @@ -286,16 +338,14 @@ module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { } } -// Configures the API in the Azure API Management (APIM) service -module apimSettings '../../../../../common/infra/bicep/app/apim-api-settings.bicep' = if (useAPIM) { - name: 'apim-api-settings' +//Configures the API settings for an api app within the Azure API Management (APIM) service. +module apiConfig '../../../../../common/infra/bicep/app/website-config.bicep' = if (useAPIM) { + name: 'apiconfig' scope: rg params: { + apimServiceId: apim.outputs.resourceId + apiName: apimApiName apiAppName: api.outputs.name - apiName: 'todo-api' - name: useAPIM ? apim.outputs.name : '' - apiPath: 'todo' - applicationInsightsName: applicationInsights.outputs.name } } diff --git a/templates/todo/projects/nodejs-mongo/.repo/bicep/repo.yaml b/templates/todo/projects/nodejs-mongo/.repo/bicep/repo.yaml index fd3d3e3129d..e21870b2c10 100644 --- a/templates/todo/projects/nodejs-mongo/.repo/bicep/repo.yaml +++ b/templates/todo/projects/nodejs-mongo/.repo/bicep/repo.yaml @@ -115,8 +115,8 @@ repo: - from: ../../../../common/infra/bicep/app/applicationinsights-dashboard.bicep to: ./infra/app/applicationinsights-dashboard.bicep - - from: ../../../../common/infra/bicep/app/apim-api-settings.bicep - to: ./infra/app/apim-api-settings.bicep + - from: ../../../../common/infra/bicep/app/website-config.bicep + to: ./infra/app/website-config.bicep - from: ./../../ to: ./ diff --git a/templates/todo/projects/python-mongo-aca/.repo/bicep/infra/main.bicep b/templates/todo/projects/python-mongo-aca/.repo/bicep/infra/main.bicep index d82111a5762..73255a9c388 100644 --- a/templates/todo/projects/python-mongo-aca/.repo/bicep/infra/main.bicep +++ b/templates/todo/projects/python-mongo-aca/.repo/bicep/infra/main.bicep @@ -29,6 +29,8 @@ param connectionStringKey string = 'AZURE-COSMOS-CONNECTION-STRING' param primaryReadonlyConnectionStringSecretName string= 'PRIMARY-READONLY-CONNECTION-STRING' param secondaryWriteConnectionStringSecretName string = 'SECONDARY-WRITE-CONNECTION-STRING' param secondaryReadonlyConnectionStringSecretName string = 'SECONDARY-READONLY-CONNECTION-STRING' +param apimApiName string = 'todo-api' +param apimLoggerName string = 'app-insights-logger' param collections array = [ { name: 'TodoList' @@ -333,7 +335,7 @@ module applicationInsightsDashboard '../../../../../common/infra/bicep/app/appli } // Creates Azure API Management (APIM) service to mediate the requests between the frontend and the backend API -module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { +module apim 'br/public:avm/res/api-management/service:0.2.0' = if (useAPIM) { name: 'apim-deployment' scope: rg params: { @@ -344,9 +346,59 @@ module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { tags: tags sku: apimSku skuCount: 0 + customProperties: {} + zones: [] + apiDiagnostics: [ + { + apiName: apimApiName + alwaysLog: 'allErrors' + backend: { + request: { + body: { + bytes: 1024 + } + } + response: { + body: { + bytes: 1024 + } + } + } + frontend: { + request: { + body: { + bytes: 1024 + } + } + response: { + body: { + bytes: 1024 + } + } + } + httpCorrelationProtocol: 'W3C' + logClientIp: true + loggerName: apimLoggerName + metrics: true + verbosity: 'verbose' + name: 'applicationinsights' + } + ] + loggers: [ + { + name: apimLoggerName + credentials: { + instrumentationKey: applicationInsights.outputs.instrumentationKey + } + loggerDescription: 'Logger to Azure Application Insights' + isBuffered: false + loggerType: 'applicationInsights' + targetResourceId: applicationInsights.outputs.resourceId + } + ] apis: [ { - name: 'todo-api' + name: apimApiName path: 'todo' displayName: 'Simple Todo API' apiDescription: 'This is a simple Todo API' @@ -366,15 +418,13 @@ module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { } } -// Configures the API in the Azure API Management (APIM) service -module apimSettings '../../../../../common/infra/bicep/app/apim-api-settings.bicep' = if (useAPIM) { - name: 'apim-api-settings' +//Configures the API settings for an api app within the Azure API Management (APIM) service. +module apiConfig '../../../../../common/infra/bicep/app/website-config.bicep' = if (useAPIM) { + name: 'apiconfig' scope: rg params: { - apiName: 'todo-api' - name: useAPIM ? apim.outputs.name : '' - apiPath: 'todo' - applicationInsightsName: applicationInsights.outputs.name + apimServiceId: apim.outputs.resourceId + apiName: apimApiName } } diff --git a/templates/todo/projects/python-mongo-aca/.repo/bicep/repo.yaml b/templates/todo/projects/python-mongo-aca/.repo/bicep/repo.yaml index a47fa56baad..03167008602 100644 --- a/templates/todo/projects/python-mongo-aca/.repo/bicep/repo.yaml +++ b/templates/todo/projects/python-mongo-aca/.repo/bicep/repo.yaml @@ -125,8 +125,8 @@ repo: - from: ../../../../common/infra/bicep/app/applicationinsights-dashboard.bicep to: ./infra/app/applicationinsights-dashboard.bicep - - from: ../../../../common/infra/bicep/app/apim-api-settings.bicep - to: ./infra/app/apim-api-settings.bicep + - from: ../../../../common/infra/bicep/app/website-config.bicep + to: ./infra/app/website-config.bicep - from: ./../../ to: ./ diff --git a/templates/todo/projects/python-mongo-swa-func/.repo/bicep/infra/main.bicep b/templates/todo/projects/python-mongo-swa-func/.repo/bicep/infra/main.bicep index e59e41f8ad8..52169bf6ce2 100644 --- a/templates/todo/projects/python-mongo-swa-func/.repo/bicep/infra/main.bicep +++ b/templates/todo/projects/python-mongo-swa-func/.repo/bicep/infra/main.bicep @@ -29,6 +29,8 @@ param connectionStringKey string = 'AZURE-COSMOS-CONNECTION-STRING' param primaryReadonlyConnectionStringSecretName string= 'PRIMARY-READONLY-CONNECTION-STRING' param secondaryWriteConnectionStringSecretName string = 'SECONDARY-WRITE-CONNECTION-STRING' param secondaryReadonlyConnectionStringSecretName string = 'SECONDARY-READONLY-CONNECTION-STRING' +param apimApiName string = 'todo-api' +param apimLoggerName string = 'app-insights-logger' param collections array = [ { name: 'TodoList' @@ -274,7 +276,7 @@ module applicationInsightsDashboard '../../../../../common/infra/bicep/app/appli } // Creates Azure API Management (APIM) service to mediate the requests between the frontend and the backend API -module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { +module apim 'br/public:avm/res/api-management/service:0.2.0' = if (useAPIM) { name: 'apim-deployment' scope: rg params: { @@ -285,9 +287,59 @@ module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { tags: tags sku: apimSku skuCount: 0 + customProperties: {} + zones: [] + apiDiagnostics: [ + { + apiName: apimApiName + alwaysLog: 'allErrors' + backend: { + request: { + body: { + bytes: 1024 + } + } + response: { + body: { + bytes: 1024 + } + } + } + frontend: { + request: { + body: { + bytes: 1024 + } + } + response: { + body: { + bytes: 1024 + } + } + } + httpCorrelationProtocol: 'W3C' + logClientIp: true + loggerName: apimLoggerName + metrics: true + verbosity: 'verbose' + name: 'applicationinsights' + } + ] + loggers: [ + { + name: apimLoggerName + credentials: { + instrumentationKey: applicationInsights.outputs.instrumentationKey + } + loggerDescription: 'Logger to Azure Application Insights' + isBuffered: false + loggerType: 'applicationInsights' + targetResourceId: applicationInsights.outputs.resourceId + } + ] apis: [ { - name: 'todo-api' + name: apimApiName path: 'todo' displayName: 'Simple Todo API' apiDescription: 'This is a simple Todo API' @@ -307,15 +359,13 @@ module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { } } -// Configures the API in the Azure API Management (APIM) service -module apimSettings '../../../../../common/infra/bicep/app/apim-api-settings.bicep' = if (useAPIM) { - name: 'apim-api-settings' +//Configures the API settings for an api app within the Azure API Management (APIM) service. +module apiConfig '../../../../../common/infra/bicep/app/website-config.bicep' = if (useAPIM) { + name: 'apiconfig' scope: rg params: { - apiName: 'todo-api' - name: useAPIM ? apim.outputs.name : '' - apiPath: 'todo' - applicationInsightsName: applicationInsights.outputs.name + apimServiceId: apim.outputs.resourceId + apiName: apimApiName } } diff --git a/templates/todo/projects/python-mongo-swa-func/.repo/bicep/repo.yaml b/templates/todo/projects/python-mongo-swa-func/.repo/bicep/repo.yaml index b187594e6a6..d04e08f9df2 100644 --- a/templates/todo/projects/python-mongo-swa-func/.repo/bicep/repo.yaml +++ b/templates/todo/projects/python-mongo-swa-func/.repo/bicep/repo.yaml @@ -118,8 +118,8 @@ repo: - from: ../../../../common/infra/bicep/app/applicationinsights-dashboard.bicep to: ./infra/app/applicationinsights-dashboard.bicep - - from: ../../../../common/infra/bicep/app/apim-api-settings.bicep - to: ./infra/app/apim-api-settings.bicep + - from: ../../../../common/infra/bicep/app/website-config.bicep + to: ./infra/app/website-config.bicep - from: ./../../ to: ./ diff --git a/templates/todo/projects/python-mongo/.repo/bicep/infra/main.bicep b/templates/todo/projects/python-mongo/.repo/bicep/infra/main.bicep index 13adf5b32f9..e9f9d6deaed 100644 --- a/templates/todo/projects/python-mongo/.repo/bicep/infra/main.bicep +++ b/templates/todo/projects/python-mongo/.repo/bicep/infra/main.bicep @@ -28,6 +28,8 @@ param connectionStringKey string = 'AZURE-COSMOS-CONNECTION-STRING' param primaryReadonlyConnectionStringSecretName string= 'PRIMARY-READONLY-CONNECTION-STRING' param secondaryWriteConnectionStringSecretName string = 'SECONDARY-WRITE-CONNECTION-STRING' param secondaryReadonlyConnectionStringSecretName string = 'SECONDARY-READONLY-CONNECTION-STRING' +param apimApiName string = 'todo-api' +param apimLoggerName string = 'app-insights-logger' param collections array = [ { name: 'TodoList' @@ -259,7 +261,7 @@ module applicationInsightsDashboard '../../../../../common/infra/bicep/app/appli } // Creates Azure API Management (APIM) service to mediate the requests between the frontend and the backend API -module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { +module apim 'br/public:avm/res/api-management/service:0.2.0' = if (useAPIM) { name: 'apim-deployment' scope: rg params: { @@ -270,9 +272,59 @@ module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { tags: tags sku: apimSku skuCount: 0 + customProperties: {} + zones: [] + apiDiagnostics: [ + { + apiName: apimApiName + alwaysLog: 'allErrors' + backend: { + request: { + body: { + bytes: 1024 + } + } + response: { + body: { + bytes: 1024 + } + } + } + frontend: { + request: { + body: { + bytes: 1024 + } + } + response: { + body: { + bytes: 1024 + } + } + } + httpCorrelationProtocol: 'W3C' + logClientIp: true + loggerName: apimLoggerName + metrics: true + verbosity: 'verbose' + name: 'applicationinsights' + } + ] + loggers: [ + { + name: apimLoggerName + credentials: { + instrumentationKey: applicationInsights.outputs.instrumentationKey + } + loggerDescription: 'Logger to Azure Application Insights' + isBuffered: false + loggerType: 'applicationInsights' + targetResourceId: applicationInsights.outputs.resourceId + } + ] apis: [ { - name: 'todo-api' + name: apimApiName path: 'todo' displayName: 'Simple Todo API' apiDescription: 'This is a simple Todo API' @@ -292,16 +344,14 @@ module apim 'br/public:avm/res/api-management/service:0.1.7' = if (useAPIM) { } } -// Configures the API in the Azure API Management (APIM) service -module apimSettings '../../../../../common/infra/bicep/app/apim-api-settings.bicep' = if (useAPIM) { - name: 'apim-api-settings' +//Configures the API settings for an api app within the Azure API Management (APIM) service. +module apiConfig '../../../../../common/infra/bicep/app/website-config.bicep' = if (useAPIM) { + name: 'apiconfig' scope: rg params: { + apimServiceId: apim.outputs.resourceId + apiName: apimApiName apiAppName: api.outputs.name - apiName: 'todo-api' - name: useAPIM ? apim.outputs.name : '' - apiPath: 'todo' - applicationInsightsName: applicationInsights.outputs.name } } diff --git a/templates/todo/projects/python-mongo/.repo/bicep/repo.yaml b/templates/todo/projects/python-mongo/.repo/bicep/repo.yaml index 4ee83de91ce..76ef91da08b 100644 --- a/templates/todo/projects/python-mongo/.repo/bicep/repo.yaml +++ b/templates/todo/projects/python-mongo/.repo/bicep/repo.yaml @@ -128,8 +128,8 @@ repo: - from: ../../../../common/infra/bicep/app/applicationinsights-dashboard.bicep to: ./infra/app/applicationinsights-dashboard.bicep - - from: ../../../../common/infra/bicep/app/apim-api-settings.bicep - to: ./infra/app/apim-api-settings.bicep + - from: ../../../../common/infra/bicep/app/website-config.bicep + to: ./infra/app/website-config.bicep - from: ./../../ to: ./