Skip to content

Commit 5ddd89c

Browse files
code updated based on latest infra changes
1 parent f56230e commit 5ddd89c

File tree

3 files changed

+48
-44346
lines changed

3 files changed

+48
-44346
lines changed

infra/main.bicep

Lines changed: 45 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ param solutionUniqueText string = take(uniqueString(subscription().id, resourceG
3232
])
3333
param location string
3434

35+
//Get the current deployer's information
36+
var deployerInfo = deployer()
37+
var deployingUserPrincipalId = deployerInfo.objectId
38+
3539
// Restricting deployment to only supported Azure OpenAI regions validated with GPT-4o model
3640
@allowed(['australiaeast', 'eastus2', 'francecentral', 'japaneast', 'norwayeast', 'swedencentral', 'uksouth', 'westus'])
3741
@metadata({
@@ -1415,9 +1419,6 @@ module containerApp 'br/public:avm/res/app/container-app:0.18.1' = {
14151419
}
14161420
}
14171421

1418-
var webServerFarmEnabled = webServerFarmConfiguration.?enabled ?? true
1419-
var webServerFarmResourceName = webServerFarmConfiguration.?name ?? 'asp-${solutionPrefix}'
1420-
14211422
// ========== Frontend server farm ========== //
14221423
// WAF best practices for Web Application Services: https://learn.microsoft.com/en-us/azure/well-architected/service-guides/app-service-web-apps
14231424
// PSRule for Web Server Farm: https://azure.github.io/PSRule.Rules.Azure/en/rules/resource/#app-service
@@ -1459,23 +1460,35 @@ module webSite 'modules/web-sites.bicep' = {
14591460
linuxFxVersion: 'DOCKER|${frontendContainerRegistryHostname}/${frontendContainerImageName}:${frontendContainerImageTag}'
14601461
minTlsVersion: '1.2'
14611462
}
1462-
appSettingsKeyValuePairs: {
1463-
SCM_DO_BUILD_DURING_DEPLOYMENT: 'true'
1464-
DOCKER_REGISTRY_SERVER_URL: 'https://${webSiteConfiguration.?containerImageRegistryDomain ?? 'biabcontainerreg.azurecr.io'}'
1465-
WEBSITES_PORT: '3000'
1466-
WEBSITES_CONTAINER_START_TIME_LIMIT: '1800' // 30 minutes, adjust as needed
1467-
BACKEND_API_URL: 'https://${containerApp.outputs.fqdn}'
1468-
AUTH_ENABLED: 'false'
1469-
APP_ENV: 'Prod'
1470-
}
1463+
configs: [
1464+
{
1465+
name: 'appsettings'
1466+
properties: {
1467+
SCM_DO_BUILD_DURING_DEPLOYMENT: 'true'
1468+
DOCKER_REGISTRY_SERVER_URL: 'https://${frontendContainerRegistryHostname}'
1469+
WEBSITES_PORT: '3000'
1470+
WEBSITES_CONTAINER_START_TIME_LIMIT: '1800' // 30 minutes, adjust as needed
1471+
BACKEND_API_URL: 'https://${containerApp.outputs.fqdn}'
1472+
AUTH_ENABLED: 'false'
1473+
}
1474+
// WAF aligned configuration for Monitoring
1475+
applicationInsightResourceId: enableMonitoring ? applicationInsights!.outputs.resourceId : null
1476+
}
1477+
]
1478+
diagnosticSettings: enableMonitoring ? [{ workspaceResourceId: logAnalyticsWorkspaceResourceId }] : null
1479+
// WAF aligned configuration for Private Networking
1480+
vnetRouteAllEnabled: enablePrivateNetworking ? true : false
1481+
vnetImagePullEnabled: enablePrivateNetworking ? true : false
1482+
virtualNetworkSubnetId: enablePrivateNetworking ? virtualNetwork!.outputs.subnetResourceIds[4] : null
1483+
publicNetworkAccess: 'Enabled' // Always enabling the public network access for Web App
14711484
}
14721485
}
14731486

14741487

14751488
// ========== Storage Account ========== //
14761489

1477-
module privateDnsZonesStorageAccount 'br/public:avm/res/network/private-dns-zone:0.7.0' = if (virtualNetworkEnabled) {
1478-
name: take('avm.res.network.private-dns-zone.storage-account.${solutionPrefix}', 64)
1490+
module privateDnsZonesStorageAccount 'br/public:avm/res/network/private-dns-zone:0.7.0' = if (enablePrivateNetworking ) {
1491+
name: take('avm.res.network.private-dns-zone.storage-account.${solutionSuffix}', 64)
14791492
params: {
14801493
name: 'privatelink.blob.core.windows.net'
14811494
enableTelemetry: enableTelemetry
@@ -1489,13 +1502,13 @@ module privateDnsZonesStorageAccount 'br/public:avm/res/network/private-dns-zone
14891502
}
14901503
}
14911504

1492-
var storageAccountName = replace('st${solutionPrefix}', '-', '')
1505+
var storageAccountName = replace('st${solutionSuffix}', '-', '')
14931506
param storageContainerName string = 'sample-dataset'
14941507
module avmStorageAccount 'br/public:avm/res/storage/storage-account:0.20.0' = {
14951508
name: take('avm.res.storage.storage-account.${storageAccountName}', 64)
14961509
params: {
14971510
name: storageAccountName
1498-
location: solutionLocation
1511+
location: location
14991512
managedIdentities: { systemAssigned: true }
15001513
minimumTlsVersion: 'TLS1_2'
15011514
enableTelemetry: enableTelemetry
@@ -1519,16 +1532,16 @@ module avmStorageAccount 'br/public:avm/res/storage/storage-account:0.20.0' = {
15191532
// WAF aligned networking
15201533
networkAcls: {
15211534
bypass: 'AzureServices'
1522-
defaultAction: virtualNetworkEnabled ? 'Deny' : 'Allow'
1535+
defaultAction: enablePrivateNetworking ? 'Deny' : 'Allow'
15231536
}
15241537
allowBlobPublicAccess: false
1525-
publicNetworkAccess: virtualNetworkEnabled ? 'Disabled' : 'Enabled'
1538+
publicNetworkAccess: enablePrivateNetworking ? 'Disabled' : 'Enabled'
15261539

15271540
// Private endpoints for blob
1528-
privateEndpoints: virtualNetworkEnabled
1541+
privateEndpoints: enablePrivateNetworking
15291542
? [
15301543
{
1531-
name: 'pep-blob-${solutionPrefix}'
1544+
name: 'pep-blob-${solutionSuffix}'
15321545
privateDnsZoneGroup: {
15331546
privateDnsZoneGroupConfigs: [
15341547
{
@@ -1561,8 +1574,8 @@ module avmStorageAccount 'br/public:avm/res/storage/storage-account:0.20.0' = {
15611574

15621575
// ========== Search Service ========== //
15631576

1564-
module privateDnsZonesSearchService 'br/public:avm/res/network/private-dns-zone:0.7.0' = if (virtualNetworkEnabled) {
1565-
name: take('avm.res.network.private-dns-zone.search-service.${solutionPrefix}', 64)
1577+
module privateDnsZonesSearchService 'br/public:avm/res/network/private-dns-zone:0.7.0' = if (enablePrivateNetworking ) {
1578+
name: take('avm.res.network.private-dns-zone.search-service.${solutionSuffix}', 64)
15661579
params: {
15671580
name: 'privatelink.search.windows.net'
15681581
enableTelemetry: enableTelemetry
@@ -1576,9 +1589,9 @@ module privateDnsZonesSearchService 'br/public:avm/res/network/private-dns-zone:
15761589
}
15771590
}
15781591

1579-
var searchServiceName = 'srch-${solutionPrefix}'
1592+
var searchServiceName = 'srch-${solutionSuffix}'
15801593
module searchService 'br/public:avm/res/search/search-service:0.11.1' = {
1581-
name: take('avm.res.search.search-service.${solutionPrefix}', 64)
1594+
name: take('avm.res.search.search-service.${solutionSuffix}', 64)
15821595
params: {
15831596
name: searchServiceName
15841597
authOptions: {
@@ -1591,7 +1604,7 @@ module searchService 'br/public:avm/res/search/search-service:0.11.1' = {
15911604
managedIdentities: {
15921605
systemAssigned: true
15931606
}
1594-
publicNetworkAccess: virtualNetworkEnabled ? 'Disabled' : 'Enabled'
1607+
publicNetworkAccess: enablePrivateNetworking ? 'Disabled' : 'Enabled'
15951608
networkRuleSet: {
15961609
bypass: 'AzureServices'
15971610
}
@@ -1611,10 +1624,10 @@ module searchService 'br/public:avm/res/search/search-service:0.11.1' = {
16111624
principalType: 'User'
16121625
}
16131626
]
1614-
privateEndpoints: virtualNetworkEnabled
1627+
privateEndpoints: enablePrivateNetworking
16151628
? [
16161629
{
1617-
name: 'pep-search-${solutionPrefix}'
1630+
name: 'pep-search-${solutionSuffix}'
16181631
privateDnsZoneGroup: {
16191632
privateDnsZoneGroupConfigs: [
16201633
{
@@ -1632,11 +1645,11 @@ module searchService 'br/public:avm/res/search/search-service:0.11.1' = {
16321645

16331646
// ========== Search Service - AI Project Connection ========== //
16341647

1635-
var aiSearchConnectionName = 'aifp-srch-connection-${solutionPrefix}'
1636-
var aifSubscriptionId = useExistingFoundryProject ? split(existingFoundryProjectResourceId, '/')[2] : subscription().subscriptionId
1637-
var aifResourceGroup = useExistingFoundryProject ? split(existingFoundryProjectResourceId, '/')[4] : resourceGroup().name
1638-
module aiSearchFoundryConnection 'modules/aifp_search_connection.bicep' = if (aiFoundryAIservicesEnabled) {
1639-
name: take('aifp-srch-connection.${solutionPrefix}', 64)
1648+
var aiSearchConnectionName = 'aifp-srch-connection-${solutionSuffix}'
1649+
var aifSubscriptionId = useExistingAiFoundryAiProject ? split(existingAiFoundryAiProjectResourceId, '/')[2] : subscription().subscriptionId
1650+
var aifResourceGroup = useExistingAiFoundryAiProject ? split(existingAiFoundryAiProjectResourceId, '/')[4] : resourceGroup().name
1651+
module aiSearchFoundryConnection 'modules/aifp_search_connection.bicep' = {
1652+
name: take('aifp-srch-connection.${solutionSuffix}', 64)
16401653
scope: resourceGroup(aifSubscriptionId, aifResourceGroup)
16411654
params: {
16421655
aiFoundryProjectName: aiFoundryAiProjectName

0 commit comments

Comments
 (0)