diff --git a/samples/ai-loan-agent-sample/1ClickDeploy/BundleAssets.ps1 b/samples/ai-loan-agent-sample/1ClickDeploy/BundleAssets.ps1 deleted file mode 100644 index e7f647d..0000000 --- a/samples/ai-loan-agent-sample/1ClickDeploy/BundleAssets.ps1 +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env powershell -<# -.SYNOPSIS - Create ARM template for 1-click deploy and bundle LogicApps folder into workflows.zip for deployment. - -.DESCRIPTION - This script prepares all necessary assets for 1-click deployment by performing two key tasks: - - 1. Build ARM Template: Compiles the Bicep infrastructure file (../Deployment/infrastructure/main.bicep) - into an ARM template (sample-arm.json) using the Bicep CLI. This template defines all Azure - resources including Logic App Standard, Azure OpenAI, Storage Account, and Application Insights. - - 2. Bundle Workflows: Creates a deployment-ready workflows.zip containing all Logic App workflows - and configuration from the ../LogicApps folder. Automatically excludes development artifacts: - - Version control (.git) - - Editor settings (.vscode) - - Dependencies (node_modules) - - Local storage (__azurite*, __blobstorage__*, __queuestorage__*) - - Existing zip files - - Both outputs (sample-arm.json and workflows.zip) are created in the current directory for use - in Azure Portal 1-click deployment scenarios. - -.EXAMPLE - .\BundleAssets.ps1 - - Builds the ARM template and creates workflows.zip in the current directory. - -.NOTES - Requirements: - - Bicep CLI must be installed (https://learn.microsoft.com/azure/azure-resource-manager/bicep/install) - - PowerShell 5.1 or later -#> - -$ErrorActionPreference = "Stop" - -Write-Host "`n=== Bundling Logic App Assets ===" -ForegroundColor Cyan - -# Paths relative to this script location -$logicAppsPath = Resolve-Path "$PSScriptRoot\..\LogicApps" -$zipPath = "$PSScriptRoot\workflows.zip" -$bicepPath = "$PSScriptRoot\..\Deployment\infrastructure\main.bicep" -$armTemplatePath = "$PSScriptRoot\sample-arm.json" - -# Build Bicep to ARM template -Write-Host "`nBuilding ARM template from Bicep..." - -if (-not (Test-Path $bicepPath)) { - Write-Host "✗ Bicep file not found: $bicepPath" -ForegroundColor Red - exit 1 -} - -# Check for Bicep CLI -$bicepAvailable = $null -ne (Get-Command bicep -ErrorAction SilentlyContinue) - -if (-not $bicepAvailable) { - Write-Host "✗ Bicep CLI not found. Please install it first." -ForegroundColor Red - Write-Host "Install: https://learn.microsoft.com/azure/azure-resource-manager/bicep/install" -ForegroundColor Yellow - exit 1 -} - -try { - bicep build $bicepPath --outfile $armTemplatePath - - if (Test-Path $armTemplatePath) { - $armSize = (Get-Item $armTemplatePath).Length / 1KB - Write-Host "✓ Successfully created sample-arm.json ($("{0:N2}" -f $armSize) KB)" -ForegroundColor Green - } else { - throw "ARM template file was not created" - } -} catch { - Write-Host "✗ Failed to build ARM template: $($_.Exception.Message)" -ForegroundColor Red - exit 1 -} - -# Remove existing zip if present -if (Test-Path $zipPath) { - Remove-Item $zipPath -Force - Write-Host "✓ Removed existing workflows.zip" -ForegroundColor Green -} - -# Get all items except those we want to exclude -$itemsToZip = Get-ChildItem -Path $logicAppsPath | Where-Object { - $_.Name -notin @('.git', '.vscode', 'node_modules') -and - $_.Name -notlike '__azurite*' -and - $_.Name -notlike '__blobstorage__*' -and - $_.Name -notlike '__queuestorage__*' -and - $_.Extension -ne '.zip' -} - -Write-Host "`nIncluding files:" -$itemsToZip | ForEach-Object { Write-Host " - $($_.Name)" -ForegroundColor Gray } - -# Create zip -Push-Location $logicAppsPath -Compress-Archive -Path $itemsToZip.Name -DestinationPath $zipPath -Force -Pop-Location - -if (Test-Path $zipPath) { - $zipSize = (Get-Item $zipPath).Length / 1MB - Write-Host "`n✓ Successfully created workflows.zip ($("{0:N2}" -f $zipSize) MB)" -ForegroundColor Green - Write-Host "Location: $zipPath" -ForegroundColor Cyan -} else { - Write-Host "`n✗ Failed to create workflows.zip" -ForegroundColor Red - exit 1 -} - -Write-Host "`n=== Bundling Complete ===" -ForegroundColor Cyan -Write-Host "ARM Template: $armTemplatePath" -ForegroundColor Gray -Write-Host "Workflows Zip: $zipPath" -ForegroundColor Gray diff --git a/samples/ai-loan-agent-sample/1ClickDeploy/workflows.zip b/samples/ai-loan-agent-sample/1ClickDeploy/workflows.zip deleted file mode 100644 index d25a6e7..0000000 Binary files a/samples/ai-loan-agent-sample/1ClickDeploy/workflows.zip and /dev/null differ diff --git a/samples/ai-loan-agent-sample/Deployment/cleanup.ps1 b/samples/ai-loan-agent-sample/Deployment/cleanup.ps1 deleted file mode 100644 index 6c3fcb3..0000000 --- a/samples/ai-loan-agent-sample/Deployment/cleanup.ps1 +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env powershell -<# -.SYNOPSIS - Clean up AI Loan Agent resources by deleting the resource group. - -.PARAMETER ResourceGroupName - Name of the resource group to delete - -.EXAMPLE - .\cleanup.ps1 -ResourceGroupName "rg-ailoan" -#> - -param( - [Parameter(Mandatory=$true)] - [string]$ResourceGroupName -) - -$ErrorActionPreference = "Stop" - -Write-Host "`n=== Cleaning Up AI Loan Agent ===" -ForegroundColor Cyan -Write-Host "Resource Group: $ResourceGroupName" - -# Check auth -$context = Get-AzContext -ErrorAction SilentlyContinue -if (-not $context) { - Write-Host "Not logged in. Run: Connect-AzAccount" -ForegroundColor Red - exit 1 -} - -# Verify resource group exists -$rg = Get-AzResourceGroup -Name $ResourceGroupName -ErrorAction SilentlyContinue -if (-not $rg) { - Write-Host "Resource group '$ResourceGroupName' not found" -ForegroundColor Red - exit 1 -} - -# Confirm deletion -$confirm = Read-Host "`nThis will delete all resources in '$ResourceGroupName'. Continue? (y/n)" -if ($confirm -ne 'y') { - Write-Host "Cleanup cancelled" -ForegroundColor Yellow - exit -} - -Write-Host "`nDeleting resource group..." -ForegroundColor Yellow -Remove-AzResourceGroup -Name $ResourceGroupName -Force -AsJob | Out-Null - -Write-Host "✓ Cleanup initiated" -ForegroundColor Green -Write-Host "Resource group deletion is running in the background." -ForegroundColor Gray diff --git a/samples/ai-loan-agent-sample/Deployment/deploy.ps1 b/samples/ai-loan-agent-sample/Deployment/deploy.ps1 deleted file mode 100644 index a32d028..0000000 --- a/samples/ai-loan-agent-sample/Deployment/deploy.ps1 +++ /dev/null @@ -1,204 +0,0 @@ -#!/usr/bin/env powershell -<# -.SYNOPSIS - Deploy AI Loan Agent using Bicep. - -.PARAMETER ProjectName - Project name (3-15 chars). Resources named: -- - -.PARAMETER Location - Azure region. Default: eastus2 - -.PARAMETER Tags - Optional tags as hashtable. Example: @{Environment='dev'; Owner='TeamA'} - -.EXAMPLE - .\deploy.ps1 -ProjectName "ailoan" - -.EXAMPLE - .\deploy.ps1 -ProjectName "ailoan" -Tags @{Environment='prod'; CostCenter='IT'} -#> - -param( - [Parameter(Mandatory=$true)] - [ValidatePattern('^[a-z0-9-]{3,15}$')] - [string]$ProjectName, - - [Parameter(Mandatory=$false)] - [string]$Location = 'eastus2', - - [Parameter(Mandatory=$false)] - [hashtable]$Tags = @{} -) - -$ErrorActionPreference = "Stop" - -# Normalize location to lowercase -$Location = $Location.ToLower() - -# Validate location - must support both gpt-4.1-mini and Logic Apps Standard -$validLocations = @('australiaeast', 'westeurope', 'germanywestcentral', 'italynorth', - 'swedencentral', 'uksouth', 'eastus', 'eastus2', 'southcentralus', 'westus3') - -if ($Location -notin $validLocations) { - Write-Host "Error: Invalid location '$Location'" -ForegroundColor Red - Write-Host "Valid locations (support both gpt-4.1-mini and Logic Apps Standard):" -ForegroundColor Yellow - Write-Host "$($validLocations -join ', ')" -ForegroundColor Yellow - exit 1 -} - -Write-Host "`n=== AI Loan Agent Deployment ===" -ForegroundColor Cyan -Write-Host "Project: $ProjectName | Location: $Location`n" - -# Check auth -$context = Get-AzContext -ErrorAction SilentlyContinue -if (-not $context) { - Write-Host "Not logged in. Run: Connect-AzAccount" -ForegroundColor Red - exit 1 -} - -# Create resource group -$resourceGroupName = "rg-$ProjectName" -$defaultTags = @{ 'Project' = $ProjectName } -$tags = $defaultTags + $Tags - -$rg = Get-AzResourceGroup -Name $resourceGroupName -ErrorAction SilentlyContinue -if (-not $rg) { - New-AzResourceGroup -Name $resourceGroupName -Location $Location -Tag $tags | Out-Null - Write-Host "✓ Resource group created: $resourceGroupName" -ForegroundColor Green -} else { - Write-Host "✓ Resource group exists: $resourceGroupName" -ForegroundColor Green -} - -# Deploy Bicep -Write-Host "`nDeploying infrastructure (5-10 minutes)..." - -$bicepPath = "$PSScriptRoot/infrastructure/main.bicep" -$deploymentName = "ailoan-$(Get-Date -Format 'yyyyMMddHHmmss')" - -try { - $deployment = New-AzResourceGroupDeployment ` - -Name $deploymentName ` - -ResourceGroupName $resourceGroupName ` - -TemplateFile $bicepPath ` - -baseName $ProjectName ` - -location $Location ` - -Mode Incremental ` - -ErrorAction Stop - - Write-Host "✓ Infrastructure deployment complete" -ForegroundColor Green -} -catch { - # Check if the only errors are RBAC conflicts (expected on redeployment) - if ($_.Exception.Message -match 'RoleAssignmentExists|role assignment already exists') { - Write-Host "✓ Infrastructure deployment complete (RBAC roles already configured)" -ForegroundColor Green - # Get deployment outputs even if RBAC warnings occurred - $deployment = Get-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName -Name $deploymentName - } - else { - Write-Host "`nDeployment failed:" -ForegroundColor Red - Write-Host $_.Exception.Message -ForegroundColor Red - if ($_.Exception.InnerException) { - Write-Host $_.Exception.InnerException.Message -ForegroundColor Red - } - exit 1 - } -} - -# Wait for RBAC propagation (critical for managed identity to work) -Write-Host "`nWaiting 60 seconds for RBAC role assignments to propagate..." -ForegroundColor Yellow -Start-Sleep -Seconds 60 -Write-Host "✓ RBAC propagation complete" -ForegroundColor Green - -# Get outputs -$logicAppName = $deployment.Outputs.logicAppName.Value -$openAIEndpoint = $deployment.Outputs.openAIEndpoint.Value - -# Generate local.settings.json (for local development with Azurite emulator) -$openAI = Get-AzResource -ResourceGroupName $resourceGroupName -ResourceType "Microsoft.CognitiveServices/accounts" | Select-Object -First 1 - -# Use Azurite emulator connection string for local development -# In Azure, the deployed Logic App uses managed identity (no connection string needed) -$localSettings = @{ - IsEncrypted = $false - Values = @{ - "AzureWebJobsStorage" = "UseDevelopmentStorage=true" - "FUNCTIONS_WORKER_RUNTIME" = "dotnet" - "WORKFLOWS_SUBSCRIPTION_ID" = $context.Subscription.Id - "WORKFLOWS_RESOURCE_GROUP_NAME" = $resourceGroupName - "WORKFLOWS_LOCATION_NAME" = $Location - "agent_openAIEndpoint" = $openAIEndpoint - "agent_ResourceID" = $openAI.ResourceId - } -} - -$localSettingsPath = "$PSScriptRoot/../LogicApps/local.settings.json" -$localSettings | ConvertTo-Json -Depth 10 | Set-Content -Path $localSettingsPath -Encoding UTF8 - -# Deploy workflows using Azure PowerShell Zip Deploy -Write-Host "`nDeploying workflows to Logic App..." - -$logicAppsPath = Resolve-Path "$PSScriptRoot/../LogicApps" -$zipPath = "$PSScriptRoot/workflows.zip" - -# Create zip -if (Test-Path $zipPath) { Remove-Item $zipPath -Force } - -# Get all items except those we want to exclude -$itemsToZip = Get-ChildItem -Path $logicAppsPath | Where-Object { - $_.Name -notin @('.git', '.vscode', 'node_modules') -and - $_.Name -notlike '__azurite*' -and - $_.Name -notlike '__blobstorage__*' -and - $_.Name -notlike '__queuestorage__*' -and - $_.Extension -ne '.zip' -} - -Push-Location $logicAppsPath -Compress-Archive -Path $itemsToZip.Name -DestinationPath $zipPath -Force -Pop-Location - -# Check for Azure CLI -$azCliAvailable = $null -ne (Get-Command az -ErrorAction SilentlyContinue) - -if (-not $azCliAvailable) { - Write-Host "`n✗ Azure CLI not found. Workflows not deployed." -ForegroundColor Yellow - Write-Host "Install: https://learn.microsoft.com/cli/azure/install-azure-cli" -ForegroundColor Yellow - Write-Host "Alternative: Open workspace in VS Code, right-click LogicApps folder → Deploy to Logic App`n" -ForegroundColor Cyan -} else { - try { - az functionapp deployment source config-zip ` - --resource-group $resourceGroupName ` - --name $logicAppName ` - --src $zipPath ` - --output none ` - 2>&1 | Out-Null - - if ($LASTEXITCODE -eq 0) { - Write-Host "✓ Workflows deployed successfully" -ForegroundColor Green - } else { - throw "Deployment returned exit code $LASTEXITCODE" - } - } catch { - Write-Host "✗ Workflow deployment failed: $($_.Exception.Message)" -ForegroundColor Red - Write-Host "Alternative: Open workspace in VS Code, right-click LogicApps folder → Deploy to Logic App" -ForegroundColor Cyan - } -} - -Remove-Item $zipPath -Force -ErrorAction SilentlyContinue - -# Restart Logic App to load workflows -Write-Host "`nRestarting Logic App..." -Restart-AzWebApp -ResourceGroupName $resourceGroupName -Name $logicAppName | Out-Null -Start-Sleep -Seconds 10 -Write-Host "✓ Logic App restarted" -ForegroundColor Green - -# Summary -Write-Host "`n=== Deployment Complete ===" -ForegroundColor Cyan -Write-Host "Resource Group: $resourceGroupName" -Write-Host "Logic App: $logicAppName" -Write-Host "OpenAI Endpoint: $openAIEndpoint" -Write-Host "Logic App URL: https://$logicAppName.azurewebsites.net" - -Write-Host "`n--- Next: Quick Start Step 4 - Test & Validate ---" -ForegroundColor Yellow -Write-Host "Run test script, then verify agent workflows following README 'Testing & Validation' section" -Write-Host " .\test-agent.ps1 -ResourceGroupName '$resourceGroupName' -LogicAppName '$logicAppName'" -ForegroundColor Cyan diff --git a/samples/ai-loan-agent-sample/Deployment/infrastructure/bicepconfig.json b/samples/ai-loan-agent-sample/Deployment/infrastructure/bicepconfig.json deleted file mode 100644 index 729f659..0000000 --- a/samples/ai-loan-agent-sample/Deployment/infrastructure/bicepconfig.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "analyzers": { - "core": { - "verbose": false, - "enabled": true, - "rules": { - "no-unnecessary-dependson": { - "level": "off" - } - } - } - } -} diff --git a/samples/ai-loan-agent-sample/Deployment/infrastructure/modules/deployment-script.bicep b/samples/ai-loan-agent-sample/Deployment/infrastructure/modules/deployment-script.bicep deleted file mode 100644 index d809a08..0000000 --- a/samples/ai-loan-agent-sample/Deployment/infrastructure/modules/deployment-script.bicep +++ /dev/null @@ -1,89 +0,0 @@ -// Deployment Script Module - Deploys workflows.zip to Logic App -// Includes RBAC assignment for deployment identity - -@description('Location for the deployment script resource') -param location string - -@description('Name for the deployment script resource') -param deploymentScriptName string - -@description('User-assigned managed identity ID for deployment') -param userAssignedIdentityId string - -@description('Principal ID of the user-assigned managed identity used for deployment') -param deploymentIdentityPrincipalId string - -@description('Name of the Logic App to deploy to') -param logicAppName string - -@description('Resource group name') -param resourceGroupName string - -@description('URL to the workflows.zip file') -param workflowsZipUrl string - -// Grant Website Contributor role at resource group level to deployment identity -// This allows the deployment script to deploy code to the Logic App and read the App Service Plan -resource websiteContributorRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = { - name: guid(resourceGroup().id, deploymentIdentityPrincipalId, 'de139f84-1756-47ae-9be6-808fbbe84772') - scope: resourceGroup() - properties: { - roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'de139f84-1756-47ae-9be6-808fbbe84772') // Website Contributor - principalId: deploymentIdentityPrincipalId - principalType: 'ServicePrincipal' - } -} - -// Deploy workflows.zip to Logic App using Azure CLI -resource workflowDeploymentScript 'Microsoft.Resources/deploymentScripts@2023-08-01' = { - name: deploymentScriptName - location: location - kind: 'AzureCLI' - identity: { - type: 'UserAssigned' - userAssignedIdentities: { - '${userAssignedIdentityId}': {} - } - } - properties: { - azCliVersion: '2.59.0' - retentionInterval: 'PT1H' - timeout: 'PT30M' - cleanupPreference: 'OnSuccess' - environmentVariables: [ - { - name: 'LOGIC_APP_NAME' - value: logicAppName - } - { - name: 'RESOURCE_GROUP' - value: resourceGroupName - } - { - name: 'WORKFLOWS_ZIP_URL' - value: workflowsZipUrl - } - ] - scriptContent: ''' - #!/bin/bash - set -e - - echo "Downloading workflows.zip..." - wget -O workflows.zip "$WORKFLOWS_ZIP_URL" - - echo "Deploying workflows to Logic App: $LOGIC_APP_NAME" - az functionapp deployment source config-zip \ - --resource-group "$RESOURCE_GROUP" \ - --name "$LOGIC_APP_NAME" \ - --src workflows.zip - - echo "Waiting 60 seconds for workflow registration and RBAC propagation..." - sleep 60 - - echo "Deployment completed successfully" - ''' - } - dependsOn: [ - websiteContributorRoleAssignment - ] -} diff --git a/samples/ai-loan-agent-sample/Deployment/infrastructure/modules/logicapp.bicep b/samples/ai-loan-agent-sample/Deployment/infrastructure/modules/logicapp.bicep deleted file mode 100644 index e86a865..0000000 --- a/samples/ai-loan-agent-sample/Deployment/infrastructure/modules/logicapp.bicep +++ /dev/null @@ -1,122 +0,0 @@ -// Logic App Standard Module - -@description('Logic App name') -param logicAppName string - -@description('Location for Logic App') -param location string - -@description('Storage account name') -param storageAccountName string - -@description('OpenAI endpoint') -param openAIEndpoint string - -@description('OpenAI resource ID') -param openAIResourceId string - -@description('User-assigned managed identity resource ID for storage authentication') -param managedIdentityId string - -resource appServicePlan 'Microsoft.Web/serverfarms@2023-12-01' = { - name: '${logicAppName}-plan' - location: location - sku: { - name: 'WS1' - tier: 'WorkflowStandard' - } - kind: 'elastic' - properties: { - maximumElasticWorkerCount: 20 - } -} - -resource logicApp 'Microsoft.Web/sites@2023-12-01' = { - name: '${logicAppName}-logicapp' - location: location - kind: 'functionapp,workflowapp' - identity: { - type: 'SystemAssigned, UserAssigned' - userAssignedIdentities: { - '${managedIdentityId}': {} - } - } - properties: { - serverFarmId: appServicePlan.id - siteConfig: { - netFrameworkVersion: 'v8.0' - functionsRuntimeScaleMonitoringEnabled: true - appSettings: [ - { - name: 'FUNCTIONS_EXTENSION_VERSION' - value: '~4' - } - { - name: 'FUNCTIONS_WORKER_RUNTIME' - value: 'dotnet' - } - { - name: 'AzureWebJobsStorage__managedIdentityResourceId' - value: managedIdentityId - } - { - name: 'AzureWebJobsStorage__credential' - value: 'managedIdentity' - } - { - name: 'AzureWebJobsStorage__blobServiceUri' - value: 'https://${storageAccountName}.blob.${environment().suffixes.storage}' - } - { - name: 'AzureWebJobsStorage__queueServiceUri' - value: 'https://${storageAccountName}.queue.${environment().suffixes.storage}' - } - { - name: 'AzureWebJobsStorage__tableServiceUri' - value: 'https://${storageAccountName}.table.${environment().suffixes.storage}' - } - { - name: 'WEBSITES_ENABLE_APP_SERVICE_STORAGE' - value: 'false' - } - { - name: 'AzureFunctionsJobHost__extensionBundle__id' - value: 'Microsoft.Azure.Functions.ExtensionBundle.Workflows' - } - { - name: 'AzureFunctionsJobHost__extensionBundle__version' - value: '[1.*, 2.0.0)' - } - { - name: 'APP_KIND' - value: 'workflowApp' - } - { - name: 'WORKFLOWS_SUBSCRIPTION_ID' - value: subscription().subscriptionId - } - { - name: 'WORKFLOWS_LOCATION_NAME' - value: location - } - { - name: 'WORKFLOWS_RESOURCE_GROUP_NAME' - value: resourceGroup().name - } - { - name: 'agent_openAIEndpoint' - value: openAIEndpoint - } - { - name: 'agent_ResourceID' - value: openAIResourceId - } - ] - } - httpsOnly: true - } -} - -output name string = logicApp.name -output systemAssignedPrincipalId string = logicApp.identity.principalId -output quickTestUrl string = 'https://${logicApp.properties.defaultHostName}/api/QuickTest/triggers/When_a_HTTP_request_is_received/invoke?api-version=2022-05-01&sp=%2Ftriggers%2FWhen_a_HTTP_request_is_received%2Frun&sv=1.0&sig=' diff --git a/samples/ai-loan-agent-sample/Deployment/infrastructure/modules/openai-rbac.bicep b/samples/ai-loan-agent-sample/Deployment/infrastructure/modules/openai-rbac.bicep deleted file mode 100644 index fb9a60b..0000000 --- a/samples/ai-loan-agent-sample/Deployment/infrastructure/modules/openai-rbac.bicep +++ /dev/null @@ -1,26 +0,0 @@ -// OpenAI RBAC Module - Grants Logic App access to OpenAI - -@description('OpenAI account name') -param openAIName string - -@description('Logic App managed identity principal ID') -param logicAppPrincipalId string - -resource openAI 'Microsoft.CognitiveServices/accounts@2023-05-01' existing = { - name: openAIName -} - -// Cognitive Services OpenAI User role -var cognitiveServicesOpenAIUserRoleId = '5e0bd9bd-7b93-4f28-af87-19fc36ad61bd' - -resource roleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = { - name: guid(openAI.id, logicAppPrincipalId, cognitiveServicesOpenAIUserRoleId) - scope: openAI - properties: { - roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', cognitiveServicesOpenAIUserRoleId) - principalId: logicAppPrincipalId - principalType: 'ServicePrincipal' - } -} - -output roleAssignmentId string = roleAssignment.id diff --git a/samples/ai-loan-agent-sample/Deployment/infrastructure/modules/openai.bicep b/samples/ai-loan-agent-sample/Deployment/infrastructure/modules/openai.bicep deleted file mode 100644 index 6e59f3e..0000000 --- a/samples/ai-loan-agent-sample/Deployment/infrastructure/modules/openai.bicep +++ /dev/null @@ -1,40 +0,0 @@ -// Azure OpenAI Module - -@description('Azure OpenAI account name') -param openAIName string - -@description('Location for Azure OpenAI') -param location string - -resource openAI 'Microsoft.CognitiveServices/accounts@2024-10-01' = { - name: openAIName - location: location - kind: 'OpenAI' - sku: { - name: 'S0' - } - properties: { - customSubDomainName: openAIName - publicNetworkAccess: 'Enabled' - } -} - -resource deployment 'Microsoft.CognitiveServices/accounts/deployments@2024-10-01' = { - parent: openAI - name: 'gpt-4.1-mini' - sku: { - name: 'GlobalStandard' - capacity: 50 - } - properties: { - model: { - format: 'OpenAI' - name: 'gpt-4.1-mini' - version: '2025-04-14' - } - } -} - -output name string = openAI.name -output endpoint string = openAI.properties.endpoint -output resourceId string = openAI.id diff --git a/samples/ai-loan-agent-sample/Deployment/infrastructure/modules/storage-rbac.bicep b/samples/ai-loan-agent-sample/Deployment/infrastructure/modules/storage-rbac.bicep deleted file mode 100644 index 1ed0ed8..0000000 --- a/samples/ai-loan-agent-sample/Deployment/infrastructure/modules/storage-rbac.bicep +++ /dev/null @@ -1,45 +0,0 @@ -// Storage RBAC Module - Assigns required roles to Logic App managed identity - -@description('Storage account name') -param storageAccountName string - -@description('Principal ID of the Logic App managed identity') -param logicAppPrincipalId string - -// Storage account reference -resource storageAccount 'Microsoft.Storage/storageAccounts@2023-01-01' existing = { - name: storageAccountName -} - -// Role assignment: Storage Blob Data Owner -resource storageBlobDataOwnerAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = { - name: guid(storageAccount.id, logicAppPrincipalId, 'b7e6dc6d-f1e8-4753-8033-0f276bb0955b') - scope: storageAccount - properties: { - roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'b7e6dc6d-f1e8-4753-8033-0f276bb0955b') - principalId: logicAppPrincipalId - principalType: 'ServicePrincipal' - } -} - -// Role assignment: Storage Queue Data Contributor -resource storageQueueDataContributorAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = { - name: guid(storageAccount.id, logicAppPrincipalId, '974c5e8b-45b9-4653-ba55-5f855dd0fb88') - scope: storageAccount - properties: { - roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '974c5e8b-45b9-4653-ba55-5f855dd0fb88') - principalId: logicAppPrincipalId - principalType: 'ServicePrincipal' - } -} - -// Role assignment: Storage Table Data Contributor -resource storageTableDataContributorAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = { - name: guid(storageAccount.id, logicAppPrincipalId, '0a9a7e1f-b9d0-4cc4-a60d-0319b160aaa3') - scope: storageAccount - properties: { - roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '0a9a7e1f-b9d0-4cc4-a60d-0319b160aaa3') - principalId: logicAppPrincipalId - principalType: 'ServicePrincipal' - } -} diff --git a/samples/ai-loan-agent-sample/Deployment/infrastructure/modules/storage.bicep b/samples/ai-loan-agent-sample/Deployment/infrastructure/modules/storage.bicep deleted file mode 100644 index 449f211..0000000 --- a/samples/ai-loan-agent-sample/Deployment/infrastructure/modules/storage.bicep +++ /dev/null @@ -1,28 +0,0 @@ -// Storage Account Module - For Logic App runtime only - -@description('Storage account name') -param storageAccountName string - -@description('Location for the storage account') -param location string - -resource storageAccount 'Microsoft.Storage/storageAccounts@2023-05-01' = { - name: storageAccountName - location: location - sku: { - name: 'Standard_LRS' - } - kind: 'StorageV2' - properties: { - supportsHttpsTrafficOnly: true - minimumTlsVersion: 'TLS1_2' - allowBlobPublicAccess: false - allowSharedKeyAccess: false // Enforce managed identity only - no connection strings or keys - } -} - -output storageAccountName string = storageAccount.name -output storageAccountId string = storageAccount.id -output blobServiceUri string = storageAccount.properties.primaryEndpoints.blob -output queueServiceUri string = storageAccount.properties.primaryEndpoints.queue -output tableServiceUri string = storageAccount.properties.primaryEndpoints.table diff --git a/samples/ai-loan-agent-sample/Deployment/infrastructure/main.bicep b/samples/ai-loan-agent-sample/Deployment/main.bicep similarity index 64% rename from samples/ai-loan-agent-sample/Deployment/infrastructure/main.bicep rename to samples/ai-loan-agent-sample/Deployment/main.bicep index a563061..186b4ba 100644 --- a/samples/ai-loan-agent-sample/Deployment/infrastructure/main.bicep +++ b/samples/ai-loan-agent-sample/Deployment/main.bicep @@ -1,5 +1,8 @@ -// AI Loan Agent - Azure Infrastructure as Code -// Deploys Logic Apps Standard with Azure OpenAI for autonomous loan decisions +// Auto-generated from shared/templates/main.bicep.template +// To customize: edit this file directly or delete to regenerate from template +// +// Logic Apps Agent Sample - Azure Infrastructure as Code +// Deploys Logic Apps Standard with Azure OpenAI for autonomous agent workflows // Uses managed identity exclusively (no secrets/connection strings) targetScope = 'resourceGroup' @@ -12,6 +15,9 @@ param BaseName string // uniqueSuffix for when we need unique values var uniqueSuffix = uniqueString(resourceGroup().id) +// URL to workflows.zip (replaced by BundleAssets.ps1 with https://raw.githubusercontent.com/Azure/logicapps-labs/main/samples/ai-loan-agent-sample/Deployment/workflows.zip) +var workflowsZipUrl = 'https://raw.githubusercontent.com/Azure/logicapps-labs/main/samples/ai-loan-agent-sample/Deployment/workflows.zip' + // User-Assigned Managed Identity for Logic App → Storage authentication resource userAssignedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = { name: '${take(BaseName, 60)}-managedidentity' @@ -19,17 +25,17 @@ resource userAssignedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@ } // Storage Account for workflow runtime -module storage 'modules/storage.bicep' = { - name: '${BaseName}-storage-deployment' +module storage '../../shared/modules/storage.bicep' = { + name: '${take(BaseName, 43)}-storage-deployment' params: { storageAccountName: toLower(take(replace('${take(BaseName, 16)}${uniqueSuffix}', '-', ''), 24)) location: resourceGroup().location } } -// Azure OpenAI with gpt-4.1-mini model -module openai 'modules/openai.bicep' = { - name: '${BaseName}-openai-deployment' +// Azure OpenAI with gpt-5-mini model +module openai '../../shared/modules/openai.bicep' = { + name: '${take(BaseName, 44)}-openai-deployment' params: { openAIName: '${take(BaseName, 54)}-openai' location: resourceGroup().location @@ -37,8 +43,8 @@ module openai 'modules/openai.bicep' = { } // Logic Apps Standard with dual managed identities -module logicApp 'modules/logicapp.bicep' = { - name: '${BaseName}-logicapp-deployment' +module logicApp '../../shared/modules/logicapp.bicep' = { + name: '${take(BaseName, 42)}-logicapp-deployment' params: { logicAppName: '${take(BaseName, 22)}${uniqueSuffix}' location: resourceGroup().location @@ -50,37 +56,29 @@ module logicApp 'modules/logicapp.bicep' = { } // RBAC: Logic App → Storage (Blob, Queue, Table Contributor roles) -// dependsOn ensures RBAC is assigned after all resources exist (important for incremental deployments) -module storageRbac 'modules/storage-rbac.bicep' = { - name: '${BaseName}-storage-rbac-deployment' +module storageRbac '../../shared/modules/storage-rbac.bicep' = { + name: '${take(BaseName, 38)}-storage-rbac-deployment' params: { storageAccountName: storage.outputs.storageAccountName logicAppPrincipalId: userAssignedIdentity.properties.principalId } dependsOn: [ - storage - userAssignedIdentity logicApp ] } // RBAC: Logic App → Azure OpenAI (Cognitive Services User role) -// dependsOn ensures RBAC is assigned after all resources exist (important for incremental deployments) -module openaiRbac 'modules/openai-rbac.bicep' = { - name: '${BaseName}-openai-rbac-deployment' +module openaiRbac '../../shared/modules/openai-rbac.bicep' = { + name: '${take(BaseName, 39)}-openai-rbac-deployment' params: { openAIName: openai.outputs.name logicAppPrincipalId: logicApp.outputs.systemAssignedPrincipalId } - dependsOn: [ - openai - logicApp - ] } // Deploy workflows using deployment script with RBAC -module workflowDeployment 'modules/deployment-script.bicep' = { - name: '${BaseName}-workflow-deployment' +module workflowDeployment '../../shared/modules/deployment-script.bicep' = { + name: '${take(BaseName, 42)}-workflow-deployment' params: { deploymentScriptName: '${BaseName}-deploy-workflows' location: resourceGroup().location @@ -88,13 +86,11 @@ module workflowDeployment 'modules/deployment-script.bicep' = { deploymentIdentityPrincipalId: userAssignedIdentity.properties.principalId logicAppName: logicApp.outputs.name resourceGroupName: resourceGroup().name - workflowsZipUrl: 'https://raw.githubusercontent.com/modularity/logicapps-labs/loan-agent-deployment/samples/ai-loan-agent-sample/1ClickDeploy/workflows.zip' + workflowsZipUrl: workflowsZipUrl } dependsOn: [ storageRbac openaiRbac - logicApp - userAssignedIdentity ] } diff --git a/samples/ai-loan-agent-sample/1ClickDeploy/sample-arm.json b/samples/ai-loan-agent-sample/Deployment/sample-arm.json similarity index 86% rename from samples/ai-loan-agent-sample/1ClickDeploy/sample-arm.json rename to samples/ai-loan-agent-sample/Deployment/sample-arm.json index 0ca1c6f..3fd0c91 100644 --- a/samples/ai-loan-agent-sample/1ClickDeploy/sample-arm.json +++ b/samples/ai-loan-agent-sample/Deployment/sample-arm.json @@ -4,8 +4,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "14295569004504621407" + "version": "0.39.26.7824", + "templateHash": "4411128690320887628" } }, "parameters": { @@ -19,7 +19,8 @@ } }, "variables": { - "uniqueSuffix": "[uniqueString(resourceGroup().id)]" + "uniqueSuffix": "[uniqueString(resourceGroup().id)]", + "workflowsZipUrl": "https://raw.githubusercontent.com/Azure/logicapps-labs/main/samples/ai-loan-agent-sample/Deployment/workflows.zip" }, "resources": [ { @@ -30,8 +31,8 @@ }, { "type": "Microsoft.Resources/deployments", - "apiVersion": "2022-09-01", - "name": "[format('{0}-storage-deployment', parameters('BaseName'))]", + "apiVersion": "2025-04-01", + "name": "[format('{0}-storage-deployment', take(parameters('BaseName'), 43))]", "properties": { "expressionEvaluationOptions": { "scope": "inner" @@ -51,8 +52,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "6666359930464991611" + "version": "0.39.26.7824", + "templateHash": "11906848055003519521" } }, "parameters": { @@ -114,8 +115,8 @@ }, { "type": "Microsoft.Resources/deployments", - "apiVersion": "2022-09-01", - "name": "[format('{0}-openai-deployment', parameters('BaseName'))]", + "apiVersion": "2025-04-01", + "name": "[format('{0}-openai-deployment', take(parameters('BaseName'), 44))]", "properties": { "expressionEvaluationOptions": { "scope": "inner" @@ -135,8 +136,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "10689067746502759371" + "version": "0.39.26.7824", + "templateHash": "6448475993981052673" } }, "parameters": { @@ -171,7 +172,7 @@ { "type": "Microsoft.CognitiveServices/accounts/deployments", "apiVersion": "2024-10-01", - "name": "[format('{0}/{1}', parameters('openAIName'), 'gpt-4.1-mini')]", + "name": "[format('{0}/{1}', parameters('openAIName'), 'gpt-5-mini')]", "sku": { "name": "GlobalStandard", "capacity": 50 @@ -179,8 +180,8 @@ "properties": { "model": { "format": "OpenAI", - "name": "gpt-4.1-mini", - "version": "2025-04-14" + "name": "gpt-5-mini", + "version": "2025-08-07" } }, "dependsOn": [ @@ -207,8 +208,8 @@ }, { "type": "Microsoft.Resources/deployments", - "apiVersion": "2022-09-01", - "name": "[format('{0}-logicapp-deployment', parameters('BaseName'))]", + "apiVersion": "2025-04-01", + "name": "[format('{0}-logicapp-deployment', take(parameters('BaseName'), 42))]", "properties": { "expressionEvaluationOptions": { "scope": "inner" @@ -222,13 +223,13 @@ "value": "[resourceGroup().location]" }, "storageAccountName": { - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-storage-deployment', parameters('BaseName'))), '2022-09-01').outputs.storageAccountName.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-storage-deployment', take(parameters('BaseName'), 43))), '2025-04-01').outputs.storageAccountName.value]" }, "openAIEndpoint": { - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', parameters('BaseName'))), '2022-09-01').outputs.endpoint.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44))), '2025-04-01').outputs.endpoint.value]" }, "openAIResourceId": { - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', parameters('BaseName'))), '2022-09-01').outputs.resourceId.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44))), '2025-04-01').outputs.resourceId.value]" }, "managedIdentityId": { "value": "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', format('{0}-managedidentity', take(parameters('BaseName'), 60)))]" @@ -240,8 +241,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "17288948455817957334" + "version": "0.39.26.7824", + "templateHash": "3032492753694364828" } }, "parameters": { @@ -399,21 +400,21 @@ }, "quickTestUrl": { "type": "string", - "value": "[format('https://{0}/api/QuickTest/triggers/When_a_HTTP_request_is_received/invoke?api-version=2022-05-01&sp=%2Ftriggers%2FWhen_a_HTTP_request_is_received%2Frun&sv=1.0&sig=', reference(resourceId('Microsoft.Web/sites', format('{0}-logicapp', parameters('logicAppName'))), '2023-12-01').defaultHostName)]" + "value": "[format('https://{0}/api/ProductReturnAgent/triggers/When_a_HTTP_request_is_received/invoke?api-version=2022-05-01&sp=%2Ftriggers%2FWhen_a_HTTP_request_is_received%2Frun&sv=1.0&sig=', reference(resourceId('Microsoft.Web/sites', format('{0}-logicapp', parameters('logicAppName'))), '2023-12-01').defaultHostName)]" } } } }, "dependsOn": [ - "[resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', parameters('BaseName')))]", - "[resourceId('Microsoft.Resources/deployments', format('{0}-storage-deployment', parameters('BaseName')))]", + "[resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44)))]", + "[resourceId('Microsoft.Resources/deployments', format('{0}-storage-deployment', take(parameters('BaseName'), 43)))]", "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', format('{0}-managedidentity', take(parameters('BaseName'), 60)))]" ] }, { "type": "Microsoft.Resources/deployments", - "apiVersion": "2022-09-01", - "name": "[format('{0}-storage-rbac-deployment', parameters('BaseName'))]", + "apiVersion": "2025-04-01", + "name": "[format('{0}-storage-rbac-deployment', take(parameters('BaseName'), 38))]", "properties": { "expressionEvaluationOptions": { "scope": "inner" @@ -421,7 +422,7 @@ "mode": "Incremental", "parameters": { "storageAccountName": { - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-storage-deployment', parameters('BaseName'))), '2022-09-01').outputs.storageAccountName.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-storage-deployment', take(parameters('BaseName'), 43))), '2025-04-01').outputs.storageAccountName.value]" }, "logicAppPrincipalId": { "value": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', format('{0}-managedidentity', take(parameters('BaseName'), 60))), '2023-01-31').principalId]" @@ -433,8 +434,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "13372547588259048703" + "version": "0.39.26.7824", + "templateHash": "8000893445802246432" } }, "parameters": { @@ -489,15 +490,15 @@ } }, "dependsOn": [ - "[resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', parameters('BaseName')))]", - "[resourceId('Microsoft.Resources/deployments', format('{0}-storage-deployment', parameters('BaseName')))]", + "[resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', take(parameters('BaseName'), 42)))]", + "[resourceId('Microsoft.Resources/deployments', format('{0}-storage-deployment', take(parameters('BaseName'), 43)))]", "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', format('{0}-managedidentity', take(parameters('BaseName'), 60)))]" ] }, { "type": "Microsoft.Resources/deployments", - "apiVersion": "2022-09-01", - "name": "[format('{0}-openai-rbac-deployment', parameters('BaseName'))]", + "apiVersion": "2025-04-01", + "name": "[format('{0}-openai-rbac-deployment', take(parameters('BaseName'), 39))]", "properties": { "expressionEvaluationOptions": { "scope": "inner" @@ -505,10 +506,10 @@ "mode": "Incremental", "parameters": { "openAIName": { - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', parameters('BaseName'))), '2022-09-01').outputs.name.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44))), '2025-04-01').outputs.name.value]" }, "logicAppPrincipalId": { - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', parameters('BaseName'))), '2022-09-01').outputs.systemAssignedPrincipalId.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', take(parameters('BaseName'), 42))), '2025-04-01').outputs.systemAssignedPrincipalId.value]" } }, "template": { @@ -517,8 +518,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "3822718305786172483" + "version": "0.39.26.7824", + "templateHash": "6926659019016520420" } }, "parameters": { @@ -560,14 +561,14 @@ } }, "dependsOn": [ - "[resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', parameters('BaseName')))]", - "[resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', parameters('BaseName')))]" + "[resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', take(parameters('BaseName'), 42)))]", + "[resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44)))]" ] }, { "type": "Microsoft.Resources/deployments", - "apiVersion": "2022-09-01", - "name": "[format('{0}-workflow-deployment', parameters('BaseName'))]", + "apiVersion": "2025-04-01", + "name": "[format('{0}-workflow-deployment', take(parameters('BaseName'), 42))]", "properties": { "expressionEvaluationOptions": { "scope": "inner" @@ -587,13 +588,13 @@ "value": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', format('{0}-managedidentity', take(parameters('BaseName'), 60))), '2023-01-31').principalId]" }, "logicAppName": { - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', parameters('BaseName'))), '2022-09-01').outputs.name.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', take(parameters('BaseName'), 42))), '2025-04-01').outputs.name.value]" }, "resourceGroupName": { "value": "[resourceGroup().name]" }, "workflowsZipUrl": { - "value": "https://raw.githubusercontent.com/modularity/logicapps-labs/loan-agent-deployment/samples/ai-loan-agent-sample/1ClickDeploy/workflows.zip" + "value": "[variables('workflowsZipUrl')]" } }, "template": { @@ -602,8 +603,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "712288766568288725" + "version": "0.39.26.7824", + "templateHash": "2786599112922814163" } }, "parameters": { @@ -692,7 +693,7 @@ "value": "[parameters('workflowsZipUrl')]" } ], - "scriptContent": " #!/bin/bash\r\n set -e\r\n \r\n echo \"Downloading workflows.zip...\"\r\n wget -O workflows.zip \"$WORKFLOWS_ZIP_URL\"\r\n \r\n echo \"Deploying workflows to Logic App: $LOGIC_APP_NAME\"\r\n az functionapp deployment source config-zip \\\r\n --resource-group \"$RESOURCE_GROUP\" \\\r\n --name \"$LOGIC_APP_NAME\" \\\r\n --src workflows.zip\r\n \r\n echo \"Waiting 60 seconds for workflow registration and RBAC propagation...\"\r\n sleep 60\r\n \r\n echo \"Deployment completed successfully\"\r\n " + "scriptContent": " #!/bin/bash\r\n set -e\r\n\r\n echo \"Downloading workflows.zip...\"\r\n wget -O workflows.zip \"$WORKFLOWS_ZIP_URL\"\r\n\r\n echo \"Deploying workflows to Logic App: $LOGIC_APP_NAME\"\r\n az functionapp deployment source config-zip \\\r\n --resource-group \"$RESOURCE_GROUP\" \\\r\n --name \"$LOGIC_APP_NAME\" \\\r\n --src workflows.zip\r\n\r\n echo \"Waiting 60 seconds for workflow registration and RBAC propagation...\"\r\n sleep 60\r\n\r\n echo \"Deployment completed successfully\"\r\n " }, "dependsOn": [ "[resourceId('Microsoft.Authorization/roleAssignments', guid(resourceGroup().id, parameters('deploymentIdentityPrincipalId'), 'de139f84-1756-47ae-9be6-808fbbe84772'))]" @@ -702,9 +703,9 @@ } }, "dependsOn": [ - "[resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', parameters('BaseName')))]", - "[resourceId('Microsoft.Resources/deployments', format('{0}-openai-rbac-deployment', parameters('BaseName')))]", - "[resourceId('Microsoft.Resources/deployments', format('{0}-storage-rbac-deployment', parameters('BaseName')))]", + "[resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', take(parameters('BaseName'), 42)))]", + "[resourceId('Microsoft.Resources/deployments', format('{0}-openai-rbac-deployment', take(parameters('BaseName'), 39)))]", + "[resourceId('Microsoft.Resources/deployments', format('{0}-storage-rbac-deployment', take(parameters('BaseName'), 38)))]", "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', format('{0}-managedidentity', take(parameters('BaseName'), 60)))]" ] } @@ -712,11 +713,11 @@ "outputs": { "logicAppName": { "type": "string", - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', parameters('BaseName'))), '2022-09-01').outputs.name.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', take(parameters('BaseName'), 42))), '2025-04-01').outputs.name.value]" }, "openAIEndpoint": { "type": "string", - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', parameters('BaseName'))), '2022-09-01').outputs.endpoint.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44))), '2025-04-01').outputs.endpoint.value]" } } } \ No newline at end of file diff --git a/samples/ai-loan-agent-sample/Deployment/test-agent.ps1 b/samples/ai-loan-agent-sample/Deployment/test-agent.ps1 deleted file mode 100644 index d5cd02f..0000000 --- a/samples/ai-loan-agent-sample/Deployment/test-agent.ps1 +++ /dev/null @@ -1,214 +0,0 @@ -<# -.SYNOPSIS - Test AI Loan Agent with 4 loan application scenarios - -.PARAMETER ResourceGroupName - Azure resource group containing the Logic App - -.PARAMETER LogicAppName - Name of the Logic App Standard resource - -.PARAMETER WorkflowName - Name of the workflow to test (default: LoanApprovalAgent) - -.EXAMPLE - .\test-agent.ps1 -ResourceGroupName "rg-ailoan" -LogicAppName "ailoan-logicapp" -#> - -param( - [Parameter(Mandatory=$true)] - [string]$ResourceGroupName, - - [Parameter(Mandatory=$true)] - [string]$LogicAppName, - - [Parameter(Mandatory=$false)] - [string]$WorkflowName = "LoanApprovalAgent" -) - -function Show-AgentResponse { - param( - [string]$CaseName, - $Response - ) - - Write-Host " Agent decision output ($CaseName):" -ForegroundColor DarkYellow - - if ($null -eq $Response) { - Write-Host " (No response body returned)" -ForegroundColor Gray - return - } - - if ($Response -is [string]) { - Write-Host " $Response" -ForegroundColor Green - return - } - - try { - $json = $Response | ConvertTo-Json -Depth 10 - $indented = " " + ($json -replace "`n", "`n ") - Write-Host $indented -ForegroundColor Green - - if ($Response.PSObject.Properties.Name -contains 'decision') { - Write-Host " Decision: $($Response.decision)" -ForegroundColor Green - } - } catch { - Write-Host " $Response" -ForegroundColor Green - } -} - -Write-Host "`n=== Testing AI Loan Agent ===" -ForegroundColor Cyan -Write-Host "Resource Group: $ResourceGroupName" -Write-Host "Logic App: $LogicAppName" -Write-Host "Workflow: $WorkflowName`n" - -# Get workflow callback URL -Write-Host "Getting workflow callback URL..." -ForegroundColor Yellow -$subscriptionId = (Get-AzContext).Subscription.Id - -try { - $tokenObj = Get-AzAccessToken -ResourceUrl "https://management.azure.com" - - # Handle both SecureString (Az 14.x) and plain text (Az 13.x) - if ($tokenObj.Token -is [System.Security.SecureString]) { - $ssPtr = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($tokenObj.Token) - try { - $token = [System.Runtime.InteropServices.Marshal]::PtrToStringBSTR($ssPtr) - } finally { - [System.Runtime.InteropServices.Marshal]::ZeroFreeBSTR($ssPtr) - } - } else { - $token = $tokenObj.Token - } - - $uri = "https://management.azure.com/subscriptions/$subscriptionId/resourceGroups/$ResourceGroupName/providers/Microsoft.Web/sites/$LogicAppName/hostruntime/runtime/webhooks/workflow/api/management/workflows/$WorkflowName/triggers/manual/listCallbackUrl?api-version=2023-12-01" - - $headers = @{ - "Authorization" = "Bearer $token" - "Content-Type" = "application/json" - } - - $response = Invoke-RestMethod -Method Post -Uri $uri -Headers $headers - $callbackUrl = $response.value - - if ([string]::IsNullOrEmpty($callbackUrl)) { - throw "Callback URL is empty" - } - - Write-Host "✓ Callback URL retrieved" -ForegroundColor Green -} catch { - Write-Host "✗ Failed to get callback URL: $_" -ForegroundColor Red - Write-Host "`nTroubleshooting:" -ForegroundColor Yellow - Write-Host "1. Verify workflows are deployed to Logic App" - Write-Host "2. Check workflow name is correct: $WorkflowName" - Write-Host "3. Ensure you're logged into Azure: Connect-AzAccount" - exit 1 -} - -# Test Case 1: Auto-Approval (High credit, standard vehicle, within limits) -Write-Host "\n--- Test Case 1: Auto-Approval Scenario ---" -ForegroundColor Cyan -$payload1 = @{ - applicationId = "APP-AUTO-APPROVE-001" - name = "Applicant A" - email = "applicant.a@example.com" - loanAmount = 25000 - vehicleMake = "Toyota" - vehicleModel = "Camry" - salary = 75000 - employmentYears = 5 - creditScore = 780 - bankruptcies = 0 -} | ConvertTo-Json - -try { - $result1 = Invoke-RestMethod -Method Post -Uri $callbackUrl -Body $payload1 -ContentType "application/json" - Write-Host "✓ Test Case 1 Submitted" -ForegroundColor Green - Show-AgentResponse -CaseName "Test Case 1" -Response $result1 -} catch { - Write-Host "✗ Test Case 1 Failed: $_" -ForegroundColor Red -} -Start-Sleep -Seconds 15 - -# Test Case 2: Human Review Required (Exceeds loan limit, good credit) -Write-Host "\n--- Test Case 2: Human Review Scenario ---" -ForegroundColor Cyan -$payload2 = @{ - applicationId = "APP-REVIEW-REQUIRED-002" - name = "Applicant B" - email = "applicant.b@example.com" - loanAmount = 55000 - vehicleMake = "BMW" - vehicleModel = "X5" - salary = 95000 - employmentYears = 3 - creditScore = 720 - bankruptcies = 0 -} | ConvertTo-Json - -try { - $result2 = Invoke-RestMethod -Method Post -Uri $callbackUrl -Body $payload2 -ContentType "application/json" - Write-Host "✓ Test Case 2 Submitted" -ForegroundColor Green - Show-AgentResponse -CaseName "Test Case 2" -Response $result2 -} catch { - Write-Host "✗ Test Case 2 Failed: $_" -ForegroundColor Red -} -Start-Sleep -Seconds 15 - -# Test Case 3: Auto-Rejection (Poor credit + bankruptcy) -Write-Host "\n--- Test Case 3: Auto-Rejection Scenario ---" -ForegroundColor Cyan -$payload3 = @{ - applicationId = "APP-AUTO-REJECT-003" - name = "Applicant C" - email = "applicant.c@example.com" - loanAmount = 30000 - vehicleMake = "Honda" - vehicleModel = "Accord" - salary = 45000 - employmentYears = 0.5 - creditScore = 580 - bankruptcies = 1 -} | ConvertTo-Json - -try { - $result3 = Invoke-RestMethod -Method Post -Uri $callbackUrl -Body $payload3 -ContentType "application/json" - Write-Host "✓ Test Case 3 Submitted" -ForegroundColor Green - Show-AgentResponse -CaseName "Test Case 3" -Response $result3 -} catch { - Write-Host "✗ Test Case 3 Failed: $_" -ForegroundColor Red -} -Start-Sleep -Seconds 15 - -# Test Case 4: Luxury Vehicle Review (Excellent credit but exotic vehicle) -Write-Host "\n--- Test Case 4: Luxury Vehicle Review Scenario ---" -ForegroundColor Cyan -$payload4 = @{ - applicationId = "APP-LUXURY-REVIEW-004" - name = "Applicant D" - email = "applicant.d@example.com" - loanAmount = 80000 - vehicleMake = "Ferrari" - vehicleModel = "F8 Tributo" - salary = 120000 - employmentYears = 4 - creditScore = 750 - bankruptcies = 0 -} | ConvertTo-Json - -try { - $result4 = Invoke-RestMethod -Method Post -Uri $callbackUrl -Body $payload4 -ContentType "application/json" - Write-Host "✓ Test Case 4 Submitted" -ForegroundColor Green - Show-AgentResponse -CaseName "Test Case 4" -Response $result4 -} catch { - Write-Host "✗ Test Case 4 Failed: $_" -ForegroundColor Red -} - -# Summary -Write-Host "`n=== Testing Complete ===" -ForegroundColor Cyan -Write-Host "`nTest Results Summary:" -ForegroundColor Yellow -Write-Host " Test Case 1 (Auto-Approval): Excellent applicant → Expected: APPROVED" -Write-Host " Test Case 2 (Human Review): Borderline case → Expected: Simulated decision" -Write-Host " Test Case 3 (Auto-Rejection): Poor credit + bankruptcy → Expected: REJECTED" -Write-Host " Test Case 4 (Luxury Vehicle): Special vehicle → Expected: Human review" - -Write-Host "`n📊 View in Azure Portal:" -ForegroundColor Cyan -Write-Host "https://portal.azure.com/#@/resource/subscriptions/$subscriptionId/resourceGroups/$ResourceGroupName/providers/Microsoft.Web/sites/$LogicAppName/logicApp" - -Write-Host "`n💡 Note: Human approval is currently simulated. See README for Teams integration." -ForegroundColor Gray diff --git a/samples/ai-loan-agent-sample/Deployment/workflows.zip b/samples/ai-loan-agent-sample/Deployment/workflows.zip new file mode 100644 index 0000000..ec7a338 Binary files /dev/null and b/samples/ai-loan-agent-sample/Deployment/workflows.zip differ diff --git a/samples/ai-loan-agent-sample/LogicApps/LoanApprovalAgent/workflow.json b/samples/ai-loan-agent-sample/LogicApps/LoanApprovalAgent/workflow.json index db189c5..5f3039c 100644 --- a/samples/ai-loan-agent-sample/LogicApps/LoanApprovalAgent/workflow.json +++ b/samples/ai-loan-agent-sample/LogicApps/LoanApprovalAgent/workflow.json @@ -6,7 +6,7 @@ "type": "Agent", "inputs": { "parameters": { - "deploymentId": "gpt-4.1-mini", + "deploymentId": "gpt-5-mini", "messages": [ { "role": "system", @@ -20,9 +20,9 @@ "agentModelType": "AzureOpenAI", "agentModelSettings": { "deploymentModelProperties": { - "name": "gpt-4.1-mini", + "name": "gpt-5-mini", "format": "OpenAI", - "version": "2025-04-14" + "version": "2025-08-07" } } }, diff --git a/samples/ai-loan-agent-sample/LogicApps/README.md b/samples/ai-loan-agent-sample/LogicApps/README.md index 2dd3290..ea45209 100644 --- a/samples/ai-loan-agent-sample/LogicApps/README.md +++ b/samples/ai-loan-agent-sample/LogicApps/README.md @@ -172,7 +172,7 @@ Your completed `local.settings.json` should look similar to this: - Verify the endpoint URL is correct and includes `https://` - Ensure the endpoint URL ends with a trailing slash (`/`) - Check that the resource ID matches your Azure OpenAI resource exactly -- Verify your Azure OpenAI deployment has the `gpt-4.1-mini` model deployed +- Verify your Azure OpenAI deployment has the `gpt-5-mini` model deployed **Runtime Issues:** - Verify .NET 8 SDK is installed diff --git a/samples/ai-loan-agent-sample/README.md b/samples/ai-loan-agent-sample/README.md index ed16491..bf82a8d 100644 --- a/samples/ai-loan-agent-sample/README.md +++ b/samples/ai-loan-agent-sample/README.md @@ -10,12 +10,11 @@ An AI-powered loan approval system that automates the evaluation of vehicle loan **Prerequisites:** - Azure subscription with contributor access -- Region supporting Azure OpenAI (GPT-4.1-mini) and Logic Apps Standard - see [region selection](#region-selection) +- Region supporting Azure OpenAI (GPT-5-mini) and Logic Apps Standard - see [region selection](#region-selection) **Deploy to your Azure subscription:** -[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fmodularity%2Flogicapps-labs%2Frefs%2Fheads%2Floan-agent-deployment%2Fsamples%2Fai-loan-agent-sample%2F1ClickDeploy%2Fsample-arm.json) - +[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Flogicapps-labs%2Fmain%2Fsamples%2Fai-loan-agent-sample%2FDeployment%2Fsample-arm.json)
What happens when you deploy @@ -32,7 +31,7 @@ An AI-powered loan approval system that automates the evaluation of vehicle loan | Resource | Purpose | |----------|----------| | Logic App Standard | Hosts AI agent workflows | -| Azure OpenAI | GPT-4.1-mini model for agent reasoning | +| Azure OpenAI | GPT-5-mini model for agent reasoning | | Storage Account | Workflow state and run history | | App Service Plan | Compute resources | | Managed Identity | Passwordless authentication | diff --git a/samples/json-remediation-agent/Deployment/main.bicep b/samples/json-remediation-agent/Deployment/main.bicep index 9ea587d..639e569 100644 --- a/samples/json-remediation-agent/Deployment/main.bicep +++ b/samples/json-remediation-agent/Deployment/main.bicep @@ -1,8 +1,8 @@ // Auto-generated from shared/templates/main.bicep.template // To customize: edit this file directly or delete to regenerate from template // -// JSON Remediation Agent - Azure Infrastructure as Code -// Deploys Logic Apps Standard with Azure OpenAI for autonomous JSON repair and validation +// Logic Apps Agent Sample - Azure Infrastructure as Code +// Deploys Logic Apps Standard with Azure OpenAI for autonomous agent workflows // Uses managed identity exclusively (no secrets/connection strings) targetScope = 'resourceGroup' @@ -15,8 +15,8 @@ param BaseName string // uniqueSuffix for when we need unique values var uniqueSuffix = uniqueString(resourceGroup().id) -// URL to workflows.zip (replaced by BundleAssets.ps1 with https://raw.githubusercontent.com/modularity/logicapps-labs/json-remediation-agent/samples/json-remediation-agent/Deployment/workflows.zip) -var workflowsZipUrl = 'https://raw.githubusercontent.com/modularity/logicapps-labs/json-remediation-agent/samples/json-remediation-agent/Deployment/workflows.zip' +// URL to workflows.zip (replaced by BundleAssets.ps1 with https://raw.githubusercontent.com/Azure/logicapps-labs/main/samples/json-remediation-agent/Deployment/workflows.zip) +var workflowsZipUrl = 'https://raw.githubusercontent.com/Azure/logicapps-labs/main/samples/json-remediation-agent/Deployment/workflows.zip' // User-Assigned Managed Identity for Logic App → Storage authentication resource userAssignedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = { @@ -33,7 +33,7 @@ module storage '../../shared/modules/storage.bicep' = { } } -// Azure OpenAI with gpt-4o-mini model +// Azure OpenAI with gpt-5-mini model module openai '../../shared/modules/openai.bicep' = { name: '${take(BaseName, 44)}-openai-deployment' params: { diff --git a/samples/json-remediation-agent/Deployment/sample-arm.json b/samples/json-remediation-agent/Deployment/sample-arm.json index e72327d..82c0726 100644 --- a/samples/json-remediation-agent/Deployment/sample-arm.json +++ b/samples/json-remediation-agent/Deployment/sample-arm.json @@ -4,8 +4,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "5488634814907059008" + "version": "0.39.26.7824", + "templateHash": "13273151993006358318" } }, "parameters": { @@ -20,7 +20,7 @@ }, "variables": { "uniqueSuffix": "[uniqueString(resourceGroup().id)]", - "workflowsZipUrl": "https://raw.githubusercontent.com/modularity/logicapps-labs/json-remediation-agent/samples/json-remediation-agent/Deployment/workflows.zip" + "workflowsZipUrl": "https://raw.githubusercontent.com/Azure/logicapps-labs/main/samples/json-remediation-agent/Deployment/workflows.zip" }, "resources": [ { @@ -31,7 +31,7 @@ }, { "type": "Microsoft.Resources/deployments", - "apiVersion": "2022-09-01", + "apiVersion": "2025-04-01", "name": "[format('{0}-storage-deployment', take(parameters('BaseName'), 43))]", "properties": { "expressionEvaluationOptions": { @@ -52,8 +52,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "6666359930464991611" + "version": "0.39.26.7824", + "templateHash": "11906848055003519521" } }, "parameters": { @@ -115,7 +115,7 @@ }, { "type": "Microsoft.Resources/deployments", - "apiVersion": "2022-09-01", + "apiVersion": "2025-04-01", "name": "[format('{0}-openai-deployment', take(parameters('BaseName'), 44))]", "properties": { "expressionEvaluationOptions": { @@ -136,8 +136,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "5370603553016721570" + "version": "0.39.26.7824", + "templateHash": "6448475993981052673" } }, "parameters": { @@ -172,7 +172,7 @@ { "type": "Microsoft.CognitiveServices/accounts/deployments", "apiVersion": "2024-10-01", - "name": "[format('{0}/{1}', parameters('openAIName'), 'gpt-4o-mini')]", + "name": "[format('{0}/{1}', parameters('openAIName'), 'gpt-5-mini')]", "sku": { "name": "GlobalStandard", "capacity": 50 @@ -180,8 +180,8 @@ "properties": { "model": { "format": "OpenAI", - "name": "gpt-4o-mini", - "version": "2024-07-18" + "name": "gpt-5-mini", + "version": "2025-08-07" } }, "dependsOn": [ @@ -208,7 +208,7 @@ }, { "type": "Microsoft.Resources/deployments", - "apiVersion": "2022-09-01", + "apiVersion": "2025-04-01", "name": "[format('{0}-logicapp-deployment', take(parameters('BaseName'), 42))]", "properties": { "expressionEvaluationOptions": { @@ -223,13 +223,13 @@ "value": "[resourceGroup().location]" }, "storageAccountName": { - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-storage-deployment', take(parameters('BaseName'), 43))), '2022-09-01').outputs.storageAccountName.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-storage-deployment', take(parameters('BaseName'), 43))), '2025-04-01').outputs.storageAccountName.value]" }, "openAIEndpoint": { - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44))), '2022-09-01').outputs.endpoint.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44))), '2025-04-01').outputs.endpoint.value]" }, "openAIResourceId": { - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44))), '2022-09-01').outputs.resourceId.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44))), '2025-04-01').outputs.resourceId.value]" }, "managedIdentityId": { "value": "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', format('{0}-managedidentity', take(parameters('BaseName'), 60)))]" @@ -241,8 +241,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "2259432651138452624" + "version": "0.39.26.7824", + "templateHash": "3032492753694364828" } }, "parameters": { @@ -413,7 +413,7 @@ }, { "type": "Microsoft.Resources/deployments", - "apiVersion": "2022-09-01", + "apiVersion": "2025-04-01", "name": "[format('{0}-storage-rbac-deployment', take(parameters('BaseName'), 38))]", "properties": { "expressionEvaluationOptions": { @@ -422,7 +422,7 @@ "mode": "Incremental", "parameters": { "storageAccountName": { - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-storage-deployment', take(parameters('BaseName'), 43))), '2022-09-01').outputs.storageAccountName.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-storage-deployment', take(parameters('BaseName'), 43))), '2025-04-01').outputs.storageAccountName.value]" }, "logicAppPrincipalId": { "value": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', format('{0}-managedidentity', take(parameters('BaseName'), 60))), '2023-01-31').principalId]" @@ -434,8 +434,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "13372547588259048703" + "version": "0.39.26.7824", + "templateHash": "8000893445802246432" } }, "parameters": { @@ -497,7 +497,7 @@ }, { "type": "Microsoft.Resources/deployments", - "apiVersion": "2022-09-01", + "apiVersion": "2025-04-01", "name": "[format('{0}-openai-rbac-deployment', take(parameters('BaseName'), 39))]", "properties": { "expressionEvaluationOptions": { @@ -506,10 +506,10 @@ "mode": "Incremental", "parameters": { "openAIName": { - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44))), '2022-09-01').outputs.name.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44))), '2025-04-01').outputs.name.value]" }, "logicAppPrincipalId": { - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', take(parameters('BaseName'), 42))), '2022-09-01').outputs.systemAssignedPrincipalId.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', take(parameters('BaseName'), 42))), '2025-04-01').outputs.systemAssignedPrincipalId.value]" } }, "template": { @@ -518,8 +518,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "3822718305786172483" + "version": "0.39.26.7824", + "templateHash": "6926659019016520420" } }, "parameters": { @@ -567,7 +567,7 @@ }, { "type": "Microsoft.Resources/deployments", - "apiVersion": "2022-09-01", + "apiVersion": "2025-04-01", "name": "[format('{0}-workflow-deployment', take(parameters('BaseName'), 42))]", "properties": { "expressionEvaluationOptions": { @@ -588,7 +588,7 @@ "value": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', format('{0}-managedidentity', take(parameters('BaseName'), 60))), '2023-01-31').principalId]" }, "logicAppName": { - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', take(parameters('BaseName'), 42))), '2022-09-01').outputs.name.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', take(parameters('BaseName'), 42))), '2025-04-01').outputs.name.value]" }, "resourceGroupName": { "value": "[resourceGroup().name]" @@ -603,8 +603,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "6479226689635161201" + "version": "0.39.26.7824", + "templateHash": "2786599112922814163" } }, "parameters": { @@ -713,11 +713,11 @@ "outputs": { "logicAppName": { "type": "string", - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', take(parameters('BaseName'), 42))), '2022-09-01').outputs.name.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', take(parameters('BaseName'), 42))), '2025-04-01').outputs.name.value]" }, "openAIEndpoint": { "type": "string", - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44))), '2022-09-01').outputs.endpoint.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44))), '2025-04-01').outputs.endpoint.value]" } } } \ No newline at end of file diff --git a/samples/json-remediation-agent/Deployment/workflows.zip b/samples/json-remediation-agent/Deployment/workflows.zip index aa40c56..2520ba2 100644 Binary files a/samples/json-remediation-agent/Deployment/workflows.zip and b/samples/json-remediation-agent/Deployment/workflows.zip differ diff --git a/samples/json-remediation-agent/LogicApps/JsonRemediationAgent/workflow.json b/samples/json-remediation-agent/LogicApps/JsonRemediationAgent/workflow.json index b8c41f0..25a6552 100644 --- a/samples/json-remediation-agent/LogicApps/JsonRemediationAgent/workflow.json +++ b/samples/json-remediation-agent/LogicApps/JsonRemediationAgent/workflow.json @@ -14,7 +14,7 @@ "type": "Agent", "inputs": { "parameters": { - "deploymentId": "gpt-4o-mini", + "deploymentId": "gpt-5-mini", "messages": [ { "role": "system", @@ -28,9 +28,9 @@ "agentModelType": "AzureOpenAI", "agentModelSettings": { "deploymentModelProperties": { - "name": "gpt-4o-mini", + "name": "gpt-5-mini", "format": "OpenAI", - "version": "2024-07-18" + "version": "2025-08-07" } } }, diff --git a/samples/json-remediation-agent/README.md b/samples/json-remediation-agent/README.md index 07f24d0..92ec168 100644 --- a/samples/json-remediation-agent/README.md +++ b/samples/json-remediation-agent/README.md @@ -10,11 +10,11 @@ An autonomous operations agent that repairs malformed JSON records, applies dete **Prerequisites:** - Azure subscription with contributor access -- Region supporting Azure OpenAI (gpt-4o-mini) and Logic Apps Standard - see [region selection](#region-selection) +- Region supporting Azure OpenAI (gpt-5-mini) and Logic Apps Standard - see [region selection](#region-selection) **Deploy to your Azure subscription:** -[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fmodularity%2Flogicapps-labs%2Fjson-remediation-agent%2Fsamples%2Fjson-remediation-agent%2FDeployment%2Fsample-arm.json) +[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Flogicapps-labs%2Fmain%2Fsamples%2Fjson-remediation-agent%2FDeployment%2Fsample-arm.json)
What happens when you deploy @@ -32,7 +32,7 @@ An autonomous operations agent that repairs malformed JSON records, applies dete | Resource | Purpose | |----------|---------| | Logic App Standard | Hosts autonomous agent workflows | -| Azure OpenAI | gpt-4o-mini model for agent reasoning | +| Azure OpenAI | gpt-5-mini model for agent reasoning | | Storage Account | Workflow state and run history | | App Service Plan | Compute resources | | Managed Identity | Passwordless authentication | diff --git a/samples/product-return-agent-sample/Deployment/main.bicep b/samples/product-return-agent-sample/Deployment/main.bicep index d489101..eb56f0b 100644 --- a/samples/product-return-agent-sample/Deployment/main.bicep +++ b/samples/product-return-agent-sample/Deployment/main.bicep @@ -1,8 +1,8 @@ // Auto-generated from shared/templates/main.bicep.template // To customize: edit this file directly or delete to regenerate from template // -// AI Product Return Agent - Azure Infrastructure as Code -// Deploys Logic Apps Standard with Azure OpenAI for autonomous product return decisions +// Logic Apps Agent Sample - Azure Infrastructure as Code +// Deploys Logic Apps Standard with Azure OpenAI for autonomous agent workflows // Uses managed identity exclusively (no secrets/connection strings) targetScope = 'resourceGroup' @@ -15,8 +15,8 @@ param BaseName string // uniqueSuffix for when we need unique values var uniqueSuffix = uniqueString(resourceGroup().id) -// URL to workflows.zip (replaced by BundleAssets.ps1 with https://raw.githubusercontent.com/modularity/logicapps-labs/product-return-sample/samples/product-return-agent-sample/Deployment/workflows.zip) -var workflowsZipUrl = 'https://raw.githubusercontent.com/modularity/logicapps-labs/product-return-sample/samples/product-return-agent-sample/Deployment/workflows.zip' +// URL to workflows.zip (replaced by BundleAssets.ps1 with https://raw.githubusercontent.com/Azure/logicapps-labs/main/samples/product-return-agent-sample/Deployment/workflows.zip) +var workflowsZipUrl = 'https://raw.githubusercontent.com/Azure/logicapps-labs/main/samples/product-return-agent-sample/Deployment/workflows.zip' // User-Assigned Managed Identity for Logic App → Storage authentication resource userAssignedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = { @@ -33,7 +33,7 @@ module storage '../../shared/modules/storage.bicep' = { } } -// Azure OpenAI with gpt-4o-mini model +// Azure OpenAI with gpt-5-mini model module openai '../../shared/modules/openai.bicep' = { name: '${take(BaseName, 44)}-openai-deployment' params: { diff --git a/samples/product-return-agent-sample/Deployment/sample-arm.json b/samples/product-return-agent-sample/Deployment/sample-arm.json index 66e9756..8e46af9 100644 --- a/samples/product-return-agent-sample/Deployment/sample-arm.json +++ b/samples/product-return-agent-sample/Deployment/sample-arm.json @@ -4,8 +4,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "7356318468140071735" + "version": "0.39.26.7824", + "templateHash": "201964466856650430" } }, "parameters": { @@ -20,7 +20,7 @@ }, "variables": { "uniqueSuffix": "[uniqueString(resourceGroup().id)]", - "workflowsZipUrl": "https://raw.githubusercontent.com/modularity/logicapps-labs/product-return-sample/samples/product-return-agent-sample/Deployment/workflows.zip" + "workflowsZipUrl": "https://raw.githubusercontent.com/Azure/logicapps-labs/main/samples/product-return-agent-sample/Deployment/workflows.zip" }, "resources": [ { @@ -31,7 +31,7 @@ }, { "type": "Microsoft.Resources/deployments", - "apiVersion": "2022-09-01", + "apiVersion": "2025-04-01", "name": "[format('{0}-storage-deployment', take(parameters('BaseName'), 43))]", "properties": { "expressionEvaluationOptions": { @@ -52,8 +52,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "6666359930464991611" + "version": "0.39.26.7824", + "templateHash": "11906848055003519521" } }, "parameters": { @@ -115,7 +115,7 @@ }, { "type": "Microsoft.Resources/deployments", - "apiVersion": "2022-09-01", + "apiVersion": "2025-04-01", "name": "[format('{0}-openai-deployment', take(parameters('BaseName'), 44))]", "properties": { "expressionEvaluationOptions": { @@ -136,8 +136,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "5370603553016721570" + "version": "0.39.26.7824", + "templateHash": "6448475993981052673" } }, "parameters": { @@ -172,7 +172,7 @@ { "type": "Microsoft.CognitiveServices/accounts/deployments", "apiVersion": "2024-10-01", - "name": "[format('{0}/{1}', parameters('openAIName'), 'gpt-4o-mini')]", + "name": "[format('{0}/{1}', parameters('openAIName'), 'gpt-5-mini')]", "sku": { "name": "GlobalStandard", "capacity": 50 @@ -180,8 +180,8 @@ "properties": { "model": { "format": "OpenAI", - "name": "gpt-4o-mini", - "version": "2024-07-18" + "name": "gpt-5-mini", + "version": "2025-08-07" } }, "dependsOn": [ @@ -208,7 +208,7 @@ }, { "type": "Microsoft.Resources/deployments", - "apiVersion": "2022-09-01", + "apiVersion": "2025-04-01", "name": "[format('{0}-logicapp-deployment', take(parameters('BaseName'), 42))]", "properties": { "expressionEvaluationOptions": { @@ -223,13 +223,13 @@ "value": "[resourceGroup().location]" }, "storageAccountName": { - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-storage-deployment', take(parameters('BaseName'), 43))), '2022-09-01').outputs.storageAccountName.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-storage-deployment', take(parameters('BaseName'), 43))), '2025-04-01').outputs.storageAccountName.value]" }, "openAIEndpoint": { - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44))), '2022-09-01').outputs.endpoint.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44))), '2025-04-01').outputs.endpoint.value]" }, "openAIResourceId": { - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44))), '2022-09-01').outputs.resourceId.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44))), '2025-04-01').outputs.resourceId.value]" }, "managedIdentityId": { "value": "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', format('{0}-managedidentity', take(parameters('BaseName'), 60)))]" @@ -241,8 +241,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "2259432651138452624" + "version": "0.39.26.7824", + "templateHash": "3032492753694364828" } }, "parameters": { @@ -413,7 +413,7 @@ }, { "type": "Microsoft.Resources/deployments", - "apiVersion": "2022-09-01", + "apiVersion": "2025-04-01", "name": "[format('{0}-storage-rbac-deployment', take(parameters('BaseName'), 38))]", "properties": { "expressionEvaluationOptions": { @@ -422,7 +422,7 @@ "mode": "Incremental", "parameters": { "storageAccountName": { - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-storage-deployment', take(parameters('BaseName'), 43))), '2022-09-01').outputs.storageAccountName.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-storage-deployment', take(parameters('BaseName'), 43))), '2025-04-01').outputs.storageAccountName.value]" }, "logicAppPrincipalId": { "value": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', format('{0}-managedidentity', take(parameters('BaseName'), 60))), '2023-01-31').principalId]" @@ -434,8 +434,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "13372547588259048703" + "version": "0.39.26.7824", + "templateHash": "8000893445802246432" } }, "parameters": { @@ -497,7 +497,7 @@ }, { "type": "Microsoft.Resources/deployments", - "apiVersion": "2022-09-01", + "apiVersion": "2025-04-01", "name": "[format('{0}-openai-rbac-deployment', take(parameters('BaseName'), 39))]", "properties": { "expressionEvaluationOptions": { @@ -506,10 +506,10 @@ "mode": "Incremental", "parameters": { "openAIName": { - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44))), '2022-09-01').outputs.name.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44))), '2025-04-01').outputs.name.value]" }, "logicAppPrincipalId": { - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', take(parameters('BaseName'), 42))), '2022-09-01').outputs.systemAssignedPrincipalId.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', take(parameters('BaseName'), 42))), '2025-04-01').outputs.systemAssignedPrincipalId.value]" } }, "template": { @@ -518,8 +518,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "3822718305786172483" + "version": "0.39.26.7824", + "templateHash": "6926659019016520420" } }, "parameters": { @@ -567,7 +567,7 @@ }, { "type": "Microsoft.Resources/deployments", - "apiVersion": "2022-09-01", + "apiVersion": "2025-04-01", "name": "[format('{0}-workflow-deployment', take(parameters('BaseName'), 42))]", "properties": { "expressionEvaluationOptions": { @@ -588,7 +588,7 @@ "value": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', format('{0}-managedidentity', take(parameters('BaseName'), 60))), '2023-01-31').principalId]" }, "logicAppName": { - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', take(parameters('BaseName'), 42))), '2022-09-01').outputs.name.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', take(parameters('BaseName'), 42))), '2025-04-01').outputs.name.value]" }, "resourceGroupName": { "value": "[resourceGroup().name]" @@ -603,8 +603,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "6479226689635161201" + "version": "0.39.26.7824", + "templateHash": "2786599112922814163" } }, "parameters": { @@ -713,11 +713,11 @@ "outputs": { "logicAppName": { "type": "string", - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', take(parameters('BaseName'), 42))), '2022-09-01').outputs.name.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', take(parameters('BaseName'), 42))), '2025-04-01').outputs.name.value]" }, "openAIEndpoint": { "type": "string", - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44))), '2022-09-01').outputs.endpoint.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44))), '2025-04-01').outputs.endpoint.value]" } } } \ No newline at end of file diff --git a/samples/product-return-agent-sample/Deployment/workflows.zip b/samples/product-return-agent-sample/Deployment/workflows.zip index 86b4fa1..bafffcd 100644 Binary files a/samples/product-return-agent-sample/Deployment/workflows.zip and b/samples/product-return-agent-sample/Deployment/workflows.zip differ diff --git a/samples/product-return-agent-sample/LogicApps/ProductReturnAgent/workflow.json b/samples/product-return-agent-sample/LogicApps/ProductReturnAgent/workflow.json index 871c3a8..14caaf1 100644 --- a/samples/product-return-agent-sample/LogicApps/ProductReturnAgent/workflow.json +++ b/samples/product-return-agent-sample/LogicApps/ProductReturnAgent/workflow.json @@ -6,7 +6,7 @@ "type": "Agent", "inputs": { "parameters": { - "deploymentId": "gpt-4o-mini", + "deploymentId": "gpt-5-mini", "messages": [ { "role": "system", @@ -20,9 +20,9 @@ "agentModelType": "AzureOpenAI", "agentModelSettings": { "deploymentModelProperties": { - "name": "gpt-4o-mini", + "name": "gpt-5-mini", "format": "OpenAI", - "version": "2024-07-18" + "version": "2025-08-07" } } }, diff --git a/samples/product-return-agent-sample/LogicApps/README.md b/samples/product-return-agent-sample/LogicApps/README.md index b5cbe8a..f1427f6 100644 --- a/samples/product-return-agent-sample/LogicApps/README.md +++ b/samples/product-return-agent-sample/LogicApps/README.md @@ -64,11 +64,11 @@ These workflows are automatically deployed when using the 1-click deployment. Fo ## Agent Configuration -The ProductReturnAgent workflow uses Azure OpenAI GPT-4o-mini model with these settings: +The ProductReturnAgent workflow uses Azure OpenAI GPT-5-mini model with these settings: - **System prompt:** Instructs agent to call one tool per turn in sequence - **Tools:** 5 tools for policy, orders, customer status, refund calculation, and escalation -- **Model:** gpt-4o-mini (version 2024-07-18) +- **Model:** gpt-5-mini (version 2025-08-07) - **Authentication:** Managed Identity (no API keys required) See the [main README](../README.md) for more details on testing and extending the workflows. diff --git a/samples/product-return-agent-sample/README.md b/samples/product-return-agent-sample/README.md index 1de672a..6634f2b 100644 --- a/samples/product-return-agent-sample/README.md +++ b/samples/product-return-agent-sample/README.md @@ -10,11 +10,11 @@ An AI-powered product return system that automates the evaluation of return requ **Prerequisites:** - Azure subscription with contributor access -- Region supporting Azure OpenAI (GPT-4o-mini) and Logic Apps Standard - see [region selection](#region-selection) +- Region supporting Azure OpenAI (GPT-5-mini) and Logic Apps Standard - see [region selection](#region-selection) **Deploy to your Azure subscription:** -[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fmodularity%2Flogicapps-labs%2Fproduct-return-sample%2Fsamples%2Fproduct-return-agent-sample%2FDeployment%2Fsample-arm.json) +[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Flogicapps-labs%2Fmain%2Fsamples%2Fproduct-return-agent-sample%2FDeployment%2Fsample-arm.json)
What happens when you deploy @@ -32,7 +32,7 @@ An AI-powered product return system that automates the evaluation of return requ | Resource | Purpose | |----------|----------| | Logic App Standard | Hosts AI agent workflows | -| Azure OpenAI | GPT-4o-mini model for agent reasoning | +| Azure OpenAI | GPT-5-mini model for agent reasoning | | Storage Account | Workflow state and run history | | App Service Plan | Compute resources | | Managed Identity | Passwordless authentication | diff --git a/samples/shared/README.md b/samples/shared/README.md index 45d1576..e9001e6 100644 --- a/samples/shared/README.md +++ b/samples/shared/README.md @@ -54,7 +54,7 @@ Six reusable modules provide complete Logic Apps infrastructure: | Module | Purpose | |--------|---------| | **storage.bicep** | Storage Account for Logic App runtime (managed identity only, HTTPS/TLS 1.2, no shared keys) | -| **openai.bicep** | Azure OpenAI S0 with gpt-4o-mini model (GlobalStandard, 150K tokens) | +| **openai.bicep** | Azure OpenAI S0 with gpt-5-mini model (GlobalStandard, 150K tokens) | | **logicapp.bicep** | Logic App Standard with App Service Plan (WS1 SKU, system + user-assigned identities) | | **storage-rbac.bicep** | Storage Blob/Queue/Table Data Contributor roles for Logic App | | **openai-rbac.bicep** | Cognitive Services OpenAI User role for Logic App | @@ -65,7 +65,11 @@ Six reusable modules provide complete Logic Apps infrastructure: Generates all deployment artifacts for a sample: ```powershell +# Basic usage .\samples\shared\scripts\BundleAssets.ps1 -Sample "your-sample-name" + +# Force regeneration of main.bicep (overwrites existing file) +.\samples\shared\scripts\BundleAssets.ps1 -Sample "your-sample-name" -Force ``` **Generates:** @@ -73,9 +77,13 @@ Generates all deployment artifacts for a sample: 2. `sample-arm.json` - Compiled ARM template 3. `workflows.zip` - Bundled LogicApps folder +**Parameters:** +- `-Sample` (required) - Name of the sample folder +- `-Force` (optional) - Regenerates main.bicep even if it exists (useful for updating URLs) + **How it works:** - Uses hardcoded `Azure/logicapps-labs` main branch for upstream URLs -- Never overwrites existing `main.bicep` (delete to regenerate) +- Preserves existing `main.bicep` unless `-Force` is specified - Replaces `{{WORKFLOWS_ZIP_URL}}` template placeholder with upstream URL - Requires Bicep CLI and PowerShell 5.1+ diff --git a/samples/shared/modules/openai.bicep b/samples/shared/modules/openai.bicep index e501a93..196a030 100644 --- a/samples/shared/modules/openai.bicep +++ b/samples/shared/modules/openai.bicep @@ -21,7 +21,7 @@ resource openAI 'Microsoft.CognitiveServices/accounts@2024-10-01' = { resource deployment 'Microsoft.CognitiveServices/accounts/deployments@2024-10-01' = { parent: openAI - name: 'gpt-4o-mini' + name: 'gpt-5-mini' sku: { name: 'GlobalStandard' capacity: 50 @@ -29,8 +29,8 @@ resource deployment 'Microsoft.CognitiveServices/accounts/deployments@2024-10-01 properties: { model: { format: 'OpenAI' - name: 'gpt-4o-mini' - version: '2024-07-18' + name: 'gpt-5-mini' + version: '2025-08-07' } } } diff --git a/samples/shared/scripts/BundleAssets.ps1 b/samples/shared/scripts/BundleAssets.ps1 index b39c290..be159cf 100644 --- a/samples/shared/scripts/BundleAssets.ps1 +++ b/samples/shared/scripts/BundleAssets.ps1 @@ -20,6 +20,10 @@ Required. Name of the sample folder (e.g., "product-return-agent-sample"). All paths are built from this parameter. +.PARAMETER Force + Optional. Forces regeneration of main.bicep even if it already exists. + Use this to update the workflowsZipUrl or reset to template defaults. + .EXAMPLE # From anywhere in the repository: .\samples\shared\scripts\BundleAssets.ps1 -Sample "product-return-agent-sample" @@ -28,6 +32,10 @@ # From samples folder: .\shared\scripts\BundleAssets.ps1 -Sample "ai-loan-agent-sample" +.EXAMPLE + # Force regeneration of main.bicep: + .\samples\shared\scripts\BundleAssets.ps1 -Sample "product-return-agent-sample" -Force + .NOTES Requirements: - Bicep CLI must be installed @@ -45,7 +53,10 @@ [CmdletBinding()] param( [Parameter(Mandatory = $true)] - [string]$Sample + [string]$Sample, + + [Parameter(Mandatory = $false)] + [switch]$Force ) $ErrorActionPreference = "Stop" @@ -147,8 +158,12 @@ if (-not (Test-Path $deploymentFolder)) { # TEMPLATE GENERATION: Create main.bicep if it doesn't exist # ============================================================================ -if (-not (Test-Path $bicepPath)) { - Write-Host "`nGenerating main.bicep from template..." -ForegroundColor Cyan +if (-not (Test-Path $bicepPath) -or $Force) { + if ($Force -and (Test-Path $bicepPath)) { + Write-Host "`nRegenerating main.bicep (forced overwrite)..." -ForegroundColor Cyan + } else { + Write-Host "`nGenerating main.bicep from template..." -ForegroundColor Cyan + } # Use hardcoded upstream repo for URL generation $workflowsUrl = "https://raw.githubusercontent.com/$upstreamRepo/$upstreamBranch/samples/$Sample/Deployment/workflows.zip" @@ -165,7 +180,11 @@ if (-not (Test-Path $bicepPath)) { try { New-MainBicepFromTemplate -TemplatePath $templatePath -OutputPath $bicepPath -WorkflowsZipUrl $workflowsUrl - Write-Host " ✓ Created: main.bicep" -ForegroundColor Green + if ($Force) { + Write-Host " ✓ Regenerated: main.bicep" -ForegroundColor Green + } else { + Write-Host " ✓ Created: main.bicep" -ForegroundColor Green + } Write-Host " Location: $bicepPath" -ForegroundColor Gray } catch { Write-Host "✗ Failed to generate main.bicep: $($_.Exception.Message)" -ForegroundColor Red @@ -173,6 +192,7 @@ if (-not (Test-Path $bicepPath)) { } } else { Write-Host "`nUsing existing main.bicep (not overwriting)" -ForegroundColor Cyan + Write-Host " Tip: Use -Force to regenerate" -ForegroundColor Gray Write-Host " Location: $bicepPath" -ForegroundColor Gray } diff --git a/samples/shared/templates/main.bicep.template b/samples/shared/templates/main.bicep.template index 73ef27a..2cd7e77 100644 --- a/samples/shared/templates/main.bicep.template +++ b/samples/shared/templates/main.bicep.template @@ -33,7 +33,7 @@ module storage '../../shared/modules/storage.bicep' = { } } -// Azure OpenAI with gpt-4o-mini model +// Azure OpenAI with gpt-5-mini model module openai '../../shared/modules/openai.bicep' = { name: '${take(BaseName, 44)}-openai-deployment' params: { diff --git a/samples/transaction-repair-agent/Deployment/main.bicep b/samples/transaction-repair-agent/Deployment/main.bicep index cab0011..65b91dd 100644 --- a/samples/transaction-repair-agent/Deployment/main.bicep +++ b/samples/transaction-repair-agent/Deployment/main.bicep @@ -1,8 +1,8 @@ // Auto-generated from shared/templates/main.bicep.template // To customize: edit this file directly or delete to regenerate from template // -// Transaction Repair Agent - Azure Infrastructure as Code -// Deploys Logic Apps Standard with Azure OpenAI for conversational operations agent +// Logic Apps Agent Sample - Azure Infrastructure as Code +// Deploys Logic Apps Standard with Azure OpenAI for autonomous agent workflows // Uses managed identity exclusively (no secrets/connection strings) targetScope = 'resourceGroup' @@ -15,8 +15,8 @@ param BaseName string // uniqueSuffix for when we need unique values var uniqueSuffix = uniqueString(resourceGroup().id) -// URL to workflows.zip (replaced by BundleAssets.ps1 with actual GitHub URL) -var workflowsZipUrl = 'https://raw.githubusercontent.com/modularity/logicapps-labs/transaction-repair-agent/samples/transaction-repair-agent/Deployment/workflows.zip' +// URL to workflows.zip (replaced by BundleAssets.ps1 with https://raw.githubusercontent.com/Azure/logicapps-labs/main/samples/transaction-repair-agent/Deployment/workflows.zip) +var workflowsZipUrl = 'https://raw.githubusercontent.com/Azure/logicapps-labs/main/samples/transaction-repair-agent/Deployment/workflows.zip' // User-Assigned Managed Identity for Logic App → Storage authentication resource userAssignedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = { @@ -33,7 +33,7 @@ module storage '../../shared/modules/storage.bicep' = { } } -// Azure OpenAI with gpt-4o-mini model +// Azure OpenAI with gpt-5-mini model module openai '../../shared/modules/openai.bicep' = { name: '${take(BaseName, 44)}-openai-deployment' params: { diff --git a/samples/transaction-repair-agent/Deployment/sample-arm.json b/samples/transaction-repair-agent/Deployment/sample-arm.json index c17d9e2..3aa4522 100644 --- a/samples/transaction-repair-agent/Deployment/sample-arm.json +++ b/samples/transaction-repair-agent/Deployment/sample-arm.json @@ -4,8 +4,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "5815924213456264593" + "version": "0.39.26.7824", + "templateHash": "14173145213104767533" } }, "parameters": { @@ -20,7 +20,7 @@ }, "variables": { "uniqueSuffix": "[uniqueString(resourceGroup().id)]", - "workflowsZipUrl": "https://raw.githubusercontent.com/modularity/logicapps-labs/transaction-repair-agent/samples/transaction-repair-agent/Deployment/workflows.zip" + "workflowsZipUrl": "https://raw.githubusercontent.com/Azure/logicapps-labs/main/samples/transaction-repair-agent/Deployment/workflows.zip" }, "resources": [ { @@ -31,7 +31,7 @@ }, { "type": "Microsoft.Resources/deployments", - "apiVersion": "2022-09-01", + "apiVersion": "2025-04-01", "name": "[format('{0}-storage-deployment', take(parameters('BaseName'), 43))]", "properties": { "expressionEvaluationOptions": { @@ -52,8 +52,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "6666359930464991611" + "version": "0.39.26.7824", + "templateHash": "11906848055003519521" } }, "parameters": { @@ -115,7 +115,7 @@ }, { "type": "Microsoft.Resources/deployments", - "apiVersion": "2022-09-01", + "apiVersion": "2025-04-01", "name": "[format('{0}-openai-deployment', take(parameters('BaseName'), 44))]", "properties": { "expressionEvaluationOptions": { @@ -136,8 +136,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "5370603553016721570" + "version": "0.39.26.7824", + "templateHash": "6448475993981052673" } }, "parameters": { @@ -172,7 +172,7 @@ { "type": "Microsoft.CognitiveServices/accounts/deployments", "apiVersion": "2024-10-01", - "name": "[format('{0}/{1}', parameters('openAIName'), 'gpt-4o-mini')]", + "name": "[format('{0}/{1}', parameters('openAIName'), 'gpt-5-mini')]", "sku": { "name": "GlobalStandard", "capacity": 50 @@ -180,8 +180,8 @@ "properties": { "model": { "format": "OpenAI", - "name": "gpt-4o-mini", - "version": "2024-07-18" + "name": "gpt-5-mini", + "version": "2025-08-07" } }, "dependsOn": [ @@ -208,7 +208,7 @@ }, { "type": "Microsoft.Resources/deployments", - "apiVersion": "2022-09-01", + "apiVersion": "2025-04-01", "name": "[format('{0}-logicapp-deployment', take(parameters('BaseName'), 42))]", "properties": { "expressionEvaluationOptions": { @@ -223,13 +223,13 @@ "value": "[resourceGroup().location]" }, "storageAccountName": { - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-storage-deployment', take(parameters('BaseName'), 43))), '2022-09-01').outputs.storageAccountName.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-storage-deployment', take(parameters('BaseName'), 43))), '2025-04-01').outputs.storageAccountName.value]" }, "openAIEndpoint": { - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44))), '2022-09-01').outputs.endpoint.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44))), '2025-04-01').outputs.endpoint.value]" }, "openAIResourceId": { - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44))), '2022-09-01').outputs.resourceId.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44))), '2025-04-01').outputs.resourceId.value]" }, "managedIdentityId": { "value": "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', format('{0}-managedidentity', take(parameters('BaseName'), 60)))]" @@ -241,8 +241,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "2259432651138452624" + "version": "0.39.26.7824", + "templateHash": "3032492753694364828" } }, "parameters": { @@ -413,7 +413,7 @@ }, { "type": "Microsoft.Resources/deployments", - "apiVersion": "2022-09-01", + "apiVersion": "2025-04-01", "name": "[format('{0}-storage-rbac-deployment', take(parameters('BaseName'), 38))]", "properties": { "expressionEvaluationOptions": { @@ -422,7 +422,7 @@ "mode": "Incremental", "parameters": { "storageAccountName": { - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-storage-deployment', take(parameters('BaseName'), 43))), '2022-09-01').outputs.storageAccountName.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-storage-deployment', take(parameters('BaseName'), 43))), '2025-04-01').outputs.storageAccountName.value]" }, "logicAppPrincipalId": { "value": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', format('{0}-managedidentity', take(parameters('BaseName'), 60))), '2023-01-31').principalId]" @@ -434,8 +434,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "13372547588259048703" + "version": "0.39.26.7824", + "templateHash": "8000893445802246432" } }, "parameters": { @@ -497,7 +497,7 @@ }, { "type": "Microsoft.Resources/deployments", - "apiVersion": "2022-09-01", + "apiVersion": "2025-04-01", "name": "[format('{0}-openai-rbac-deployment', take(parameters('BaseName'), 39))]", "properties": { "expressionEvaluationOptions": { @@ -506,10 +506,10 @@ "mode": "Incremental", "parameters": { "openAIName": { - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44))), '2022-09-01').outputs.name.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44))), '2025-04-01').outputs.name.value]" }, "logicAppPrincipalId": { - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', take(parameters('BaseName'), 42))), '2022-09-01').outputs.systemAssignedPrincipalId.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', take(parameters('BaseName'), 42))), '2025-04-01').outputs.systemAssignedPrincipalId.value]" } }, "template": { @@ -518,8 +518,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "3822718305786172483" + "version": "0.39.26.7824", + "templateHash": "6926659019016520420" } }, "parameters": { @@ -567,7 +567,7 @@ }, { "type": "Microsoft.Resources/deployments", - "apiVersion": "2022-09-01", + "apiVersion": "2025-04-01", "name": "[format('{0}-workflow-deployment', take(parameters('BaseName'), 42))]", "properties": { "expressionEvaluationOptions": { @@ -588,7 +588,7 @@ "value": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', format('{0}-managedidentity', take(parameters('BaseName'), 60))), '2023-01-31').principalId]" }, "logicAppName": { - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', take(parameters('BaseName'), 42))), '2022-09-01').outputs.name.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', take(parameters('BaseName'), 42))), '2025-04-01').outputs.name.value]" }, "resourceGroupName": { "value": "[resourceGroup().name]" @@ -603,8 +603,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.34.44.8038", - "templateHash": "6479226689635161201" + "version": "0.39.26.7824", + "templateHash": "2786599112922814163" } }, "parameters": { @@ -713,11 +713,11 @@ "outputs": { "logicAppName": { "type": "string", - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', take(parameters('BaseName'), 42))), '2022-09-01').outputs.name.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-logicapp-deployment', take(parameters('BaseName'), 42))), '2025-04-01').outputs.name.value]" }, "openAIEndpoint": { "type": "string", - "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44))), '2022-09-01').outputs.endpoint.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-openai-deployment', take(parameters('BaseName'), 44))), '2025-04-01').outputs.endpoint.value]" } } } \ No newline at end of file diff --git a/samples/transaction-repair-agent/Deployment/workflows.zip b/samples/transaction-repair-agent/Deployment/workflows.zip index 4379654..9e3c380 100644 Binary files a/samples/transaction-repair-agent/Deployment/workflows.zip and b/samples/transaction-repair-agent/Deployment/workflows.zip differ diff --git a/samples/transaction-repair-agent/LogicApps/TransactionRepairAgent/workflow.json b/samples/transaction-repair-agent/LogicApps/TransactionRepairAgent/workflow.json index 158ee23..31c1dd6 100644 --- a/samples/transaction-repair-agent/LogicApps/TransactionRepairAgent/workflow.json +++ b/samples/transaction-repair-agent/LogicApps/TransactionRepairAgent/workflow.json @@ -6,7 +6,7 @@ "type": "Agent", "inputs": { "parameters": { - "deploymentId": "gpt-4o-mini", + "deploymentId": "gpt-5-mini", "messages": [ { "role": "system", @@ -16,9 +16,9 @@ "agentModelType": "AzureOpenAI", "agentModelSettings": { "deploymentModelProperties": { - "name": "gpt-4o-mini", + "name": "gpt-5-mini", "format": "OpenAI", - "version": "2024-07-18" + "version": "2025-08-07" }, "agentHistoryReductionSettings": { "agentHistoryReductionType": "maximumTokenCountReduction", diff --git a/samples/transaction-repair-agent/README.md b/samples/transaction-repair-agent/README.md index 675721e..5f67234 100644 --- a/samples/transaction-repair-agent/README.md +++ b/samples/transaction-repair-agent/README.md @@ -10,11 +10,11 @@ A conversational AI agent that helps operations teams diagnose and repair failed **Prerequisites:** - Azure subscription with contributor access -- Region supporting Azure OpenAI (gpt-4o-mini) and Logic Apps Standard - see [region selection](#region-selection) +- Region supporting Azure OpenAI (gpt-5-mini) and Logic Apps Standard - see [region selection](#region-selection) **Deploy to your Azure subscription:** -[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fmodularity%2Flogicapps-labs%2Ftransaction-repair-agent%2Fsamples%2Ftransaction-repair-agent%2FDeployment%2Fsample-arm.json) +[![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Flogicapps-labs%2Fmain%2Fsamples%2Ftransaction-repair-agent%2FDeployment%2Fsample-arm.json)
What happens when you deploy @@ -32,7 +32,7 @@ A conversational AI agent that helps operations teams diagnose and repair failed | Resource | Purpose | |----------|----------| | Logic App Standard | Hosts conversational agent workflows | -| Azure OpenAI | gpt-4o-mini model for agent reasoning | +| Azure OpenAI | gpt-5-mini model for agent reasoning | | Storage Account | Workflow state and run history | | App Service Plan | Compute resources | | Managed Identity | Passwordless authentication |