@@ -87,9 +87,6 @@ param gptImageModelVersion string = '2025-12-16'
8787@description ('Optional. Version of the Azure OpenAI service to deploy. Defaults to 2024-12-01-preview.' )
8888param azureopenaiVersion string = '2024-12-01-preview'
8989
90- @description ('Optional. Version of the Azure AI Agent API version. Defaults to 2025-01-01-preview.' )
91- param azureAiAgentAPIVersion string = '2025-01-01-preview'
92-
9390@minLength (1 )
9491@allowed ([
9592 'Standard'
@@ -1348,10 +1345,6 @@ module containerApp 'br/public:avm/res/app/container-app:0.18.1' = {
13481345 name : 'AZURE_OPENAI_ENDPOINT'
13491346 value : 'https://${aiFoundryAiServicesResourceName }.openai.azure.com/'
13501347 }
1351- {
1352- name : 'AZURE_OPENAI_MODEL_NAME'
1353- value : aiFoundryAiServicesModelDeployment .name
1354- }
13551348 {
13561349 name : 'AZURE_OPENAI_DEPLOYMENT_NAME'
13571350 value : aiFoundryAiServicesModelDeployment .name
@@ -1392,18 +1385,14 @@ module containerApp 'br/public:avm/res/app/container-app:0.18.1' = {
13921385 // name: 'AZURE_AI_AGENT_ENDPOINT'
13931386 // value: aiFoundryAiProjectEndpoint
13941387 // }
1395- {
1396- name : 'AZURE_AI_AGENT_MODEL_DEPLOYMENT_NAME'
1397- value : aiFoundryAiServicesModelDeployment .name
1398- }
13991388 {
14001389 name : 'APP_ENV'
14011390 value : 'Prod'
14021391 }
1403- {
1404- name : 'AZURE_AI_SEARCH_CONNECTION_NAME'
1405- value : aiSearchConnectionName
1406- }
1392+ // NOTE: AZURE_AI_SEARCH_CONNECTION_NAME intentionally omitted.
1393+ // The app defaults to per-KB RemoteTool connection names (e.g.
1394+ // "macae-retail-customer-kb-mcp") which carry ProjectManagedIdentity
1395+ // auth required by the KB MCP endpoint.
14071396 {
14081397 name : 'AZURE_AI_SEARCH_ENDPOINT'
14091398 value : searchService .outputs .endpoint
@@ -1412,18 +1401,6 @@ module containerApp 'br/public:avm/res/app/container-app:0.18.1' = {
14121401 name : 'AZURE_COGNITIVE_SERVICES'
14131402 value : 'https://cognitiveservices.azure.com/.default'
14141403 }
1415- {
1416- name : 'AZURE_BING_CONNECTION_NAME'
1417- value : 'binggrnd'
1418- }
1419- {
1420- name : 'BING_CONNECTION_NAME'
1421- value : 'binggrnd'
1422- }
1423- {
1424- name : 'REASONING_MODEL_NAME'
1425- value : aiFoundryAiServicesReasoningModelDeployment .name
1426- }
14271404 {
14281405 name : 'AZURE_OPENAI_IMAGE_DEPLOYMENT'
14291406 value : aiFoundryAiServicesImageModelDeployment .name
@@ -1465,12 +1442,8 @@ module containerApp 'br/public:avm/res/app/container-app:0.18.1' = {
14651442 value : aiFoundryAiProjectEndpoint
14661443 }
14671444 {
1468- name : 'AZURE_AI_AGENT_API_VERSION'
1469- value : azureAiAgentAPIVersion
1470- }
1471- {
1472- name : 'AZURE_AI_AGENT_PROJECT_CONNECTION_STRING'
1473- value : '${aiFoundryAiServicesResourceName }.services.ai.azure.com;${aiFoundryAiServicesSubscriptionId };${aiFoundryAiServicesResourceGroupName };${aiFoundryAiProjectResourceName }'
1445+ name : 'ORCHESTRATOR_MODEL_NAME'
1446+ value : aiFoundryAiServicesReasoningModelDeployment .name
14741447 }
14751448 {
14761449 name : 'AZURE_BASIC_LOGGING_LEVEL'
@@ -1825,6 +1798,11 @@ module searchService 'br/public:avm/res/search/search-service:0.11.1' = {
18251798 roleDefinitionIdOrName : 'Search Index Data Contributor'
18261799 principalType : 'ServicePrincipal'
18271800 }
1801+ {
1802+ principalId : userAssignedIdentity .outputs .principalId
1803+ roleDefinitionIdOrName : 'Search Service Contributor'
1804+ principalType : 'ServicePrincipal'
1805+ }
18281806 {
18291807 principalId : deployingUserPrincipalId
18301808 roleDefinitionIdOrName : 'Search Index Data Contributor'
@@ -1898,6 +1876,11 @@ module searchServiceIdentity 'br/public:avm/res/search/search-service:0.11.1' =
18981876 roleDefinitionIdOrName : 'Search Index Data Contributor'
18991877 principalType : 'ServicePrincipal'
19001878 }
1879+ {
1880+ principalId : userAssignedIdentity .outputs .principalId
1881+ roleDefinitionIdOrName : 'Search Service Contributor'
1882+ principalType : 'ServicePrincipal'
1883+ }
19011884 {
19021885 principalId : deployingUserPrincipalId
19031886 roleDefinitionIdOrName : 'Search Index Data Contributor'
@@ -1941,6 +1924,23 @@ module searchServiceIdentity 'br/public:avm/res/search/search-service:0.11.1' =
19411924 ]
19421925}
19431926
1927+ // ========== Search Service MI → AI Services Role Assignment ========== //
1928+ // The Search service system MI needs Cognitive Services OpenAI User on the AI Services account
1929+ // so that Knowledge Base MCP tools can call the model for semantic retrieval.
1930+ resource aiServicesForSearchRole 'Microsoft.CognitiveServices/accounts@2025-06-01' existing = {
1931+ name : aiFoundryAiServicesResourceName
1932+ }
1933+
1934+ resource searchServiceOpenAIRole 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
1935+ name : guid (aiServicesForSearchRole .id , searchServiceName , '5e0bd9bd-7b93-4f28-af87-19fc36ad61bd' )
1936+ scope : aiServicesForSearchRole
1937+ properties : {
1938+ roleDefinitionId : subscriptionResourceId ('Microsoft.Authorization/roleDefinitions' , '5e0bd9bd-7b93-4f28-af87-19fc36ad61bd' ) // Cognitive Services OpenAI User
1939+ principalId : searchServiceIdentity .outputs .systemAssignedMIPrincipalId !
1940+ principalType : 'ServicePrincipal'
1941+ }
1942+ }
1943+
19441944// ========== Search Service - AI Project Connection ========== //
19451945
19461946var aiSearchConnectionName = 'aifp-srch-connection-${solutionSuffix }'
@@ -1954,7 +1954,6 @@ module aiSearchFoundryConnection 'modules/aifp-connections.bicep' = {
19541954 searchServiceResourceId : searchService .outputs .resourceId
19551955 searchServiceLocation : searchService .outputs .location
19561956 searchServiceName : searchService .outputs .name
1957- searchApiKey : searchService .outputs .primaryKey
19581957 }
19591958}
19601959
@@ -1977,7 +1976,6 @@ output COSMOSDB_ENDPOINT string = 'https://${cosmosDbResourceName}.documents.azu
19771976output COSMOSDB_DATABASE string = cosmosDbDatabaseName
19781977output COSMOSDB_CONTAINER string = cosmosDbDatabaseMemoryContainerName
19791978output AZURE_OPENAI_ENDPOINT string = 'https://${aiFoundryAiServicesResourceName }.openai.azure.com/'
1980- output AZURE_OPENAI_MODEL_NAME string = aiFoundryAiServicesModelDeployment .name
19811979output AZURE_OPENAI_DEPLOYMENT_NAME string = aiFoundryAiServicesModelDeployment .name
19821980output AZURE_OPENAI_RAI_DEPLOYMENT_NAME string = aiFoundryAiServices4_1ModelDeployment .name
19831981output AZURE_OPENAI_API_VERSION string = azureopenaiVersion
@@ -1987,7 +1985,6 @@ output AZURE_AI_SUBSCRIPTION_ID string = subscription().subscriptionId
19871985output AZURE_AI_RESOURCE_GROUP string = resourceGroup ().name
19881986output AZURE_AI_PROJECT_NAME string = aiFoundryAiProjectName
19891987// output APPLICATIONINSIGHTS_CONNECTION_STRING string = applicationInsights.outputs.connectionString
1990- output AZURE_AI_AGENT_MODEL_DEPLOYMENT_NAME string = aiFoundryAiServicesModelDeployment .name
19911988// output AZURE_AI_AGENT_ENDPOINT string = aiFoundryAiProjectEndpoint
19921989output APP_ENV string = 'Prod'
19931990output AI_FOUNDRY_RESOURCE_ID string = !useExistingAiFoundryAiProject
@@ -1998,17 +1995,15 @@ output AZURE_SEARCH_ENDPOINT string = searchService.outputs.endpoint
19981995#disable-next-line BCP318
19991996output AZURE_CLIENT_ID string = userAssignedIdentity !.outputs .clientId
20001997output AZURE_TENANT_ID string = tenant ().tenantId
2001- output AZURE_AI_SEARCH_CONNECTION_NAME string = aiSearchConnectionName
20021998output AZURE_COGNITIVE_SERVICES string = 'https://cognitiveservices.azure.com/.default'
2003- output REASONING_MODEL_NAME string = aiFoundryAiServicesReasoningModelDeployment .name
1999+ output ORCHESTRATOR_MODEL_NAME string = aiFoundryAiServicesReasoningModelDeployment .name
20042000output MCP_SERVER_NAME string = 'MacaeMcpServer'
20052001output MCP_SERVER_DESCRIPTION string = 'MCP server with greeting, HR, and planning tools'
20062002output SUPPORTED_MODELS string = supportedModelsList
20072003output BACKEND_URL string = 'https://${containerAppResourceName }.${containerAppEnvironment .outputs .defaultDomain }'
20082004output AZURE_AI_PROJECT_ENDPOINT string = aiFoundryAiProjectEndpoint
20092005output AZURE_AI_AGENT_ENDPOINT string = aiFoundryAiProjectEndpoint
2010- output AZURE_AI_AGENT_API_VERSION string = azureAiAgentAPIVersion
2011- output AZURE_AI_AGENT_PROJECT_CONNECTION_STRING string = '${aiFoundryAiServicesResourceName }.services.ai.azure.com;${aiFoundryAiServicesSubscriptionId };${aiFoundryAiServicesResourceGroupName };${aiFoundryAiProjectResourceName }'
2006+
20122007
20132008
20142009output AZURE_STORAGE_CONTAINER_NAME_RETAIL_CUSTOMER string = storageContainerNameRetailCustomer
0 commit comments