@@ -185,6 +185,9 @@ param createdBy string = contains(deployer(), 'userPrincipalName')
185185 ? split (deployer ().userPrincipalName , '@' )[0 ]
186186 : deployer ().objectId
187187
188+ @description ('Optional. Flag to indicate if this is a custom code deployment. If true, some resources may be skipped or configured differently.' )
189+ param isCustom bool = false
190+
188191var deployerInfo = deployer ()
189192var deployingUserPrincipalId = deployerInfo .objectId
190193var deployerPrincipalType = contains (deployerInfo , 'userPrincipalName' ) ? 'User' : 'ServicePrincipal'
@@ -485,12 +488,27 @@ module foundry_search_connection './modules/ai/ai-foundry-connection.bicep' = {
485488 }
486489}
487490
491+ module container_registry './modules/compute/container-registry.bicep' = if (isCustom ) {
492+ name : take ('module.container-registry.${solutionSuffix }' , 64 )
493+ params : {
494+ solutionName : solutionSuffix
495+ name : 'cr${solutionSuffix }'
496+ location : solutionLocation
497+ tags : allTags
498+ sku : 'Basic'
499+ adminUserEnabled : false
500+ publicNetworkAccess : 'Enabled'
501+ exportPolicyStatus : 'enabled'
502+ retentionPolicyStatus : 'disabled'
503+ }
504+ }
505+
488506module backend_container_app './modules/compute/container-app.bicep' = {
489507 name : take ('module.backend-container-app.${solutionSuffix }' , 64 )
490508 params : {
491509 name : backendContainerAppName
492510 location : solutionLocation
493- tags : allTags
511+ tags : isCustom ? union ( allTags , { 'azd-service-name' : 'backend' }) : allTags
494512 environmentResourceId : container_app_environment .outputs .resourceId
495513 ingressExternal : true
496514 ingressTargetPort : 8000
@@ -514,6 +532,12 @@ module backend_container_app './modules/compute/container-app.bicep' = {
514532 minReplicas : 1
515533 maxReplicas : 1
516534 }
535+ registries : isCustom ? [
536+ {
537+ server : container_registry !.outputs .loginServer
538+ identity : userAssignedIdentity .outputs .resourceId
539+ }
540+ ] : []
517541 containers : [
518542 {
519543 name : 'backend'
@@ -658,7 +682,7 @@ module mcp_container_app './modules/compute/container-app.bicep' = {
658682 params : {
659683 name : mcpContainerAppName
660684 location : solutionLocation
661- tags : allTags
685+ tags : isCustom ? union ( allTags , { 'azd-service-name' : 'mcp' }) : allTags
662686 environmentResourceId : container_app_environment .outputs .resourceId
663687 ingressExternal : true
664688 ingressTargetPort : 9000
@@ -675,6 +699,12 @@ module mcp_container_app './modules/compute/container-app.bicep' = {
675699 minReplicas : 1
676700 maxReplicas : 1
677701 }
702+ registries : isCustom ? [
703+ {
704+ server : container_registry !.outputs .loginServer
705+ identity : userAssignedIdentity .outputs .resourceId
706+ }
707+ ] : []
678708 containers : [
679709 {
680710 name : 'mcp'
@@ -770,10 +800,21 @@ module frontend_app './modules/compute/app-service.bicep' = {
770800 params : {
771801 solutionName : frontendAppName
772802 location : solutionLocation
773- tags : allTags
803+ tags : isCustom ? union ( allTags , { 'azd-service-name' : 'frontend' }) : allTags
774804 serverFarmResourceId : app_service_plan .outputs .resourceId
775- linuxFxVersion : 'DOCKER|${frontendContainerRegistryHostname }/${frontendContainerImageName }:${frontendContainerImageTag }'
776- appSettings : {
805+ linuxFxVersion : isCustom ? 'python|3.11' : 'DOCKER|${frontendContainerRegistryHostname }/${frontendContainerImageName }:${frontendContainerImageTag }'
806+ appCommandLine : isCustom ? 'python3 -m uvicorn frontend_server:app --host 0.0.0.0 --port 8000' : ''
807+ appSettings : isCustom ? {
808+ SCM_DO_BUILD_DURING_DEPLOYMENT : 'True'
809+ WEBSITES_PORT : '8000'
810+ BACKEND_API_URL : 'https://${backend_container_app .outputs .fqdn }'
811+ AUTH_ENABLED : 'false'
812+ PROXY_API_REQUESTS : 'false'
813+ ENABLE_ORYX_BUILD : 'True'
814+ APPLICATIONINSIGHTS_CONNECTION_STRING : app_insights .outputs .connectionString
815+ APPINSIGHTS_INSTRUMENTATIONKEY : app_insights .outputs .instrumentationKey
816+ }
817+ : {
777818 SCM_DO_BUILD_DURING_DEPLOYMENT : 'true'
778819 DOCKER_REGISTRY_SERVER_URL : 'https://${frontendContainerRegistryHostname }'
779820 WEBSITES_PORT : '3000'
@@ -802,6 +843,7 @@ module role_assignments './modules/identity/role-assignments.bicep' = {
802843 deployerPrincipalType : deployerPrincipalType
803844 userAssignedManagedIdentityPrincipalId : userAssignedIdentity .outputs .principalId
804845 cosmosDbAccountName : cosmosDBModule .outputs .name
846+ containerRegistryResourceId : isCustom ? container_registry !.outputs .resourceId : ''
805847 }
806848}
807849
@@ -860,3 +902,7 @@ output AZURE_AI_SEARCH_INDEX_NAME_RFP_COMPLIANCE string = aiSearchIndexNameForRF
860902output AZURE_AI_SEARCH_INDEX_NAME_CONTRACT_SUMMARY string = aiSearchIndexNameForContractSummary
861903output AZURE_AI_SEARCH_INDEX_NAME_CONTRACT_RISK string = aiSearchIndexNameForContractRisk
862904output AZURE_AI_SEARCH_INDEX_NAME_CONTRACT_COMPLIANCE string = aiSearchIndexNameForContractCompliance
905+
906+ // Container Registry Outputs
907+ output AZURE_CONTAINER_REGISTRY_ENDPOINT string ? = isCustom ? container_registry !.outputs .loginServer : null
908+ output AZURE_CONTAINER_REGISTRY_NAME string ? = isCustom ? container_registry !.outputs .name : null
0 commit comments