From 0e9d3cc432dc0d5c40d4fa074aac0ac93cfd35e3 Mon Sep 17 00:00:00 2001 From: Tom Hawkin Date: Tue, 10 Nov 2026 16:57:39 +0000 Subject: [PATCH 1/2] fixes for api-batch-processor deployment. added some default settings in to reduce modifications on what-if --- infra/modules/shared/container-registry.bicep | 6 ++ infra/modules/shared/egress-firewall.bicep | 12 +++- infra/modules/shared/observability.bicep | 2 + infra/stacks/api-batch-processor/main.bicep | 58 +++++++++++-------- 4 files changed, 53 insertions(+), 25 deletions(-) diff --git a/infra/modules/shared/container-registry.bicep b/infra/modules/shared/container-registry.bicep index bab087e3..31cd9b9d 100644 --- a/infra/modules/shared/container-registry.bicep +++ b/infra/modules/shared/container-registry.bicep @@ -24,6 +24,12 @@ resource containerRegistry 'Microsoft.ContainerRegistry/registries@2026-01-01-pr name: 'Premium' } properties: { + encryption: { + status: 'disabled' + } + endpointProtocol: 'IPv4' + regionalEndpoints: 'Disabled' + roleAssignmentMode: 'LegacyRegistryPermissions' dataEndpointEnabled: true publicNetworkAccess: 'Disabled' // Allow ACR Tasks (az acr build) to push through the network rules. diff --git a/infra/modules/shared/egress-firewall.bicep b/infra/modules/shared/egress-firewall.bicep index 5a3c30d8..812b2432 100644 --- a/infra/modules/shared/egress-firewall.bicep +++ b/infra/modules/shared/egress-firewall.bicep @@ -180,6 +180,7 @@ resource firewallSubnet 'Microsoft.Network/virtualNetworks/subnets@2024-05-01' = name: 'AzureFirewallSubnet' properties: { addressPrefix: firewallSubnetAddressPrefix + privateEndpointNetworkPolicies: 'Enabled' } } @@ -188,6 +189,7 @@ resource firewallManagementSubnet 'Microsoft.Network/virtualNetworks/subnets@202 name: 'AzureFirewallManagementSubnet' properties: { addressPrefix: firewallManagementSubnetAddressPrefix + privateEndpointNetworkPolicies: 'Enabled' } } @@ -196,11 +198,15 @@ resource publicIP 'Microsoft.Network/publicIPAddresses@2023-06-01' = { location: location sku: { name: 'Standard' + tier: 'Regional' } tags: tags properties: { publicIPAllocationMethod: 'Static' publicIPAddressVersion: 'IPv4' + ddosSettings:{ + protectionMode: 'VirtualNetworkInherited' + } } } @@ -209,11 +215,15 @@ resource managementPublicIP 'Microsoft.Network/publicIPAddresses@2023-06-01' = { location: location sku: { name: 'Standard' + tier: 'Regional' } tags: tags properties: { publicIPAllocationMethod: 'Static' publicIPAddressVersion: 'IPv4' + ddosSettings:{ + protectionMode: 'VirtualNetworkInherited' + } } } @@ -269,7 +279,7 @@ resource firewall 'Microsoft.Network/azureFirewalls@2024-05-01' = { } } -resource applicationRuleCollectionGroup 'Microsoft.Network/firewallPolicies/ruleCollectionGroups@2022-01-01' = { +resource applicationRuleCollectionGroup 'Microsoft.Network/firewallPolicies/ruleCollectionGroups@2026-01-01' = { parent: firewallPolicy name: 'DefaultApplicationRuleCollectionGroup' properties: { diff --git a/infra/modules/shared/observability.bicep b/infra/modules/shared/observability.bicep index dc87d755..45298408 100644 --- a/infra/modules/shared/observability.bicep +++ b/infra/modules/shared/observability.bicep @@ -23,6 +23,7 @@ resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2022-10 sku: { name: 'PerGB2018' } + retentionInDays: 30 } } @@ -58,6 +59,7 @@ resource applicationInsights 'Microsoft.Insights/components@2020-02-02' = { Application_Type: 'web' Flow_Type: 'Bluefield' WorkspaceResourceId: logAnalyticsWorkspace.id + Request_Source: 'rest' } } diff --git a/infra/stacks/api-batch-processor/main.bicep b/infra/stacks/api-batch-processor/main.bicep index 8959b9ee..bf29ffb8 100644 --- a/infra/stacks/api-batch-processor/main.bicep +++ b/infra/stacks/api-batch-processor/main.bicep @@ -161,17 +161,6 @@ module secrets '../../modules/shared/secrets.bicep' = { } } -module keyVaultPrivateEndpoint '../../modules/shared/key-vault-private-endpoint.bicep' = { - name: 'secrets-private-endpoint' - params: { - location: location - tags: tags - keyVaultName: secrets.outputs.name - peSubnetId: containerAppNetwork.outputs.privateEndpointSubnetId - vnetId: containerAppNetwork.outputs.virtualNetworkId - } -} - module egressFirewall '../../modules/shared/egress-firewall.bicep' = { name: 'egress-firewall' params: { @@ -205,6 +194,27 @@ module containerAppNetwork '../../modules/shared/container-app-network.bicep' = tags: tags } } +module keyVaultPrivateEndpoint '../../modules/shared/key-vault-private-endpoint.bicep' = { + name: 'secrets-private-endpoint' + params: { + location: location + tags: tags + keyVaultName: secrets.outputs.name + peSubnetId: containerAppNetwork.outputs.privateEndpointSubnetId + vnetId: containerAppNetwork.outputs.virtualNetworkId + } +} + +module acrPrivateEndpoint '../../modules/shared/acr-private-endpoint.bicep' = { + name: 'acr-private-endpoint' + params: { + location: location + tags: tags + registryName: containerRegistry.outputs.name + peSubnetId: containerAppNetwork.outputs.privateEndpointSubnetId + vnetId: containerAppNetwork.outputs.virtualNetworkId + } +} module caeFirewallPeering '../../modules/shared/virtual-network-peering.bicep' = { name: 'cae-firewall-peering' @@ -288,6 +298,19 @@ module matchingApi '../../modules/api-apps/matching-api.bicep' = { } } +module pdsEmulator '../../modules/api-apps/pds-emulator.bicep' = if (usePdsEmulator) { + name: 'pds-emulator' + params: { + location: location + containerAppsEnvironmentId: containerAppEnvironment.outputs.id + containerRegistryServer: containerRegistry.outputs.endpoint + managedIdentityId: identity.outputs.id + environmentName: environmentName + imageTag: pdsEmulatorImageTag + tags: tags + } +} + module externalApi '../../modules/api-apps/external-api.bicep' = { name: 'external-api' params: { @@ -313,19 +336,6 @@ module externalApi '../../modules/api-apps/external-api.bicep' = { ] } -module pdsEmulator '../../modules/api-apps/pds-emulator.bicep' = if (usePdsEmulator) { - name: 'pds-emulator' - params: { - location: location - containerAppsEnvironmentId: containerAppEnvironment.outputs.id - containerRegistryServer: containerRegistry.outputs.endpoint - managedIdentityId: identity.outputs.id - environmentName: environmentName - imageTag: pdsEmulatorImageTag - tags: tags - } -} - module graphqlProcessJob '../../modules/api-batch-processor/graphql-process-job.bicep' = { name: 'api-batch-processor-graphql-process-job' params: { From 8f737bc7d347aa494a84010b5f3b266db97f7ae5 Mon Sep 17 00:00:00 2001 From: Tom Hawkin Date: Fri, 13 Nov 2026 15:47:29 +0000 Subject: [PATCH 2/2] added acr private endpoint as a dependency of container app environment --- infra/stacks/api-batch-processor/main.bicep | 1 + 1 file changed, 1 insertion(+) diff --git a/infra/stacks/api-batch-processor/main.bicep b/infra/stacks/api-batch-processor/main.bicep index bf29ffb8..05a97311 100644 --- a/infra/stacks/api-batch-processor/main.bicep +++ b/infra/stacks/api-batch-processor/main.bicep @@ -244,6 +244,7 @@ module containerAppEnvironment '../../modules/shared/container-app-environment.b } dependsOn: [ caeFirewallPeering + acrPrivateEndpoint ] }