diff --git a/avm/res/app/container-app/README.md b/avm/res/app/container-app/README.md index b1a6261487..c2e0a4c238 100644 --- a/avm/res/app/container-app/README.md +++ b/avm/res/app/container-app/README.md @@ -26,23 +26,20 @@ The following section provides usage examples for the module, which were used to >**Note**: Each example lists all the required parameters first, followed by the rest - each in alphabetical order. ->**Note**: To reference the module, please use the following syntax `br/public:avm/res/app/container-app:`. +>**Note**: To reference the module, please use the following syntax `br/public:AVM/bicep-registry-modules:`. -- [Using only defaults](#example-1-using-only-defaults) -- [Using large parameter set](#example-2-using-large-parameter-set) -- [WAF-aligned](#example-3-waf-aligned) - -### Example 1: _Using only defaults_ - -This instance deploys the module with the minimum set of required parameters. +- [Defaults](#example-1-defaults) +- [Max](#example-2-max) +- [Waf-Aligned](#example-3-waf-aligned) +### Example 1: _Defaults_
via Bicep module ```bicep -module containerApp 'br/public:avm/res/app/container-app:' = { +module containerApp 'br/public:AVM/bicep-registry-modules:' = { name: '${uniqueString(deployment().name, location)}-test-acamin' params: { // Required parameters @@ -106,17 +103,14 @@ module containerApp 'br/public:avm/res/app/container-app:' = {

-### Example 2: _Using large parameter set_ - -This instance deploys the module with most of its features enabled. - +### Example 2: _Max_

via Bicep module ```bicep -module containerApp 'br/public:avm/res/app/container-app:' = { +module containerApp 'br/public:AVM/bicep-registry-modules:' = { name: '${uniqueString(deployment().name, location)}-test-acamax' params: { // Required parameters @@ -150,14 +144,6 @@ module containerApp 'br/public:avm/res/app/container-app:' = { environmentId: '' name: 'acamax001' // Non-required parameters - diagnosticSettings: [ - { - eventHubAuthorizationRuleResourceId: '' - eventHubName: '' - storageAccountResourceId: '' - workspaceResourceId: '' - } - ] location: '' lock: { kind: 'CanNotDelete' @@ -250,16 +236,6 @@ module containerApp 'br/public:avm/res/app/container-app:' = { "value": "acamax001" }, // Non-required parameters - "diagnosticSettings": { - "value": [ - { - "eventHubAuthorizationRuleResourceId": "", - "eventHubName": "", - "storageAccountResourceId": "", - "workspaceResourceId": "" - } - ] - }, "location": { "value": "" }, @@ -318,17 +294,14 @@ module containerApp 'br/public:avm/res/app/container-app:' = {

-### Example 3: _WAF-aligned_ - -This instance deploys the module in alignment with the best-practices of the Azure Well-Architected Framework. - +### Example 3: _Waf-Aligned_

via Bicep module ```bicep -module containerApp 'br/public:avm/res/app/container-app:' = { +module containerApp 'br/public:AVM/bicep-registry-modules:' = { name: '${uniqueString(deployment().name, location)}-test-acawaf' params: { // Required parameters @@ -362,14 +335,6 @@ module containerApp 'br/public:avm/res/app/container-app:' = { environmentId: '' name: 'acawaf001' // Non-required parameters - diagnosticSettings: [ - { - eventHubAuthorizationRuleResourceId: '' - eventHubName: '' - storageAccountResourceId: '' - workspaceResourceId: '' - } - ] ingressAllowInsecure: false ingressExternal: false location: '' @@ -439,16 +404,6 @@ module containerApp 'br/public:avm/res/app/container-app:' = { "value": "acawaf001" }, // Non-required parameters - "diagnosticSettings": { - "value": [ - { - "eventHubAuthorizationRuleResourceId": "", - "eventHubName": "", - "storageAccountResourceId": "", - "workspaceResourceId": "" - } - ] - }, "ingressAllowInsecure": { "value": false }, diff --git a/avm/res/app/container-app/main.bicep b/avm/res/app/container-app/main.bicep index 1d8efd0d4b..d7b7d34169 100644 --- a/avm/res/app/container-app/main.bicep +++ b/avm/res/app/container-app/main.bicep @@ -54,9 +54,6 @@ param tags object? @description('Optional. Collection of private container registry credentials for containers used by the Container app.') param registries array = [] -@description('Optional. The diagnostic settings of the service.') -param diagnosticSettings diagnosticSettingType - @description('Optional. The managed identity definition for this resource.') param managedIdentities managedIdentitiesType @@ -194,32 +191,6 @@ resource containerApp 'Microsoft.App/containerApps@2023-05-01' = { } } -resource containerApp_diagnosticSettings 'Microsoft.Insights/diagnosticSettings@2021-05-01-preview' = [for (diagnosticSetting, index) in (diagnosticSettings ?? []): { - name: diagnosticSetting.?name ?? '${name}-diagnosticSettings' - properties: { - storageAccountId: diagnosticSetting.?storageAccountResourceId - workspaceId: diagnosticSetting.?workspaceResourceId - eventHubAuthorizationRuleId: diagnosticSetting.?eventHubAuthorizationRuleResourceId - eventHubName: diagnosticSetting.?eventHubName - metrics: diagnosticSetting.?metricCategories ?? [ - { - category: 'AllMetrics' - timeGrain: null - enabled: true - } - ] - logs: diagnosticSetting.?logCategoriesAndGroups ?? [ - { - categoryGroup: 'allLogs' - enabled: true - } - ] - marketplacePartnerId: diagnosticSetting.?marketplacePartnerResourceId - logAnalyticsDestinationType: diagnosticSetting.?logAnalyticsDestinationType - } - scope: containerApp -}] - resource containerApp_lock 'Microsoft.Authorization/locks@2020-05-01' = if (!empty(lock ?? {}) && lock.?kind != 'None') { name: lock.?name ?? 'lock-${name}' properties: { @@ -262,44 +233,6 @@ output location string = containerApp.location // Definitions // // =============== // -type diagnosticSettingType = { - @description('Optional. The name of diagnostic setting.') - name: string? - - @description('Optional. The name of logs that will be streamed. "allLogs" includes all possible logs for the resource. Set to \'\' to disable log collection.') - logCategoriesAndGroups: { - @description('Optional. Name of a Diagnostic Log category for a resource type this setting is applied to. Set the specific logs to collect here.') - category: string? - - @description('Optional. Name of a Diagnostic Log category group for a resource type this setting is applied to. Set to \'allLogs\' to collect all logs.') - categoryGroup: string? - }[]? - - @description('Optional. The name of metrics that will be streamed. "allMetrics" includes all possible metrics for the resource. Set to \'\' to disable metric collection.') - metricCategories: { - @description('Required. Name of a Diagnostic Metric category for a resource type this setting is applied to. Set to \'AllMetrics\' to collect all metrics.') - category: string - }[]? - - @description('Optional. A string indicating whether the export to Log Analytics should use the default destination type, i.e. AzureDiagnostics, or use a destination type.') - logAnalyticsDestinationType: ('Dedicated' | 'AzureDiagnostics')? - - @description('Optional. Resource ID of the diagnostic log analytics workspace. For security reasons, it is recommended to set diagnostic settings to send data to either storage account, log analytics workspace or event hub.') - workspaceResourceId: string? - - @description('Optional. Resource ID of the diagnostic storage account. For security reasons, it is recommended to set diagnostic settings to send data to either storage account, log analytics workspace or event hub.') - storageAccountResourceId: string? - - @description('Optional. Resource ID of the diagnostic event hub authorization rule for the Event Hubs namespace in which the event hub should be created or streamed to.') - eventHubAuthorizationRuleResourceId: string? - - @description('Optional. Name of the diagnostic event hub within the namespace to which logs are streamed. Without this, an event hub is created for each log category. For security reasons, it is recommended to set diagnostic settings to send data to either storage account, log analytics workspace or event hub.') - eventHubName: string? - - @description('Optional. The full ARM resource ID of the Marketplace resource to which you would like to send Diagnostic Logs.') - marketplacePartnerResourceId: string? -}[]? - type managedIdentitiesType = { @description('Optional. Enables system assigned managed identity on the resource.') systemAssigned: bool? diff --git a/avm/res/app/container-app/tests/e2e/defaults/main.test.bicep b/avm/res/app/container-app/tests/e2e/defaults/main.test.bicep index 146cdb89e5..19ba7a0c5a 100644 --- a/avm/res/app/container-app/tests/e2e/defaults/main.test.bicep +++ b/avm/res/app/container-app/tests/e2e/defaults/main.test.bicep @@ -40,20 +40,6 @@ module nestedDependencies 'dependencies.bicep' = { } } -// Diagnostics -// =========== -module diagnosticDependencies '../../../../../../utilities/e2e-template-assets/templates/diagnostic.dependencies.bicep' = { - scope: resourceGroup - name: '${uniqueString(deployment().name, location)}-diagnosticDependencies' - params: { - storageAccountName: 'dep${namePrefix}diasa${serviceShort}01' - logAnalyticsWorkspaceName: 'dep-${namePrefix}-law-${serviceShort}' - eventHubNamespaceEventHubName: 'dep-${namePrefix}-evh-${serviceShort}' - eventHubNamespaceName: 'dep-${namePrefix}-evhns-${serviceShort}' - location: location - } -} - // ============== // // Test Execution // // ============== // diff --git a/avm/res/app/container-app/tests/e2e/max/dependencies.bicep b/avm/res/app/container-app/tests/e2e/max/dependencies.bicep index 634defb509..0ca3555668 100644 --- a/avm/res/app/container-app/tests/e2e/max/dependencies.bicep +++ b/avm/res/app/container-app/tests/e2e/max/dependencies.bicep @@ -10,7 +10,11 @@ param managedIdentityName string resource managedEnvironment 'Microsoft.App/managedEnvironments@2023-05-01' = { name: managedEnvironmentName location: location - properties: {} + properties: { + appLogsConfiguration: { + destination: 'azure-monitor' + } + } } resource managedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = { diff --git a/avm/res/app/container-app/tests/e2e/max/main.test.bicep b/avm/res/app/container-app/tests/e2e/max/main.test.bicep index 6209db1b36..b7443708df 100644 --- a/avm/res/app/container-app/tests/e2e/max/main.test.bicep +++ b/avm/res/app/container-app/tests/e2e/max/main.test.bicep @@ -41,20 +41,6 @@ module nestedDependencies 'dependencies.bicep' = { } } -// Diagnostics -// =========== -module diagnosticDependencies '../../../../../../utilities/e2e-template-assets/templates/diagnostic.dependencies.bicep' = { - scope: resourceGroup - name: '${uniqueString(deployment().name, location)}-diagnosticDependencies' - params: { - storageAccountName: 'dep${namePrefix}diasa${serviceShort}01' - logAnalyticsWorkspaceName: 'dep-${namePrefix}-law-${serviceShort}' - eventHubNamespaceEventHubName: 'dep-${namePrefix}-evh-${serviceShort}' - eventHubNamespaceName: 'dep-${namePrefix}-evhns-${serviceShort}' - location: location - } -} - // ============== // // Test Execution // // ============== // @@ -65,14 +51,6 @@ module testDeployment '../../../main.bicep' = [for iteration in [ 'init', 'idem' name: '${uniqueString(deployment().name, location)}-test-${serviceShort}-${iteration}' params: { name: '${namePrefix}${serviceShort}001' - diagnosticSettings: [ - { - eventHubName: diagnosticDependencies.outputs.eventHubNamespaceEventHubName - eventHubAuthorizationRuleResourceId: diagnosticDependencies.outputs.eventHubAuthorizationRuleId - storageAccountResourceId: diagnosticDependencies.outputs.storageAccountResourceId - workspaceResourceId: diagnosticDependencies.outputs.logAnalyticsWorkspaceResourceId - } - ] tags: { 'hidden-title': 'This is visible in the resource name' Env: 'test' diff --git a/avm/res/app/container-app/tests/e2e/waf-aligned/main.test.bicep b/avm/res/app/container-app/tests/e2e/waf-aligned/main.test.bicep index a9800b6bda..73446fb75e 100644 --- a/avm/res/app/container-app/tests/e2e/waf-aligned/main.test.bicep +++ b/avm/res/app/container-app/tests/e2e/waf-aligned/main.test.bicep @@ -41,20 +41,6 @@ module nestedDependencies 'dependencies.bicep' = { } } -// Diagnostics -// =========== -module diagnosticDependencies '../../../../../../utilities/e2e-template-assets/templates/diagnostic.dependencies.bicep' = { - scope: resourceGroup - name: '${uniqueString(deployment().name, location)}-diagnosticDependencies' - params: { - storageAccountName: 'dep${namePrefix}diasa${serviceShort}01' - logAnalyticsWorkspaceName: 'dep-${namePrefix}-law-${serviceShort}' - eventHubNamespaceEventHubName: 'dep-${namePrefix}-evh-${serviceShort}' - eventHubNamespaceName: 'dep-${namePrefix}-evhns-${serviceShort}' - location: location - } -} - // ============== // // Test Execution // // ============== // @@ -67,14 +53,6 @@ module testDeployment '../../../main.bicep' = [for iteration in [ 'init', 'idem' name: '${namePrefix}${serviceShort}001' ingressExternal: false ingressAllowInsecure: false - diagnosticSettings: [ - { - eventHubName: diagnosticDependencies.outputs.eventHubNamespaceEventHubName - eventHubAuthorizationRuleResourceId: diagnosticDependencies.outputs.eventHubAuthorizationRuleId - storageAccountResourceId: diagnosticDependencies.outputs.storageAccountResourceId - workspaceResourceId: diagnosticDependencies.outputs.logAnalyticsWorkspaceResourceId - } - ] tags: { 'hidden-title': 'This is visible in the resource name' Env: 'test'