From 33924664ec6932074e94030b2c6f9b64df45e0f3 Mon Sep 17 00:00:00 2001 From: Manvir Kaur <67894494+manvkaur@users.noreply.github.com> Date: Sun, 15 Nov 2026 17:12:14 -0800 Subject: [PATCH 1/5] Fix AI travel planner template for Foundry project endpoint - Replace hub-based project with Foundry (AIServices) account, project, and gpt-5-mini deployment - Pass the Foundry project endpoint to *_CONNECTION settings (Azure.AI.Projects 2.x) - Add AI_PUBLIC_NETWORK_ACCESS parameter - Fix dts-Access.bicep reference casing (Fixes #447) - Fix app subnet delegation for the B1 plan when skipVnet=false - Update README Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../AiAgentTravelPlanOrchestrator/README.md | 48 ++-- .../infra/agent/ai-foundry-access.bicep | 28 +++ .../infra/agent/ai-foundry.bicep | 104 +++++++++ .../agent/ai-search-role-assignments.bicep | 39 ---- .../agent/ai-service-role-assignments.bicep | 58 ----- .../infra/agent/standard-ai-hub.bicep | 111 ---------- .../infra/agent/standard-ai-project.bicep | 78 ------- .../agent/standard-dependent-resources.bicep | 192 ---------------- .../infra/app/vnet.bicep | 4 +- .../infra/main.bicep | 206 +++++------------- .../infra/main.parameters.json | 3 + 11 files changed, 224 insertions(+), 647 deletions(-) create mode 100644 samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/agent/ai-foundry-access.bicep create mode 100644 samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/agent/ai-foundry.bicep delete mode 100644 samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/agent/ai-search-role-assignments.bicep delete mode 100644 samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/agent/ai-service-role-assignments.bicep delete mode 100644 samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/agent/standard-ai-hub.bicep delete mode 100644 samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/agent/standard-ai-project.bicep delete mode 100644 samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/agent/standard-dependent-resources.bicep diff --git a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/README.md b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/README.md index 052abfc3..37f72062 100644 --- a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/README.md +++ b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/README.md @@ -85,7 +85,7 @@ Upon successful booking, the user receives a final confirmation with all travel - Azure Functions resource - Azure Storage Account - Azure Durable Task resource - - Azure AI Projects with configured agents + - Microsoft Foundry project with configured agents ## Setting Up Locally @@ -110,9 +110,9 @@ Create a `local.settings.json` file in the root directory with the following con "TASKHUB_NAME": "default", "AZURE_TENANT_ID": "", "AZURE_CLIENT_ID": "", - "DESTINATION_RECOMMENDER_CONNECTION": "", - "ITINERARY_PLANNER_CONNECTION": "", - "LOCAL_RECOMMENDATIONS_CONNECTION": "", + "DESTINATION_RECOMMENDER_CONNECTION": "", + "ITINERARY_PLANNER_CONNECTION": "", + "LOCAL_RECOMMENDATIONS_CONNECTION": "", "DESTINATION_RECOMMENDER_AGENT_ID": "", "ITINERARY_PLANNER_AGENT_ID": "", "LOCAL_RECOMMENDATIONS_AGENT_ID": "" @@ -125,7 +125,7 @@ Create a `local.settings.json` file in the root directory with the following con } ``` -Replace the placeholder values with your actual connection strings and agent IDs. +Replace the placeholder values with your Microsoft Foundry project endpoint and agent IDs. The `*_CONNECTION` settings must be the project endpoint URL, for example `https://.services.ai.azure.com/api/projects/`. Hub-based project connection strings (`.api.azureml.ms;...`) aren't supported by the `Azure.AI.Projects` 2.x SDK used by this sample. ### 3. Set Up Azure Storage Emulator @@ -216,14 +216,22 @@ azd up This command will: -- Create all required Azure resources as defined in your infrastructure files +- Create all required Azure resources as defined in your infrastructure files, including a Microsoft Foundry resource, a Foundry project, and a `gpt-5-mini` model deployment - Build the backend Azure Functions - Build and deploy the frontend Vite React application -- Configure all connections between components +- Configure the function app with the Foundry project endpoint and grant its managed identity the **Foundry User** role (formerly **Azure AI User**) on the Foundry resource +> [!NOTE] +> Choose `eastus2` or `swedencentral` as the location. Both regions support Durable Task Scheduler and the `gpt-5-mini` `GlobalStandard` deployment. To use a different model, set the `modelName`, `modelVersion`, `modelSkuName`, and `modelCapacity` parameters in `infra/main.bicep`. + +> [!IMPORTANT] +> By default, the Foundry resource allows public network access so that the function app can reach it. The template doesn't create a private endpoint for Foundry. To block public access, run `azd env set AI_PUBLIC_NETWORK_ACCESS Disabled` before `azd up`, and provide your own private endpoint and virtual network integration so the function app can still reach the Foundry project. +> ### 4. Configure AI Agents -After deployment, you'll need to set up the three AI agents in Azure AI Projects: +After deployment, create the three agents in the Foundry project. You can create them in the [Foundry portal](https://ai.azure.com) or by calling the Agent Service REST API with the deployed model. The deploying user is granted the **Foundry User** role on the Foundry resource, which is required to create agents. Role assignments can take a few minutes to take effect. + +Use the following instructions for each agent: #### Destination Recommender Agent @@ -256,17 +264,31 @@ Focus on both popular and hidden gem attractions, dining options across differen price ranges, and practical local tips that tourists wouldn't typically know. ``` +For example, the following PowerShell script creates the destination recommender agent and returns its ID. Repeat it for the other two agents with their names and instructions. + +```PowerShell +$projectEndpoint = azd env get-value PROJECT_ENDPOINT +$model = azd env get-value AI_MODEL_DEPLOYMENT_NAME +$token = az account get-access-token --resource https://ai.azure.com --query accessToken -o tsv +$body = @{ + name = "destination-recommender" + model = $model + instructions = "You are a destination recommendation expert that helps travelers find ideal vacation spots based on their preferences, budget, and travel dates." +} | ConvertTo-Json + +$agent = Invoke-RestMethod -Method Post -Uri "$projectEndpoint/assistants?api-version=2025-05-01" ` + -Headers @{ Authorization = "Bearer $token" } -ContentType "application/json" -Body $body +$agent.id +``` + ### 5. Update Configuration -Update your application settings with the proper agent connection strings and IDs: +Set the agent IDs (they start with `asst_`) and reprovision to update the function app settings. The `*_CONNECTION` settings are already set to the Foundry project endpoint by the template. ```bash azd env set DESTINATION_RECOMMENDER_AGENT_ID "your-agent-id" azd env set ITINERARY_PLANNER_AGENT_ID "your-agent-id" azd env set LOCAL_RECOMMENDATIONS_AGENT_ID "your-agent-id" -azd env set DESTINATION_RECOMMENDER_CONNECTION "your-connection-string" -azd env set ITINERARY_PLANNER_CONNECTION "your-connection-string" -azd env set LOCAL_RECOMMENDATIONS_CONNECTION "your-connection-string" # Apply these changes to your Azure resources azd provision @@ -310,7 +332,7 @@ azd down --purge - [Azure Durable Task Scheduler](https://learn.microsoft.com/en-us/azure/azure-functions/durable/durable-task-scheduler/quickstart-durable-task-scheduler?pivots=csharp) - [Azure Durable Functions Documentation](https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-overview) -- [Azure AI Projects Documentation](https://learn.microsoft.com/en-us/azure/ai-studio/how-to/projects-sdk-overview) +- [Microsoft Foundry Agent Service Documentation](https://learn.microsoft.com/azure/ai-foundry/agents/overview) - [Azure Functions Isolated Process Model](https://docs.microsoft.com/en-us/azure/azure-functions/dotnet-isolated-process-guide) - [Azure Developer CLI Documentation](https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/) - [Azurite Emulator](https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite?tabs=visual-studio%2Cblob-storage) diff --git a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/agent/ai-foundry-access.bicep b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/agent/ai-foundry-access.bicep new file mode 100644 index 00000000..f36bde66 --- /dev/null +++ b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/agent/ai-foundry-access.bicep @@ -0,0 +1,28 @@ +// Assigns a role on the Foundry resource (AIServices account) to a principal. + +@description('Name of the Foundry resource (AIServices account)') +param aiFoundryName string + +@description('Role definition ID to assign') +param roleDefinitionID string + +@description('Principal ID to assign the role to') +param principalID string + +@description('Type of the principal') +@allowed(['User', 'ServicePrincipal', 'Group']) +param principalType string = 'ServicePrincipal' + +resource aiFoundry 'Microsoft.CognitiveServices/accounts@2025-06-01' existing = { + name: aiFoundryName +} + +resource roleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = { + name: guid(aiFoundry.id, principalID, roleDefinitionID) + scope: aiFoundry + properties: { + roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', roleDefinitionID) + principalId: principalID + principalType: principalType + } +} diff --git a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/agent/ai-foundry.bicep b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/agent/ai-foundry.bicep new file mode 100644 index 00000000..1e838300 --- /dev/null +++ b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/agent/ai-foundry.bicep @@ -0,0 +1,104 @@ +// Creates a Microsoft Foundry resource (AIServices account), a Foundry project, and a model deployment. +// The project endpoint output is the value expected by Azure.AI.Projects 2.x (AIProjectClient). + +@description('Azure region of the Foundry resource and model deployment') +param location string + +@description('Tags to add to the resources') +param tags object = {} + +@description('Name of the Foundry resource (AIServices account). Also used as the custom subdomain.') +param aiFoundryName string + +@description('Name of the Foundry project') +param aiProjectName string + +@description('Display name of the Foundry project') +param aiProjectFriendlyName string = aiProjectName + +@description('Description of the Foundry project') +param aiProjectDescription string = '' + +@description('Model name for deployment') +param modelName string + +@description('Model format for deployment') +param modelFormat string + +@description('Model version for deployment') +param modelVersion string + +@description('Model deployment SKU name') +param modelSkuName string + +@description('Model deployment capacity') +param modelCapacity int + +@description('Whether the Foundry resource accepts traffic from public networks') +@allowed(['Enabled', 'Disabled']) +param publicNetworkAccess string = 'Enabled' + +resource aiFoundry 'Microsoft.CognitiveServices/accounts@2025-06-01' = { + name: aiFoundryName + location: location + tags: tags + kind: 'AIServices' + sku: { + name: 'S0' + } + identity: { + type: 'SystemAssigned' + } + properties: { + allowProjectManagement: true + customSubDomainName: toLower(aiFoundryName) + // The app authenticates with Microsoft Entra ID (managed identity), so keys are not needed. + disableLocalAuth: true + publicNetworkAccess: publicNetworkAccess + networkAcls: { + defaultAction: publicNetworkAccess == 'Enabled' ? 'Allow' : 'Deny' + } + } +} + +resource aiProject 'Microsoft.CognitiveServices/accounts/projects@2025-06-01' = { + parent: aiFoundry + name: aiProjectName + location: location + tags: tags + identity: { + type: 'SystemAssigned' + } + properties: { + displayName: aiProjectFriendlyName + description: aiProjectDescription + } +} + +resource modelDeployment 'Microsoft.CognitiveServices/accounts/deployments@2025-06-01' = { + parent: aiFoundry + name: modelName + sku: { + name: modelSkuName + capacity: modelCapacity + } + properties: { + model: { + name: modelName + format: modelFormat + version: modelVersion + } + } + dependsOn: [ + aiProject + ] +} + +output aiFoundryName string = aiFoundry.name +output aiFoundryId string = aiFoundry.id +output aiProjectName string = aiProject.name +output aiProjectResourceId string = aiProject.id +output aiProjectPrincipalId string = aiProject.identity.principalId +output modelDeploymentName string = modelDeployment.name +// Format: https://.services.ai.azure.com/api/projects/ +output projectEndpoint string = aiProject.properties.endpoints['AI Foundry API'] diff --git a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/agent/ai-search-role-assignments.bicep b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/agent/ai-search-role-assignments.bicep deleted file mode 100644 index 4efab91a..00000000 --- a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/agent/ai-search-role-assignments.bicep +++ /dev/null @@ -1,39 +0,0 @@ -param aiSearchName string -param aiProjectPrincipalId string -param aiProjectId string - -resource searchService 'Microsoft.Search/searchServices@2024-06-01-preview' existing = { - name: aiSearchName - scope: resourceGroup() -} - -// search roles -resource searchIndexDataContributorRole 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = { - name: '8ebe5a00-799e-43f5-93ac-243d3dce84a7' - scope: resourceGroup() -} - -resource searchIndexDataContributorAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = { - scope: searchService - name: guid(aiProjectId, searchIndexDataContributorRole.id, searchService.id) - properties: { - principalId: aiProjectPrincipalId - roleDefinitionId: searchIndexDataContributorRole.id - principalType: 'ServicePrincipal' - } -} - -resource searchServiceContributorRole 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = { - name: '7ca78c08-252a-4471-8644-bb5ff32d4ba0' - scope: resourceGroup() -} - -resource searchServiceContributorRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = { - scope: searchService - name: guid(aiProjectId, searchServiceContributorRole.id, searchService.id) - properties: { - principalId: aiProjectPrincipalId - roleDefinitionId: searchServiceContributorRole.id - principalType: 'ServicePrincipal' - } -} diff --git a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/agent/ai-service-role-assignments.bicep b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/agent/ai-service-role-assignments.bicep deleted file mode 100644 index 8cbbdf83..00000000 --- a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/agent/ai-service-role-assignments.bicep +++ /dev/null @@ -1,58 +0,0 @@ -// Assigns the necessary roles to the AI project - -param aiServicesName string -param aiProjectPrincipalId string -param aiProjectId string - -resource aiServices 'Microsoft.CognitiveServices/accounts@2024-06-01-preview' existing = { - name: aiServicesName - scope: resourceGroup() -} - -resource cognitiveServicesContributorRole 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = { - name: '25fbc0a9-bd7c-42a3-aa1a-3b75d497ee68' - scope: resourceGroup() - -} - -resource cognitiveServicesContributorAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01'= { - scope: aiServices - name: guid(aiServices.id, cognitiveServicesContributorRole.id, aiProjectId) - properties: { - principalId: aiProjectPrincipalId - roleDefinitionId: cognitiveServicesContributorRole.id - principalType: 'ServicePrincipal' - } -} - -var cognitiveServicesOpenAIUserRoleId = '5e0bd9bd-7b93-4f28-af87-19fc36ad61bd' -resource cognitiveServicesOpenAIUserRole 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = { - name: cognitiveServicesOpenAIUserRoleId - scope: resourceGroup() -} - -resource cognitiveServicesOpenAIUserRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = { - scope: aiServices - name: guid(aiProjectId, cognitiveServicesOpenAIUserRole.id, aiServices.id) - properties: { - principalId: aiProjectPrincipalId - roleDefinitionId: cognitiveServicesOpenAIUserRole.id - principalType: 'ServicePrincipal' - } -} - -var cognitiveServiceServicesUserRoleId = 'a97b65f3-24c7-4388-baec-2e87135dc908' -resource cognitiveServicesUserRole 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = { - name: cognitiveServiceServicesUserRoleId - scope: resourceGroup() -} - -resource cognitiveServicesUserRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = { - scope: aiServices - name: guid(aiProjectId, cognitiveServicesUserRole.id, aiServices.id) - properties: { - principalId: aiProjectPrincipalId - roleDefinitionId: cognitiveServicesUserRole.id - principalType: 'ServicePrincipal' - } -} diff --git a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/agent/standard-ai-hub.bicep b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/agent/standard-ai-hub.bicep deleted file mode 100644 index 3c83e13e..00000000 --- a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/agent/standard-ai-hub.bicep +++ /dev/null @@ -1,111 +0,0 @@ -@description('Azure region of the deployment') -param location string - -@description('Tags to add to the resources') -param tags object - -@description('AI hub name') -param aiHubName string - -@description('AI hub display name') -param aiHubFriendlyName string = aiHubName - -@description('AI hub description') -param aiHubDescription string - -@description('Resource ID of the key vault resource for storing connection strings') -param keyVaultId string - -@description('Resource ID of the storage account resource for storing experimentation outputs') -param storageAccountId string - -@description('Resource ID of the AI Services resource') -param aiServicesId string -@description('Resource ID of the AI Services endpoint') -param aiServicesTarget string -@description('Name AI Services resource') -param aiServicesName string - - -@description('Name AI Search resource') -param aiSearchName string -@description('Resource ID of the AI Search resource') -param aiSearchId string -@description('Name for capabilityHost.') -param capabilityHostName string = 'caphost1' - -var acsConnectionName = '${aiHubName}-connection-AISearch' - -var aoaiConnection = '${aiHubName}-connection-AIServices_aoai' - -resource aiServices 'Microsoft.CognitiveServices/accounts@2023-05-01' existing = { - name: aiServicesName - scope: resourceGroup() -} - -resource searchService 'Microsoft.Search/searchServices@2023-11-01' existing = { - name: aiSearchName - scope: resourceGroup() -} - -resource aiHub 'Microsoft.MachineLearningServices/workspaces@2024-07-01-preview' = { - name: aiHubName - location: location - tags: tags - identity: { - type: 'SystemAssigned' - } - properties: { - // organization - friendlyName: aiHubFriendlyName - description: aiHubDescription - - // dependent resources - keyVault: keyVaultId - storageAccount: storageAccountId - } - kind: 'hub' - - resource aiServicesConnection 'connections@2024-07-01-preview' = { - name: '${aiHubName}-connection-AIServices' - properties: { - category: 'AIServices' - target: aiServicesTarget - authType: 'AAD' - isSharedToAll: true - metadata: { - ApiType: 'Azure' - ResourceId: aiServicesId - location: aiServices.location - } - } - } - resource hub_connection_azureai_search 'connections@2024-07-01-preview' = { - name: acsConnectionName - properties: { - category: 'CognitiveSearch' - target: 'https://${aiSearchName}.search.windows.net' - authType: 'AAD' - //useWorkspaceManagedIdentity: false - isSharedToAll: true - metadata: { - ApiType: 'Azure' - ResourceId: aiSearchId - location: searchService.location - } - } - } - - // Resource definition for the capability host - resource capabilityHost 'capabilityHosts@2025-11-01' = { - name: '${aiHubName}-${capabilityHostName}' - properties: { - capabilityHostKind: 'Agents' - } - } - -} - -output aiHubID string = aiHub.id -output aoaiConnectionName string = aoaiConnection -output acsConnectionName string = acsConnectionName diff --git a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/agent/standard-ai-project.bicep b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/agent/standard-ai-project.bicep deleted file mode 100644 index a81b95d9..00000000 --- a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/agent/standard-ai-project.bicep +++ /dev/null @@ -1,78 +0,0 @@ -// Creates an Azure AI resource with proxied endpoints for the Azure AI services provider - -@description('Azure region of the deployment') -param location string - -@description('Tags to add to the resources') -param tags object - -@description('AI Project name') -param aiProjectName string - -@description('AI Project display name') -param aiProjectFriendlyName string = aiProjectName - -@description('AI Project description') -param aiProjectDescription string - -@description('Resource ID of the AI Hub resource') -param aiHubId string - -@description('Name for capabilityHost.') -param capabilityHostName string = 'caphost1' - -@description('Name for ACS connection.') -param acsConnectionName string - -@description('Name for ACS connection.') -param aoaiConnectionName string - -//for constructing endpoint -var subscriptionId = subscription().subscriptionId -var resourceGroupName = resourceGroup().name - -var projectConnectionString = '${location}.api.azureml.ms;${subscriptionId};${resourceGroupName};${aiProjectName}' - - -var storageConnections = ['${aiProjectName}/workspaceblobstore'] -var aiSearchConnection = ['${acsConnectionName}'] -var aiServiceConnections = ['${aoaiConnectionName}'] - - -resource aiProject 'Microsoft.MachineLearningServices/workspaces@2023-08-01-preview' = { - name: aiProjectName - location: location - tags: union(tags, { - ProjectConnectionString: projectConnectionString - }) - identity: { - type: 'SystemAssigned' - } - properties: { - // organization - friendlyName: aiProjectFriendlyName - description: aiProjectDescription - - // dependent resources - hubResourceId: aiHubId - - } - kind: 'project' - - // Resource definition for the capability host - resource capabilityHost 'capabilityHosts@2025-11-01' = { - name: '${aiProjectName}-${capabilityHostName}' - properties: { - capabilityHostKind: 'Agents' - aiServicesConnections: aiServiceConnections - vectorStoreConnections: aiSearchConnection - storageConnections: storageConnections - } - } -} - -output aiProjectName string = aiProject.name -output aiProjectResourceId string = aiProject.id -output aiProjectPrincipalId string = aiProject.identity.principalId -output aiProjectWorkspaceId string = aiProject.properties.workspaceId -output projectConnectionString string = aiProject.tags.ProjectConnectionString diff --git a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/agent/standard-dependent-resources.bicep b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/agent/standard-dependent-resources.bicep deleted file mode 100644 index d89f7a03..00000000 --- a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/agent/standard-dependent-resources.bicep +++ /dev/null @@ -1,192 +0,0 @@ -// Creates Azure dependent resources for Azure AI studio - -@description('Azure region of the deployment') -param location string = resourceGroup().location - -@description('Tags to add to the resources') -param tags object = {} - -@description('AI services name') -param aiServicesName string - -@description('The name of the Key Vault') -param keyvaultName string - -@description('The name of the AI Search resource') -param aiSearchName string - -@description('Name of the storage account') -param storageName string - -@description('Model name for deployment') -param modelName string - -@description('Model format for deployment') -param modelFormat string - -@description('Model version for deployment') -param modelVersion string - -@description('Model deployment SKU name') -param modelSkuName string - -@description('Model deployment capacity') -param modelCapacity int - -@description('Model/AI Resource deployment location') -param modelLocation string - -@description('The AI Service Account full ARM Resource ID. This is an optional field, and if not provided, the resource will be created.') -param aiServiceAccountResourceId string - -@description('The AI Search Service full ARM Resource ID. This is an optional field, and if not provided, the resource will be created.') -param aiSearchServiceResourceId string - -@description('The AI Storage Account full ARM Resource ID. This is an optional field, and if not provided, the resource will be created.') -param aiStorageAccountResourceId string - -var aiServiceExists = aiServiceAccountResourceId != '' -var acsExists = aiSearchServiceResourceId != '' -var aiStorageExists = aiStorageAccountResourceId != '' - -resource keyVault 'Microsoft.KeyVault/vaults@2024-12-01-preview' = { - name: keyvaultName - location: location - tags: tags - properties: { - createMode: 'default' - enabledForDeployment: false - enabledForDiskEncryption: false - enabledForTemplateDeployment: false - enableSoftDelete: true - enableRbacAuthorization: true - networkAcls: { - bypass: 'AzureServices' - defaultAction: 'Deny' - } - sku: { - family: 'A' - name: 'standard' - } - softDeleteRetentionInDays: 7 - tenantId: subscription().tenantId - } -} - - -var aiServiceParts = split(aiServiceAccountResourceId, '/') - -resource existingAIServiceAccount 'Microsoft.CognitiveServices/accounts@2023-05-01' existing = if (aiServiceExists) { - name: aiServiceParts[8] - scope: resourceGroup(aiServiceParts[2], aiServiceParts[4]) -} - -resource aiServices 'Microsoft.CognitiveServices/accounts@2024-06-01-preview' = if(!aiServiceExists) { - name: aiServicesName - location: modelLocation - sku: { - name: 'S0' - } - kind: 'AIServices' // or 'OpenAI' - identity: { - type: 'SystemAssigned' - } - properties: { - customSubDomainName: toLower('${(aiServicesName)}') - publicNetworkAccess: 'Enabled' - } -} -resource modelDeployment 'Microsoft.CognitiveServices/accounts/deployments@2024-06-01-preview'= if(!aiServiceExists){ - parent: aiServices - name: modelName - sku : { - capacity: modelCapacity - name: modelSkuName - } - properties: { - model:{ - name: modelName - format: modelFormat - version: modelVersion - } - } -} - -var acsParts = split(aiSearchServiceResourceId, '/') - -resource existingSearchService 'Microsoft.Search/searchServices@2023-11-01' existing = if (acsExists) { - name: acsParts[8] - scope: resourceGroup(acsParts[2], acsParts[4]) -} -resource aiSearch 'Microsoft.Search/searchServices@2024-06-01-preview' = if(!acsExists) { - name: aiSearchName - location: location - tags: tags - identity: { - type: 'SystemAssigned' - } - properties: { - disableLocalAuth: false - authOptions: { aadOrApiKey: { aadAuthFailureMode: 'http401WithBearerChallenge'}} - encryptionWithCmk: { - enforcement: 'Unspecified' - } - hostingMode: 'default' - partitionCount: 1 - publicNetworkAccess: 'enabled' - replicaCount: 1 - semanticSearch: 'disabled' - } - sku: { - name: 'standard' - } -} - -var aiStorageParts = split(aiStorageAccountResourceId, '/') - -resource existingAIStorageAccount 'Microsoft.Storage/storageAccounts@2023-05-01' existing = if (aiStorageExists) { - name: aiStorageParts[8] - scope: resourceGroup(aiStorageParts[2], aiStorageParts[4]) -} - -param sku string = 'Standard_LRS' - -resource storage 'Microsoft.Storage/storageAccounts@2022-05-01' = if(!aiStorageExists) { - name: storageName - location: location - kind: 'StorageV2' - sku: { - name: sku - } - properties: { - minimumTlsVersion: 'TLS1_2' - allowBlobPublicAccess: false - publicNetworkAccess: 'Enabled' - networkAcls: { - bypass: 'AzureServices' - defaultAction: 'Allow' - virtualNetworkRules: [] - } - allowSharedKeyAccess: false - } -} - -output aiServicesName string = aiServiceExists ? existingAIServiceAccount.name : aiServicesName -output aiservicesID string = aiServiceExists ? existingAIServiceAccount.id : aiServices.id -output aiservicesTarget string = aiServiceExists ? existingAIServiceAccount.properties.endpoint : aiServices.properties.endpoint -output aiServiceAccountResourceGroupName string = aiServiceExists ? aiServiceParts[4] : resourceGroup().name -output aiServiceAccountSubscriptionId string = aiServiceExists ? aiServiceParts[2] : subscription().subscriptionId - -output aiSearchName string = acsExists ? existingSearchService.name : aiSearch.name -output aisearchID string = acsExists ? existingSearchService.id : aiSearch.id -output aiSearchServiceResourceGroupName string = acsExists ? acsParts[4] : resourceGroup().name -output aiSearchServiceSubscriptionId string = acsExists ? acsParts[2] : subscription().subscriptionId - -output storageAccountName string = aiStorageExists ? existingAIStorageAccount.name : storage.name -output storageId string = aiStorageExists ? existingAIStorageAccount.id : storage.id -output storageAccountResourceGroupName string = aiStorageExists ? aiStorageParts[4] : resourceGroup().name -output storageAccountSubscriptionId string = aiStorageExists ? aiStorageParts[2] : subscription().subscriptionId - -output keyvaultId string = keyVault.id -output keyvaultUri string = keyVault.properties.vaultUri - diff --git a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/app/vnet.bicep b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/app/vnet.bicep index 1a24c115..2902467a 100644 --- a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/app/vnet.bicep +++ b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/app/vnet.bicep @@ -52,8 +52,8 @@ resource virtualNetwork 'Microsoft.Network/virtualNetworks@2023-05-01' = { name: 'delegation' id: resourceId('Microsoft.Network/virtualNetworks/subnets/delegations', vNetName, 'app', 'delegation') properties: { - //Microsoft.App/environments is the correct delegation for Flex Consumption VNet integration - serviceName: 'Microsoft.App/environments' + // The API runs on a dedicated (B1) App Service plan, which requires the Microsoft.Web/serverFarms delegation + serviceName: 'Microsoft.Web/serverFarms' } type: 'Microsoft.Network/virtualNetworks/subnets/delegations' } diff --git a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/main.bicep b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/main.bicep index 8bceb3e1..1d59c152 100644 --- a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/main.bicep +++ b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/main.bicep @@ -5,8 +5,8 @@ targetScope = 'subscription' param environmentName string @minLength(1) -@description('Primary location for all resources') -@allowed(['westus2', 'eastus', 'eastus2']) +@description('Primary location for all resources. Must support both Durable Task Scheduler and the agent model deployment.') +@allowed(['eastus2', 'swedencentral']) @metadata({ azd: { type: 'location' @@ -47,41 +47,30 @@ param disableLocalAuth bool = true @description('Id of the user or app to assign application roles') param principalId string = '' -@description('Name for the AI resource and used to derive name of dependent resources.') -param aiHubName string = 'hub-demo' +@description('Name of the Microsoft Foundry resource (AIServices account). Leave empty to generate a unique name.') +param aiFoundryName string = '' -@description('Friendly name for your Hub resource') -param aiHubFriendlyName string = 'Agents Hub resource' +@description('Name of the Microsoft Foundry project.') +param aiProjectName string = 'travel-planner' -@description('Description of your Azure AI resource displayed in AI studio') -param aiHubDescription string = 'This is an example AI resource for use in Azure AI Studio.' +@description('Display name of the Microsoft Foundry project') +param aiProjectFriendlyName string = 'Travel Planner Agents' -@description('Name for the AI project resources.') -param aiProjectName string = 'project-demo' +@description('Description of the Microsoft Foundry project') +param aiProjectDescription string = 'Foundry project hosting the travel planner agents.' -@description('Friendly name for your Azure AI resource') -param aiProjectFriendlyName string = 'Agents Project resource' - -@description('Description of your Azure AI resource displayed in AI studio') -param aiProjectDescription string = 'This is an example AI Project resource for use in Azure AI Studio.' - -@description('Name of the Azure AI Search account') -param aiSearchName string = 'agentaisearch' - -@description('Name for capabilityHost.') -param capabilityHostName string = 'caphost1' - -@description('Name of the Azure AI Services account') -param aiServicesName string = 'agentaiservices' +@description('Whether the Microsoft Foundry resource accepts traffic from public networks') +@allowed(['Enabled', 'Disabled']) +param aiPublicNetworkAccess string = 'Enabled' @description('Model name for deployment') -param modelName string = 'gpt-4o-mini' +param modelName string = 'gpt-5-mini' @description('Model format for deployment') param modelFormat string = 'OpenAI' @description('Model version for deployment') -param modelVersion string = '2024-07-18' +param modelVersion string = '2025-08-07' @description('Model deployment SKU name') param modelSkuName string = 'GlobalStandard' @@ -89,18 +78,9 @@ param modelSkuName string = 'GlobalStandard' @description('Model deployment capacity') param modelCapacity int = 50 -@description('Model deployment location. If you want to deploy an Azure AI resource/model in different location than the rest of the resources created.') +@description('Location of the Microsoft Foundry resource and model deployment, if it should differ from the rest of the resources.') param modelLocation string = location -@description('The AI Service Account full ARM Resource ID. This is an optional field, and if not provided, the resource will be created.') -param aiServiceAccountResourceId string = '' - -@description('The Ai Search Service full ARM Resource ID. This is an optional field, and if not provided, the resource will be created.') -param aiSearchServiceResourceId string = '' - -@description('The Ai Storage Account full ARM Resource ID. This is an optional field, and if not provided, the resource will be created.') -param aiStorageAccountResourceId string = '' - @description('The agent ID of the destination recommender agent') param destinationRecommenderAgentId string = 'agent-destination-recommender-agent' @@ -116,8 +96,7 @@ var resourceToken = toLower(uniqueString(subscription().id, rg.id, environmentNa var tags = { 'azd-env-name': environmentName } var functionAppName = !empty(apiServiceName) ? apiServiceName : '${abbrs.webSitesFunctions}api-${resourceToken}' var deploymentStorageContainerName = 'app-package-${take(functionAppName, 32)}-${take(toLower(uniqueString(functionAppName, resourceToken)), 7)}' -var name = toLower('${aiHubName}') -var projectName = toLower('${aiProjectName}') +var foundryName = !empty(aiFoundryName) ? aiFoundryName : 'aif-${resourceToken}' param dtsSkuName string = 'Consumption' param dtsCapacity int = 1 param dtsName string = '' @@ -128,9 +107,6 @@ var webAppName = !empty(webServiceName) ? webServiceName : '${abbrs.webStaticSit var webUri = 'https://${webAppName}.azurestaticapps.net' param webServiceName string = '' -// Create a short, unique suffix, that will be unique to each resource group -var uniqueSuffix = toLower(uniqueString(subscription().id, rg.id, location)) - // Organize resources in a resource group resource rg 'Microsoft.Resources/resourceGroups@2025-04-01' = { name: !empty(resourceGroupName) ? resourceGroupName : '${abbrs.resourcesResourceGroups}${environmentName}' @@ -218,9 +194,9 @@ module api './app/api.bicep' = { AZURE_CLIENT_ID: apiUserAssignedIdentity.outputs.identityClientId DURABLE_TASK_SCHEDULER_CONNECTION_STRING: 'Endpoint=${dts.outputs.dts_URL};Authentication=ManagedIdentity;ClientID=${apiUserAssignedIdentity.outputs.identityClientId}' TASKHUB_NAME: dts.outputs.TASKHUB_NAME - DESTINATION_RECOMMENDER_CONNECTION: aiProject.outputs.projectConnectionString - ITINERARY_PLANNER_CONNECTION: aiProject.outputs.projectConnectionString - LOCAL_RECOMMENDATIONS_CONNECTION: aiProject.outputs.projectConnectionString + DESTINATION_RECOMMENDER_CONNECTION: aiFoundry.outputs.projectEndpoint + ITINERARY_PLANNER_CONNECTION: aiFoundry.outputs.projectEndpoint + LOCAL_RECOMMENDATIONS_CONNECTION: aiFoundry.outputs.projectEndpoint DESTINATION_RECOMMENDER_AGENT_ID: destinationRecommenderAgentId ITINERARY_PLANNER_AGENT_ID: itineraryPlannerAgentId LOCAL_RECOMMENDATIONS_AGENT_ID: localRecommendationsAgentId @@ -234,104 +210,49 @@ module api './app/api.bicep' = { ] } -// Dependent resources for the Azure Machine Learning workspace -module aiDependencies './agent/standard-dependent-resources.bicep' = { +// Microsoft Foundry resource, project, and model deployment used by the agents +module aiFoundry './agent/ai-foundry.bicep' = { scope: rg - name: 'dependencies-${name}-${resourceToken}' + name: 'aiFoundry-${resourceToken}' params: { - location: location - storageName: 'st${resourceToken}' - keyvaultName: 'kv-${name}${resourceToken}' - aiServicesName: '${aiServicesName}${resourceToken}' - aiSearchName: '${aiSearchName}${resourceToken}' + location: modelLocation tags: tags - - // Model deployment parameters + aiFoundryName: foundryName + aiProjectName: toLower(aiProjectName) + aiProjectFriendlyName: aiProjectFriendlyName + aiProjectDescription: aiProjectDescription modelName: modelName modelFormat: modelFormat modelVersion: modelVersion modelSkuName: modelSkuName - modelCapacity: modelCapacity - modelLocation: modelLocation - - aiServiceAccountResourceId: aiServiceAccountResourceId - aiSearchServiceResourceId: aiSearchServiceResourceId - aiStorageAccountResourceId: aiStorageAccountResourceId - } - - dependsOn: [ - storage - ] -} - -module aiHub './agent/standard-ai-hub.bicep' = { - scope: rg - name: '${name}-${resourceToken}' - params: { - // workspace organization - aiHubName: '${name}${uniqueSuffix}' - aiHubFriendlyName: aiHubFriendlyName - aiHubDescription: aiHubDescription - location: location - tags: tags - capabilityHostName: '${name}${uniqueSuffix}${capabilityHostName}' - - aiSearchName: aiDependencies.outputs.aiSearchName - aiSearchId: aiDependencies.outputs.aisearchID - - aiServicesName: aiDependencies.outputs.aiServicesName - aiServicesId: aiDependencies.outputs.aiservicesID - aiServicesTarget: aiDependencies.outputs.aiservicesTarget - - keyVaultId: aiDependencies.outputs.keyvaultId - storageAccountId: aiDependencies.outputs.storageId + modelCapacity: modelCapacity + publicNetworkAccess: aiPublicNetworkAccess } - dependsOn: [ - storage - aiDependencies - ] } -module aiProject './agent/standard-ai-project.bicep' = { - scope: rg - name: '${projectName}-${resourceToken}-deployment' - params: { - // workspace organization - aiProjectName: '${projectName}${uniqueSuffix}' - aiProjectFriendlyName: aiProjectFriendlyName - aiProjectDescription: aiProjectDescription - location: location - tags: tags - - // dependent resources - capabilityHostName: '${projectName}${uniqueSuffix}${capabilityHostName}' +var azureAiUserRoleId = '53ca6127-db72-4b80-b1b0-d745d6d5456d' // Foundry User (formerly Azure AI User) - aiHubId: aiHub.outputs.aiHubID - acsConnectionName: aiHub.outputs.acsConnectionName - aoaiConnectionName: aiHub.outputs.aoaiConnectionName - } - dependsOn:[ - storage - ] -} - -module aiServiceRoleAssignments './agent/ai-service-role-assignments.bicep' = { +// Allow the function app identity to call the Foundry Agent Service +module aiFoundryRoleAssignmentApi './agent/ai-foundry-access.bicep' = { scope: rg - name: 'aiserviceroleassignments${projectName}-${resourceToken}' + name: 'aiFoundryRoleAssignmentApi-${resourceToken}' params: { - aiServicesName: aiDependencies.outputs.aiServicesName - aiProjectPrincipalId: aiProject.outputs.aiProjectPrincipalId - aiProjectId: aiProject.outputs.aiProjectResourceId + aiFoundryName: aiFoundry.outputs.aiFoundryName + roleDefinitionID: azureAiUserRoleId + principalID: apiUserAssignedIdentity.outputs.identityPrincipalId + principalType: 'ServicePrincipal' } } -module aiSearchRoleAssignments './agent/ai-search-role-assignments.bicep' = { +// Allow the deploying user to create and test agents in the Foundry project +module aiFoundryRoleAssignmentUser './agent/ai-foundry-access.bicep' = if (!empty(principalId)) { scope: rg - name: 'aisearchroleassignments${projectName}-${resourceToken}' + name: 'aiFoundryRoleAssignmentUser-${resourceToken}' params: { - aiSearchName: aiDependencies.outputs.aiSearchName - aiProjectPrincipalId: aiProject.outputs.aiProjectPrincipalId - aiProjectId: aiProject.outputs.aiProjectResourceId + aiFoundryName: aiFoundry.outputs.aiFoundryName + roleDefinitionID: azureAiUserRoleId + principalID: principalId + principalType: 'User' } } @@ -374,18 +295,6 @@ module storageQueueDataContributorRoleAssignmentprocessor 'app/storage-Access.bi } } -// Allow access from AI project to storage account using a managed identity -module storageQueueDataContributorRoleAssignmentAIProject 'app/storage-Access.bicep' = { - scope: rg - name: 'storageQueueDataContributorRoleAssignmentAIProject-${resourceToken}' - params: { - storageAccountName: storage.outputs.name - roleDefinitionID: storageQueueDataContributorRoleDefinitionId - principalID: aiProject.outputs.aiProjectPrincipalId - principalType: 'ServicePrincipal' - } -} - module storageQueueDataContributorRoleAssignmentUserIdentityprocessor 'app/storage-Access.bicep' = { scope: rg name: 'storageQueueDataContributorRole-${resourceToken}' @@ -462,24 +371,10 @@ module appInsightsRoleAssignmentApi './core/monitor/appinsights-access.bicep' = ] } -var azureAiDeveloperRoleId = '64702f94-c441-49e6-a78b-ef80e0188fee' // Azure AI Developer role ID -// Enable access to AI Project from the Azure Function user assigned identity -resource AIProjectRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = { - name: guid(azureAiDeveloperRoleId, aiProjectName, resourceId('Microsoft.MachineLearningServices/workspaces', aiProjectName), resourceToken) - properties: { - roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', azureAiDeveloperRoleId) - principalId: apiUserAssignedIdentity.outputs.identityPrincipalId - principalType: 'ServicePrincipal' - } - dependsOn: [ - apiUserAssignedIdentity - ] -} - var durableTaskDataContributorRoleDefinitionId = '0ad04412-c4d5-4796-b79c-f76d14c8d402' // Allow access from durable function to storage account using a user assigned managed identity -module dtsRoleAssignment 'app/dts-access.bicep' = { +module dtsRoleAssignment 'app/dts-Access.bicep' = { name: 'dtsRoleAssignment-${resourceToken}' scope: rg params: { @@ -495,7 +390,7 @@ module dtsRoleAssignment 'app/dts-access.bicep' = { ] } -module dtsDashboardRoleAssignment 'app/dts-access.bicep' = { +module dtsDashboardRoleAssignment 'app/dts-Access.bicep' = { name: 'dtsDashboardRoleAssignment-${resourceToken}' scope: rg params: { @@ -540,11 +435,14 @@ output STATIC_WEB_APP_NAME string = webapp.outputs.name output STATIC_WEB_APP_URI string = webapp.outputs.uri output PRE_STATIC_WEB_APP_URI string = webAppName output RESOURCE_GROUP string = rg.name -output PROJECT_CONNECTION_STRING string = aiProject.outputs.projectConnectionString +output AI_FOUNDRY_NAME string = aiFoundry.outputs.aiFoundryName +output AI_PROJECT_NAME string = aiFoundry.outputs.aiProjectName +output AI_MODEL_DEPLOYMENT_NAME string = aiFoundry.outputs.modelDeploymentName +output PROJECT_ENDPOINT string = aiFoundry.outputs.projectEndpoint output STORAGE_CONNECTION__queueServiceUri string = 'https://${storage.outputs.name}.queue.${environment().suffixes.storage}' // Agent outputs output DESTINATION_RECOMMENDER_AGENT_ID string = destinationRecommenderAgentId output ITINERARY_PLANNER_AGENT_ID string = itineraryPlannerAgentId output LOCAL_RECOMMENDATIONS_AGENT_ID string = localRecommendationsAgentId -output AGENT_CONNECTION_STRING string = aiProject.outputs.projectConnectionString +output AGENT_CONNECTION_STRING string = aiFoundry.outputs.projectEndpoint diff --git a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/main.parameters.json b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/main.parameters.json index 0cf80ea9..88ce90f6 100644 --- a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/main.parameters.json +++ b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/main.parameters.json @@ -79,6 +79,9 @@ }, "localRecommendationsAgentId": { "value": "${LOCAL_RECOMMENDATIONS_AGENT_ID}" + }, + "aiPublicNetworkAccess": { + "value": "${AI_PUBLIC_NETWORK_ACCESS=Enabled}" } } } \ No newline at end of file From 26ed86eb4315da6b23b8d78940e21187dbb2a48e Mon Sep 17 00:00:00 2001 From: Manvir Kaur <67894494+manvkaur@users.noreply.github.com> Date: Mon, 16 Nov 2026 09:55:11 -0800 Subject: [PATCH 2/5] Fix AI travel planner runtime failures found in private E2E - Pin Microsoft.ApplicationInsights.WorkerService to 2.23.0; 3.x is incompatible with Microsoft.Azure.Functions.Worker.ApplicationInsights and crashes the worker at startup (TypeLoadException for ITelemetryInitializer). - Fall back to a summary custom status when the WaitingForApproval status exceeds the 16 KB limit; the full plan remains available via documentUrl. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../Functions/TravelPlannerOrchestrator.cs | 28 +++++++++++++++++-- .../TravelPlannerFunctions.csproj | 2 +- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/Functions/TravelPlannerOrchestrator.cs b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/Functions/TravelPlannerOrchestrator.cs index 3d8a2d66..ceb63ade 100644 --- a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/Functions/TravelPlannerOrchestrator.cs +++ b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/Functions/TravelPlannerOrchestrator.cs @@ -9,6 +9,9 @@ namespace TravelPlannerFunctions.Functions; public class TravelPlannerOrchestrator { + // Durable custom status limit is 16 KB (UTF-16); keep headroom for serializer differences. + private const int MaxCustomStatusBytes = 15 * 1024; + private readonly ILogger _logger; public TravelPlannerOrchestrator(ILoggerFactory loggerFactory) @@ -153,12 +156,33 @@ public async Task RunTravelPlannerOrchestration( } }; - // The custom status has a max size of 16KB. + // The custom status has a max size of 16KB (UTF-16). Detailed agent output can exceed it, + // so fall back to a summary; the full plan remains available via documentUrl. var waitingStatusSize = Encoding.Unicode.GetByteCount(JsonSerializer.Serialize(waitingStatus)); logger.LogInformation("Waiting status size: {Size} bytes", waitingStatusSize); - context.SetCustomStatus(waitingStatus); + if (waitingStatusSize <= MaxCustomStatusBytes) + { + context.SetCustomStatus(waitingStatus); + } + else + { + logger.LogWarning("Waiting status size {Size} bytes exceeds limit; sending summary status instead", waitingStatusSize); + context.SetCustomStatus(new { + waitingStatus.step, + waitingStatus.message, + waitingStatus.progress, + waitingStatus.destination, + waitingStatus.documentUrl, + travelPlan = new { + waitingStatus.travelPlan.destination, + waitingStatus.travelPlan.dates, + waitingStatus.travelPlan.cost, + waitingStatus.travelPlan.days + } + }); + } approvalResponse = await context.WaitForExternalEvent( "ApprovalEvent", diff --git a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/TravelPlannerFunctions.csproj b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/TravelPlannerFunctions.csproj index bef43601..1a3c637f 100644 --- a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/TravelPlannerFunctions.csproj +++ b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/TravelPlannerFunctions.csproj @@ -20,7 +20,7 @@ - + From 5e6e5712f842debc80fe8735cc29d9edc11b38de Mon Sep 17 00:00:00 2001 From: Manvir Kaur <67894494+manvkaur@users.noreply.github.com> Date: Mon, 16 Nov 2026 14:52:28 -0800 Subject: [PATCH 3/5] Move AI sample .NET 10 and OpenTelemetry migration into follow-up Transfer the AI sample changes from PR #443 commit 99909604 while preserving the Foundry deployment fixes and approval-status guard. Replace the temporary Application Insights pin with managed-identity OpenTelemetry export and align the Function App runtime with .NET 10. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../AiAgentTravelPlanOrchestrator/Program.cs | 23 +++++++++++++++---- .../AiAgentTravelPlanOrchestrator/README.md | 14 ++++++++++- .../TravelPlannerFunctions.csproj | 17 +++++++------- .../AiAgentTravelPlanOrchestrator/host.json | 14 +++-------- .../infra/app/api.bicep | 2 ++ .../infra/core/host/functions-app.bicep | 4 ++-- 6 files changed, 47 insertions(+), 27 deletions(-) diff --git a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/Program.cs b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/Program.cs index 7f5dd6e3..0c058aea 100644 --- a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/Program.cs +++ b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/Program.cs @@ -1,4 +1,5 @@ -using Microsoft.Azure.Functions.Worker; +using Azure.Monitor.OpenTelemetry.Exporter; +using Microsoft.Azure.Functions.Worker.OpenTelemetry; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Configuration; @@ -6,14 +7,26 @@ using Microsoft.Extensions.Logging; using Azure.Identity; using TravelPlannerFunctions.Services; -using Azure.AI.Projects; var host = new HostBuilder() .ConfigureFunctionsWebApplication() - .ConfigureServices(services => + .ConfigureServices((context, services) => { - services.AddApplicationInsightsTelemetryWorkerService(); - services.ConfigureFunctionsApplicationInsights(); + string? connectionString = context.Configuration["APPLICATIONINSIGHTS_CONNECTION_STRING"]; + if (!string.IsNullOrWhiteSpace(connectionString)) + { + services.AddAzureClientsCore(); + services.AddOptions() + .Configure((options, factory) => + { + options.ConnectionString = connectionString; + options.Credential = factory.CreateTokenCredential( + context.Configuration.GetSection("AzureMonitorExporter")); + }); + services.AddOpenTelemetry() + .UseFunctionsWorkerDefaults() + .UseAzureMonitorExporter(); + } services.AddLogging(); services.AddSingleton((serviceProvider) => diff --git a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/README.md b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/README.md index 37f72062..c52734b8 100644 --- a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/README.md +++ b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/README.md @@ -66,6 +66,12 @@ The complete travel plan is saved to Azure Blob Storage, and a document URL is g The travel plan is presented to the user for approval via the frontend interface. +### Travel-plan blob retention + +The sample writes documents to the private `travel-plans` container and configures no automatic expiry or cleanup job. Treat the returned blob URL as a location, not a public download link or a retention guarantee. Reading it still requires authorized storage access. + +Retain documents throughout the approval wait (up to seven days), booking/recovery, and the period during which users need to retrieve the plan or retained orchestration output. For production, choose an explicit business/privacy retention period, then delete eligible documents after those requirements end; coordinate this with durable history retention so saved URLs do not unexpectedly point to deleted plans. A lifecycle rule based only on blob age can delete a plan while approval or recovery is still pending. Account for soft-delete and version retention, which can retain data and incur charges after deletion. Deleting the dedicated sample environment removes its storage; do not delete a shared storage account to clean up travel plans. + ### Step 8: Booking Process (Conditional) If approved, the orchestrator proceeds with the booking process. If rejected, it can either terminate or restart with modified preferences. @@ -77,7 +83,7 @@ Upon successful booking, the user receives a final confirmation with all travel ## Prerequisites - Docker -- .NET 8 SDK +- .NET 10 SDK - Azure Functions Core Tools v4 - Node.js 22.12+ and npm (required by the frontend's Azure Storage and Vite dependencies) - Azure Developer CLI (azd) @@ -87,6 +93,10 @@ Upon successful booking, the user receives a final confirmation with all travel - Azure Durable Task resource - Microsoft Foundry project with configured agents +## Telemetry + +The Functions host uses OpenTelemetry. When `APPLICATIONINSIGHTS_CONNECTION_STRING` is set, the worker exports to Azure Monitor using the app's managed identity through `AzureMonitorExporter__credential` and `AzureMonitorExporter__clientId`. Without that connection string, the worker does not export. `AZURE_CLIENT_ID` is still required by the agent and storage clients. + ## Setting Up Locally ### 1. Clone the Repository @@ -227,6 +237,8 @@ This command will: > [!IMPORTANT] > By default, the Foundry resource allows public network access so that the function app can reach it. The template doesn't create a private endpoint for Foundry. To block public access, run `azd env set AI_PUBLIC_NETWORK_ACCESS Disabled` before `azd up`, and provide your own private endpoint and virtual network integration so the function app can still reach the Foundry project. > +> The default `skipVnet=true` deployment is not a private deployment. Private Function App ingress also requires a private endpoint. The Static Web App linked backend configures Function App authentication; direct API calls must satisfy that authentication and may return 401 without it. + ### 4. Configure AI Agents After deployment, create the three agents in the Foundry project. You can create them in the [Foundry portal](https://ai.azure.com) or by calling the Agent Service REST API with the deployed model. The deploying user is granted the **Foundry User** role on the Foundry resource, which is required to create agents. Role assignments can take a few minutes to take effect. diff --git a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/TravelPlannerFunctions.csproj b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/TravelPlannerFunctions.csproj index 1a3c637f..d9b21d1e 100644 --- a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/TravelPlannerFunctions.csproj +++ b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/TravelPlannerFunctions.csproj @@ -1,6 +1,6 @@ - net8.0 + net10.0 v4 Exe enable @@ -12,19 +12,20 @@ - - + + - + - - - + + + + - + diff --git a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/host.json b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/host.json index 0b2b93eb..05513dd6 100644 --- a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/host.json +++ b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/host.json @@ -1,18 +1,10 @@ { "version": "2.0", + "telemetryMode": "OpenTelemetry", "logging": { - "applicationInsights": { - "samplingSettings": { - "isEnabled": true, - "excludedTypes": "Request" - }, - "enableLiveMetricsFilters": true, - "logLevel": { - "Host.Triggers.DurableTask": "Information" - } - }, "logLevel": { - "Function": "Information" + "Function": "Information", + "Host.Triggers.DurableTask": "Information" } }, "extensions": { diff --git a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/app/api.bicep b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/app/api.bicep index 09620fe7..28ec235b 100644 --- a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/app/api.bicep +++ b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/app/api.bicep @@ -25,6 +25,8 @@ module api '../core/host/functions-app.bicep' = { { AzureWebJobsStorage__clientId : identityClientId APPLICATIONINSIGHTS_AUTHENTICATION_STRING: applicationInsightsIdentity + AzureMonitorExporter__credential: 'managedidentity' + AzureMonitorExporter__clientId: identityClientId }) applicationInsightsName: applicationInsightsName appServicePlanId: appServicePlanId diff --git a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/core/host/functions-app.bicep b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/core/host/functions-app.bicep index 3e8a28f2..9eb0c69c 100644 --- a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/core/host/functions-app.bicep +++ b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/core/host/functions-app.bicep @@ -20,7 +20,7 @@ param kind string = 'functionapp,linux' param appSettings object = {} param allowedOrigins array = [] -var linuxFxVersion string = 'DOTNET-ISOLATED|8.0' +var linuxFxVersion string = 'DOTNET-ISOLATED|10.0' resource storageAccount 'Microsoft.Storage/storageAccounts@2024-01-01' existing = { name: storageAccountName @@ -42,7 +42,7 @@ module functions 'br/public:avm/res/web/site:0.16.0' = { userAssignedResourceIds: [identityId] } siteConfig: { - netFrameworkVersion: 'v8.0' + netFrameworkVersion: 'v10.0' linuxFxVersion: linuxFxVersion cors: { allowedOrigins: union([ 'https://portal.azure.com', 'https://ms.portal.azure.com' ], allowedOrigins) From 6fa40ffc136b6439f1ed7a8663abe3f1930b83da Mon Sep 17 00:00:00 2001 From: Manvir Kaur <67894494+manvkaur@users.noreply.github.com> Date: Mon, 16 Nov 2026 16:10:40 -0800 Subject: [PATCH 4/5] Fix AI deployment parameters and telemetry authentication Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../AiAgentTravelPlanOrchestrator/Program.cs | 7 ++- .../AiAgentTravelPlanOrchestrator/README.md | 6 ++- .../infra/main.parameters.json | 54 ------------------- 3 files changed, 10 insertions(+), 57 deletions(-) diff --git a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/Program.cs b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/Program.cs index 0c058aea..cf4814ae 100644 --- a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/Program.cs +++ b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/Program.cs @@ -20,8 +20,11 @@ .Configure((options, factory) => { options.ConnectionString = connectionString; - options.Credential = factory.CreateTokenCredential( - context.Configuration.GetSection("AzureMonitorExporter")); + var exporterConfiguration = context.Configuration.GetSection("AzureMonitorExporter"); + if (!string.IsNullOrWhiteSpace(exporterConfiguration["credential"])) + { + options.Credential = factory.CreateTokenCredential(exporterConfiguration); + } }); services.AddOpenTelemetry() .UseFunctionsWorkerDefaults() diff --git a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/README.md b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/README.md index c52734b8..a1ec0a6c 100644 --- a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/README.md +++ b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/README.md @@ -95,7 +95,11 @@ Upon successful booking, the user receives a final confirmation with all travel ## Telemetry -The Functions host uses OpenTelemetry. When `APPLICATIONINSIGHTS_CONNECTION_STRING` is set, the worker exports to Azure Monitor using the app's managed identity through `AzureMonitorExporter__credential` and `AzureMonitorExporter__clientId`. Without that connection string, the worker does not export. `AZURE_CLIENT_ID` is still required by the agent and storage clients. +The Functions host uses OpenTelemetry. Set `APPLICATIONINSIGHTS_CONNECTION_STRING` to export worker telemetry to Azure Monitor. Without the connection string, the worker does not export. When `AzureMonitorExporter__credential` is not set, the worker uses the connection string without Microsoft Entra authentication, which requires local authentication to be enabled on the Application Insights resource. + +To opt in to Microsoft Entra authentication for worker telemetry, set `AzureMonitorExporter__credential` to `managedidentity` and grant the identity the Monitoring Metrics Publisher role on the Application Insights resource. For a user-assigned identity, also set `AzureMonitorExporter__clientId` to its client ID. Configure host telemetry separately with `APPLICATIONINSIGHTS_AUTHENTICATION_STRING` (for example, `Authorization=AAD;ClientId=` for a user-assigned identity). The supplied Bicep template configures both host and worker to use its managed identity and disables local authentication by default. + +`AZURE_TENANT_ID` and `AZURE_CLIENT_ID` are still required by the agent and storage setup, regardless of the telemetry authentication method. ## Setting Up Locally diff --git a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/main.parameters.json b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/main.parameters.json index 88ce90f6..047e7fe6 100644 --- a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/main.parameters.json +++ b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/main.parameters.json @@ -14,63 +14,9 @@ "principalId": { "value": "${AZURE_PRINCIPAL_ID}" }, - "openAiResourceGroupName": { - "value": "${AZURE_OPENAI_RESOURCE_GROUP}" - }, - "chatGptDeploymentName": { - "value": "${AZURE_OPENAI_CHATGPT_DEPLOYMENT=chat}" - }, - "chatGptDeploymentCapacity":{ - "value": "${AZURE_OPENAI_CHATGPT_DEPLOYMENT_CAPACITY}" - }, - "chatGptDeploymentVersion":{ - "value": "${AZURE_OPENAI_CHATGPT_DEPLOYMENT_VERSION}" - }, - "chatGptModelName":{ - "value": "${AZURE_OPENAI_CHATGPT_MODEL=gpt-35-turbo}" - }, - "documentIntelligenceServiceName": { - "value": "${AZURE_DOCUMENTINTELLIGENCE_SERVICE}" - }, - "documentIntelligenceSkuName": { - "value": "${AZURE_DOCUMENTINTELLIGENCE_SKU=S0}" - }, - "embeddingDeploymentName": { - "value": "${AZURE_OPENAI_EMB_DEPLOYMENT=embedding}" - }, - "embeddingModelName":{ - "value": "${AZURE_OPENAI_EMB_MODEL_NAME=text-embedding-3-small}" - }, - "embeddingDeploymentVersion":{ - "value": "${AZURE_OPENAI_EMB_DEPLOYMENT_VERSION}" - }, - "embeddingDeploymentCapacity":{ - "value": "${AZURE_OPENAI_EMB_DEPLOYMENT_CAPACITY}" - }, - "searchServiceName": { - "value": "${AZURE_SEARCH_SERVICE}" - }, - "searchServiceResourceGroupName": { - "value": "${AZURE_SEARCH_SERVICE_RESOURCE_GROUP}" - }, - "searchServiceIndexName": { - "value": "${AZURE_SEARCH_INDEX=openai-index}" - }, - "searchServiceSkuName": { - "value": "${AZURE_SEARCH_SERVICE_SKU=standard}" - }, "storageAccountName": { "value": "${AZURE_STORAGE_ACCOUNT}" }, - "storageResourceGroupName": { - "value": "${AZURE_STORAGE_RESOURCE_GROUP}" - }, - "azFunctionHostingPlanType": { - "value": "flexconsumption" - }, - "systemPrompt": { - "value": "${SYSTEM_PROMPT}=You are a helpful assistant. You are responding to requests from a user about internal emails and documents. You can and should refer to the internal documents to help respond to requests. If a user makes a request thats not covered by the documents provided in the query, you must say that you do not have access to the information and not try and get information from other places besides the documents provided. The following is a list of documents that you can refer to when answering questions. The documents are in the format [filename]: [text] and are separated by newlines. If you answer a question by referencing any of the documents, please cite the document in your answer. For example, if you answer a question by referencing info.txt, you should add \"Reference: info.txt\" to the end of your answer on a separate line." - }, "destinationRecommenderAgentId": { "value": "${DESTINATION_RECOMMENDER_AGENT_ID}" }, From 18b0294212302ba5836e7a252c550d9526fe31be Mon Sep 17 00:00:00 2001 From: Manvir Kaur <67894494+manvkaur@users.noreply.github.com> Date: Tue, 17 Nov 2026 14:16:10 -0800 Subject: [PATCH 5/5] Address AI sample review feedback Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../Functions/TravelPlannerApi.cs | 2 +- .../Functions/TravelPlannerOrchestrator.cs | 4 +++- .../dotnet/AiAgentTravelPlanOrchestrator/Program.cs | 3 +++ .../dotnet/AiAgentTravelPlanOrchestrator/README.md | 4 ++-- .../TravelPlannerFunctions.csproj | 1 + .../dotnet/AiAgentTravelPlanOrchestrator/infra/main.bicep | 2 +- 6 files changed, 11 insertions(+), 5 deletions(-) diff --git a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/Functions/TravelPlannerApi.cs b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/Functions/TravelPlannerApi.cs index c0eee65e..02773284 100644 --- a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/Functions/TravelPlannerApi.cs +++ b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/Functions/TravelPlannerApi.cs @@ -162,7 +162,7 @@ public async Task GetTripConfirmationStatus( { if (bookingConfirmationElement.ValueKind == System.Text.Json.JsonValueKind.String) { - string bookingConfirmation = bookingConfirmationElement.GetString(); + string? bookingConfirmation = bookingConfirmationElement.GetString(); if (bookingConfirmation != null) { if (bookingConfirmation.Contains("Booking confirmed")) diff --git a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/Functions/TravelPlannerOrchestrator.cs b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/Functions/TravelPlannerOrchestrator.cs index ceb63ade..20fb8380 100644 --- a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/Functions/TravelPlannerOrchestrator.cs +++ b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/Functions/TravelPlannerOrchestrator.cs @@ -125,7 +125,9 @@ public async Task RunTravelPlannerOrchestration( documentUrl = documentUrl }); var approvalRequest = new ApprovalRequest(context.InstanceId, travelPlan, travelRequest.UserName); - await context.CallActivityAsync(nameof(TravelPlannerActivities.RequestApproval), approvalRequest); + await context.CallActivityAsync( + nameof(TravelPlannerActivities.RequestApproval), + approvalRequest); // Step 6: Wait for approval logger.LogInformation("Step 6: Waiting for approval from user {UserName}", travelRequest.UserName); diff --git a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/Program.cs b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/Program.cs index cf4814ae..c532bfc9 100644 --- a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/Program.cs +++ b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/Program.cs @@ -6,6 +6,8 @@ using Microsoft.Extensions.Azure; using Microsoft.Extensions.Logging; using Azure.Identity; +using OpenTelemetry; +using OpenTelemetry.Trace; using TravelPlannerFunctions.Services; var host = new HostBuilder() @@ -28,6 +30,7 @@ }); services.AddOpenTelemetry() .UseFunctionsWorkerDefaults() + .WithTracing(tracing => tracing.AddHttpClientInstrumentation()) .UseAzureMonitorExporter(); } services.AddLogging(); diff --git a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/README.md b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/README.md index a1ec0a6c..339a86b7 100644 --- a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/README.md +++ b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/README.md @@ -95,7 +95,7 @@ Upon successful booking, the user receives a final confirmation with all travel ## Telemetry -The Functions host uses OpenTelemetry. Set `APPLICATIONINSIGHTS_CONNECTION_STRING` to export worker telemetry to Azure Monitor. Without the connection string, the worker does not export. When `AzureMonitorExporter__credential` is not set, the worker uses the connection string without Microsoft Entra authentication, which requires local authentication to be enabled on the Application Insights resource. +The Functions host uses OpenTelemetry. Set `APPLICATIONINSIGHTS_CONNECTION_STRING` to export worker telemetry, including outbound HTTP dependency traces, to Azure Monitor. Without the connection string, the worker does not export. When `AzureMonitorExporter__credential` is not set, the worker uses the connection string without Microsoft Entra authentication, which requires local authentication to be enabled on the Application Insights resource. To opt in to Microsoft Entra authentication for worker telemetry, set `AzureMonitorExporter__credential` to `managedidentity` and grant the identity the Monitoring Metrics Publisher role on the Application Insights resource. For a user-assigned identity, also set `AzureMonitorExporter__clientId` to its client ID. Configure host telemetry separately with `APPLICATIONINSIGHTS_AUTHENTICATION_STRING` (for example, `Authorization=AAD;ClientId=` for a user-assigned identity). The supplied Bicep template configures both host and worker to use its managed identity and disables local authentication by default. @@ -236,7 +236,7 @@ This command will: - Configure the function app with the Foundry project endpoint and grant its managed identity the **Foundry User** role (formerly **Azure AI User**) on the Foundry resource > [!NOTE] -> Choose `eastus2` or `swedencentral` as the location. Both regions support Durable Task Scheduler and the `gpt-5-mini` `GlobalStandard` deployment. To use a different model, set the `modelName`, `modelVersion`, `modelSkuName`, and `modelCapacity` parameters in `infra/main.bicep`. +> Choose `eastus2` as the location. It supports Durable Task Scheduler, Azure Static Web Apps, and `gpt-5-mini` `GlobalStandard` for Foundry Agent Service. To use a different model, set the `modelName`, `modelVersion`, `modelSkuName`, and `modelCapacity` parameters in `infra/main.bicep`. > [!IMPORTANT] > By default, the Foundry resource allows public network access so that the function app can reach it. The template doesn't create a private endpoint for Foundry. To block public access, run `azd env set AI_PUBLIC_NETWORK_ACCESS Disabled` before `azd up`, and provide your own private endpoint and virtual network integration so the function app can still reach the Foundry project. diff --git a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/TravelPlannerFunctions.csproj b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/TravelPlannerFunctions.csproj index d9b21d1e..720df94b 100644 --- a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/TravelPlannerFunctions.csproj +++ b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/TravelPlannerFunctions.csproj @@ -23,6 +23,7 @@ + diff --git a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/main.bicep b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/main.bicep index 1d59c152..888abbae 100644 --- a/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/main.bicep +++ b/samples/durable-functions/dotnet/AiAgentTravelPlanOrchestrator/infra/main.bicep @@ -6,7 +6,7 @@ param environmentName string @minLength(1) @description('Primary location for all resources. Must support both Durable Task Scheduler and the agent model deployment.') -@allowed(['eastus2', 'swedencentral']) +@allowed(['eastus2']) @metadata({ azd: { type: 'location'