@@ -225,6 +225,7 @@ var allTags = union(
225225 },
226226 tags
227227)
228+ var existingTags = resourceGroup ().tags ?? {}
228229@description ('Tag, Created by user name' )
229230param createdBy string = contains (deployer (), 'userPrincipalName' )
230231 ? split (deployer ().userPrincipalName , '@' )[0 ]
@@ -234,15 +235,17 @@ var deployerPrincipalType = contains(deployer(), 'userPrincipalName') ? 'User' :
234235resource resourceGroupTags 'Microsoft.Resources/tags@2021-04-01' = {
235236 name : 'default'
236237 properties : {
237- tags : {
238- ...resourceGroup ().tags
239- ...allTags
240- TemplateName : 'MACAE'
241- Type : enablePrivateNetworking ? 'WAF' : 'Non-WAF'
242- CreatedBy : createdBy
243- DeploymentName : deployment ().name
244- SolutionSuffix : solutionSuffix
245- }
238+ tags : union (
239+ existingTags ,
240+ allTags ,
241+ {
242+ TemplateName : 'MACAE'
243+ Type : enablePrivateNetworking ? 'WAF' : 'Non-WAF'
244+ CreatedBy : createdBy
245+ DeploymentName : deployment ().name
246+ SolutionSuffix : solutionSuffix
247+ }
248+ )
246249 }
247250}
248251
@@ -1285,7 +1288,7 @@ module containerApp 'br/public:avm/res/app/container-app:0.18.1' = {
12851288 }
12861289 {
12871290 name : 'AZURE_AI_SEARCH_ENDPOINT'
1288- value : searchService .outputs .endpoint
1291+ value : searchServiceUpdate .outputs .endpoint
12891292 }
12901293 {
12911294 name : 'AZURE_COGNITIVE_SERVICES'
@@ -1327,10 +1330,6 @@ module containerApp 'br/public:avm/res/app/container-app:0.18.1' = {
13271330 name : 'SUPPORTED_MODELS'
13281331 value : '["o3","o4-mini","gpt-4.1","gpt-4.1-mini"]'
13291332 }
1330- {
1331- name : 'AZURE_AI_SEARCH_API_KEY'
1332- secretRef : 'azure-ai-search-api-key'
1333- }
13341333 {
13351334 name : 'AZURE_STORAGE_BLOB_URL'
13361335 value : avmStorageAccount .outputs .serviceEndpoints .blob
@@ -1366,13 +1365,7 @@ module containerApp 'br/public:avm/res/app/container-app:0.18.1' = {
13661365 ]
13671366 }
13681367 ]
1369- secrets : [
1370- {
1371- name : 'azure-ai-search-api-key'
1372- keyVaultUrl : keyvault .outputs .secrets [0 ].uriWithVersion
1373- identity : userAssignedIdentity .outputs .resourceId
1374- }
1375- ]
1368+ secrets : []
13761369 }
13771370}
13781371
@@ -1659,16 +1652,20 @@ var aiSearchIndexNameForRFPSummary = 'macae-rfp-summary-index'
16591652var aiSearchIndexNameForRFPRisk = 'macae-rfp-risk-index'
16601653var aiSearchIndexNameForRFPCompliance = 'macae-rfp-compliance-index'
16611654
1662- module searchService 'br/public:avm/res/search/search-service:0.11.1' = {
1663- name : take ('avm.res.search.search-service.${solutionSuffix }' , 64 )
1655+ resource searchService 'Microsoft.Search/searchServices@2024-06-01-preview' = {
1656+ name : searchServiceName
1657+ location : location
1658+ sku : {
1659+ name : enableScalability ? 'standard' : 'basic'
1660+ }
1661+ }
1662+
1663+ // Separate module for Search Service to enable managed identity and update other properties, as this reduces deployment time
1664+ module searchServiceUpdate 'br/public:avm/res/search/search-service:0.11.1' = {
1665+ name : take ('avm.res.search.update.${solutionSuffix }' , 64 )
16641666 params : {
16651667 name : searchServiceName
1666- authOptions : {
1667- aadOrApiKey : {
1668- aadAuthFailureMode : 'http401WithBearerChallenge'
1669- }
1670- }
1671- disableLocalAuth : false
1668+ disableLocalAuth : true
16721669 hostingMode : 'default'
16731670 managedIdentities : {
16741671 systemAssigned : true
@@ -1729,6 +1726,9 @@ module searchService 'br/public:avm/res/search/search-service:0.11.1' = {
17291726 // ]
17301727 // : []
17311728 }
1729+ dependsOn : [
1730+ searchService
1731+ ]
17321732}
17331733
17341734// ========== Search Service - AI Project Connection ========== //
@@ -1741,10 +1741,9 @@ module aiSearchFoundryConnection 'modules/aifp-connections.bicep' = {
17411741 aiFoundryProjectName : aiFoundryAiProjectName
17421742 aiFoundryName : aiFoundryAiServicesResourceName
17431743 aifSearchConnectionName : aiSearchConnectionName
1744- searchServiceResourceId : searchService .outputs .resourceId
1745- searchServiceLocation : searchService .outputs .location
1746- searchServiceName : searchService .outputs .name
1747- searchApiKey : searchService .outputs .primaryKey
1744+ searchServiceResourceId : searchService .id
1745+ searchServiceLocation : searchService .location
1746+ searchServiceName : searchService .name
17481747 }
17491748 dependsOn : [
17501749 aiFoundryAiServices
@@ -1795,12 +1794,7 @@ module keyvault 'br/public:avm/res/key-vault/vault:0.12.1' = {
17951794 roleDefinitionIdOrName : 'Key Vault Administrator'
17961795 }
17971796 ]
1798- secrets : [
1799- {
1800- name : 'AzureAISearchAPIKey'
1801- value : searchService .outputs .primaryKey
1802- }
1803- ]
1797+ secrets : []
18041798 enableTelemetry : enableTelemetry
18051799 }
18061800}
@@ -1817,8 +1811,8 @@ output webSiteDefaultHostname string = webSite.outputs.defaultHostname
18171811
18181812output AZURE_STORAGE_BLOB_URL string = avmStorageAccount .outputs .serviceEndpoints .blob
18191813output AZURE_STORAGE_ACCOUNT_NAME string = storageAccountName
1820- output AZURE_AI_SEARCH_ENDPOINT string = searchService .outputs .endpoint
1821- output AZURE_AI_SEARCH_NAME string = searchService .outputs . name
1814+ output AZURE_AI_SEARCH_ENDPOINT string = searchServiceUpdate .outputs .endpoint
1815+ output AZURE_AI_SEARCH_NAME string = searchService .name
18221816
18231817output COSMOSDB_ENDPOINT string = 'https://${cosmosDbResourceName }.documents.azure.com:443/'
18241818output COSMOSDB_DATABASE string = cosmosDbDatabaseName
@@ -1841,7 +1835,7 @@ output AI_FOUNDRY_RESOURCE_ID string = !useExistingAiFoundryAiProject
18411835 ? aiFoundryAiServices .outputs .resourceId
18421836 : existingAiFoundryAiProjectResourceId
18431837output COSMOSDB_ACCOUNT_NAME string = cosmosDbResourceName
1844- output AZURE_SEARCH_ENDPOINT string = searchService .outputs .endpoint
1838+ output AZURE_SEARCH_ENDPOINT string = searchServiceUpdate .outputs .endpoint
18451839output AZURE_CLIENT_ID string = userAssignedIdentity !.outputs .clientId
18461840output AZURE_TENANT_ID string = tenant ().tenantId
18471841output AZURE_AI_SEARCH_CONNECTION_NAME string = aiSearchConnectionName
@@ -1850,7 +1844,6 @@ output REASONING_MODEL_NAME string = aiFoundryAiServicesReasoningModelDeployment
18501844output MCP_SERVER_NAME string = 'MacaeMcpServer'
18511845output MCP_SERVER_DESCRIPTION string = 'MCP server with greeting, HR, and planning tools'
18521846output SUPPORTED_MODELS string = '["o3","o4-mini","gpt-4.1","gpt-4.1-mini"]'
1853- output AZURE_AI_SEARCH_API_KEY string = '<Deployed-Search-ApiKey>'
18541847output BACKEND_URL string = 'https://${containerApp .outputs .fqdn }'
18551848output AZURE_AI_PROJECT_ENDPOINT string = aiFoundryAiProjectEndpoint
18561849output AZURE_AI_AGENT_ENDPOINT string = aiFoundryAiProjectEndpoint
0 commit comments