diff --git a/.github/workflows/deploy-waf.yml b/.github/workflows/deploy-waf.yml index 1eafde847..1f9e2a932 100644 --- a/.github/workflows/deploy-waf.yml +++ b/.github/workflows/deploy-waf.yml @@ -102,7 +102,7 @@ jobs: --resource-group ${{ env.RESOURCE_GROUP_NAME }} \ --template-file infra/main.bicep \ --parameters \ - azureOpenAILocation='${{ env.AZURE_LOCATION }}' \ + aiDeploymentsLocation='${{ env.AZURE_LOCATION }}' \ virtualMachineConfiguration='{"adminUsername": "adminuser", "adminPassword": "P@ssw0rd1234"}' \ logAnalyticsWorkspaceConfiguration='{"existingWorkspaceResourceId": ""}' diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5559aa905..884cc1bd4 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -102,7 +102,7 @@ jobs: --resource-group ${{ env.RESOURCE_GROUP_NAME }} \ --template-file infra/main.bicep \ --parameters \ - azureOpenAILocation='${{ env.AZURE_LOCATION }}' \ + aiDeploymentsLocation='${{ env.AZURE_LOCATION }}' \ logAnalyticsWorkspaceConfiguration='{"dataRetentionInDays": 30, "existingWorkspaceResourceId": ""}' \ applicationInsightsConfiguration='{"retentionInDays": 30}' \ virtualNetworkConfiguration='{"enabled": false}' \ diff --git a/azure.yaml b/azure.yaml index 5a212cb3d..ee4810b1c 100644 --- a/azure.yaml +++ b/azure.yaml @@ -1,20 +1,4 @@ # yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-dev/main/schemas/v1.0/azure.yaml.json name: multi-agent-custom-automation-engine-solution-accelerator metadata: - template: multi-agent-custom-automation-engine-solution-accelerator@1.0 -hooks: - preprovision: - posix: - shell: sh - run: > - chmod u+r+x ./infra/scripts/validate_model_deployment_quota.sh; chmod u+r+x ./infra/scripts/validate_model_quota.sh; ./infra/scripts/validate_model_deployment_quota.sh --subscription "$AZURE_SUBSCRIPTION_ID" --location "${AZURE_ENV_OPENAI_LOCATION:-swedencentral}" --models-parameter "aiModelDeployments" - interactive: false - continueOnError: false - - windows: - shell: pwsh - run: > - $location = if ($env:AZURE_ENV_OPENAI_LOCATION) { $env:AZURE_ENV_OPENAI_LOCATION } else { "swedencentral" }; - ./infra/scripts/validate_model_deployment_quotas.ps1 -SubscriptionId $env:AZURE_SUBSCRIPTION_ID -Location $location -ModelsParameter "aiModelDeployments" - interactive: false - continueOnError: false \ No newline at end of file + template: multi-agent-custom-automation-engine-solution-accelerator@1.0 \ No newline at end of file diff --git a/docs/CustomizingAzdParameters.md b/docs/CustomizingAzdParameters.md index b4e194726..2dab381d9 100644 --- a/docs/CustomizingAzdParameters.md +++ b/docs/CustomizingAzdParameters.md @@ -16,7 +16,7 @@ By default this template will use the environment name as the prefix to prevent | `AZURE_ENV_MODEL_VERSION` | string | `2024-08-06` | Version of the GPT model to be used for deployment. | | `AZURE_ENV_IMAGETAG` | string | `latest` | Docker image tag used for container deployments. | | `AZURE_ENV_ENABLE_TELEMETRY` | bool | `true` | Enables telemetry for monitoring and diagnostics. | - +| `AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID` | string | `` | Set this if you want to reuse an existing Log Analytics Workspace instead of creating a new one. | --- ## How to Set a Parameter @@ -27,6 +27,11 @@ To customize any of the above values, run the following command **before** `azd azd env set ``` +Set the Log Analytics Workspace Id if you need to reuse the existing workspace which is already existing +```shell +azd env set AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID '/subscriptions//resourceGroups//providers/Microsoft.OperationalInsights/workspaces/' +``` + **Example:** ```bash diff --git a/infra/main.bicep b/infra/main.bicep index ebaab8004..4c5c3dd1f 100644 --- a/infra/main.bicep +++ b/infra/main.bicep @@ -1,6 +1,9 @@ metadata name = 'Multi-Agent Custom Automation Engine' metadata description = 'This module contains the resources required to deploy the Multi-Agent Custom Automation Engine solution accelerator for both Sandbox environments and WAF aligned environments.' +@description('Set to true if you want to deploy WAF-aligned infrastructure.') +param useWafAlignedArchitecture bool + @description('Optional. The prefix to add in the default names given to all deployed Azure resources.') @maxLength(19) param solutionPrefix string = 'macae${uniqueString(deployer().objectId, deployer().tenantId, subscription().subscriptionId, resourceGroup().id)}' @@ -11,10 +14,20 @@ param solutionLocation string = resourceGroup().location @description('Optional. Enable/Disable usage telemetry for module.') param enableTelemetry bool = true +param existingLogAnalyticsWorkspaceId string = '' + // Restricting deployment to only supported Azure OpenAI regions validated with GPT-4o model +@metadata({ + azd : { + type: 'location' + usageName : [ + 'OpenAI.GlobalStandard.gpt-4o, 150' + ] + } +}) @allowed(['australiaeast', 'eastus2', 'francecentral', 'japaneast', 'norwayeast', 'swedencentral', 'uksouth', 'westus']) @description('Azure OpenAI Location') -param azureOpenAILocation string +param aiDeploymentsLocation string @minLength(1) @description('Name of the GPT model to deploy:') @@ -26,6 +39,9 @@ param gptModelVersion string = '2024-08-06' @description('GPT model deployment type:') param modelDeploymentType string = 'GlobalStandard' +@description('Optional. AI model deployment token capacity.') +param gptModelCapacity int = 150 + @description('Set the image tag for the container images used in the solution. Default is "latest".') param imageTag string = 'latest' @@ -46,8 +62,8 @@ param logAnalyticsWorkspaceConfiguration logAnalyticsWorkspaceConfigurationType location: solutionLocation sku: 'PerGB2018' tags: tags - dataRetentionInDays: 365 - existingWorkspaceResourceId: '' + dataRetentionInDays: useWafAlignedArchitecture ? 365 : 30 + existingWorkspaceResourceId: existingLogAnalyticsWorkspaceId } @description('Optional. The configuration to apply for the Multi-Agent Custom Automation Engine Application Insights resource.') @@ -56,7 +72,7 @@ param applicationInsightsConfiguration applicationInsightsConfigurationType = { name: 'appi-${solutionPrefix}' location: solutionLocation tags: tags - retentionInDays: 365 + retentionInDays: useWafAlignedArchitecture ? 365 : 30 } @description('Optional. The configuration to apply for the Multi-Agent Custom Automation Engine Managed Identity resource.') @@ -105,7 +121,7 @@ param networkSecurityGroupAdministrationConfiguration networkSecurityGroupConfig @description('Optional. The configuration to apply for the Multi-Agent Custom Automation Engine virtual network resource.') param virtualNetworkConfiguration virtualNetworkConfigurationType = { - enabled: true + enabled: useWafAlignedArchitecture ? true : false name: 'vnet-${solutionPrefix}' location: solutionLocation tags: tags @@ -131,7 +147,7 @@ param virtualMachineConfiguration virtualMachineConfigurationType = { location: solutionLocation tags: tags adminUsername: 'adminuser' - adminPassword: guid(solutionPrefix, subscription().subscriptionId) + adminPassword: useWafAlignedArchitecture? 'P@ssw0rd1234' : guid(solutionPrefix, subscription().subscriptionId) vmSize: 'Standard_D2s_v3' subnetResourceId: null //Default value set on module configuration } @@ -140,18 +156,18 @@ param virtualMachineConfiguration virtualMachineConfigurationType = { param aiFoundryAiServicesConfiguration aiServicesConfigurationType = { enabled: true name: 'aisa-${solutionPrefix}' - location: azureOpenAILocation + location: aiDeploymentsLocation sku: 'S0' deployments: null //Default value set on module configuration subnetResourceId: null //Default value set on module configuration - modelCapacity: 50 + modelCapacity: gptModelCapacity } @description('Optional. The configuration to apply for the AI Foundry AI Project resource.') param aiFoundryAiProjectConfiguration aiProjectConfigurationType = { enabled: true name: 'aifp-${solutionPrefix}' - location: azureOpenAILocation + location: aiDeploymentsLocation sku: 'Basic' tags: tags } @@ -199,8 +215,8 @@ param webServerFarmConfiguration webServerFarmConfigurationType = { enabled: true name: 'asp-${solutionPrefix}' location: solutionLocation - skuName: 'P1v3' - skuCapacity: 3 + skuName: useWafAlignedArchitecture? 'P1v3' : 'B2' + skuCapacity: useWafAlignedArchitecture ? 3 : 1 tags: tags } @@ -729,7 +745,7 @@ var aiFoundryAiServicesModelDeployment = { sku: { name: modelDeploymentType //Curently the capacity is set to 140 for opinanal performance. - capacity: aiFoundryAiServicesConfiguration.?modelCapacity ?? 50 + capacity: aiFoundryAiServicesConfiguration.?modelCapacity ?? gptModelCapacity } raiPolicyName: 'Microsoft.Default' } @@ -739,7 +755,7 @@ module aiFoundryAiServices 'br/public:avm/res/cognitive-services/account:0.11.0' params: { name: aiFoundryAiServicesResourceName tags: aiFoundryAiServicesConfiguration.?tags ?? tags - location: aiFoundryAiServicesConfiguration.?location ?? azureOpenAILocation + location: aiFoundryAiServicesConfiguration.?location ?? aiDeploymentsLocation enableTelemetry: enableTelemetry diagnosticSettings: [{ workspaceResourceId: logAnalyticsWorkspaceId }] sku: aiFoundryAiServicesConfiguration.?sku ?? 'S0' @@ -817,7 +833,7 @@ resource aiServices 'Microsoft.CognitiveServices/accounts@2025-04-01-preview' ex resource aiFoundryProject 'Microsoft.CognitiveServices/accounts/projects@2025-04-01-preview' = { parent: aiServices name: aiFoundryAiProjectName - location: aiFoundryAiProjectConfiguration.?location ?? azureOpenAILocation + location: aiFoundryAiProjectConfiguration.?location ?? aiDeploymentsLocation identity: { type: 'SystemAssigned' } diff --git a/infra/main.bicepparam b/infra/main.bicepparam deleted file mode 100644 index e0be7c709..000000000 --- a/infra/main.bicepparam +++ /dev/null @@ -1,24 +0,0 @@ -using './main.bicep' - -param solutionPrefix = readEnvironmentVariable('AZURE_ENV_NAME', 'macae') -param solutionLocation = readEnvironmentVariable('AZURE_LOCATION', 'swedencentral') -param azureOpenAILocation = readEnvironmentVariable('AZURE_ENV_OPENAI_LOCATION', 'swedencentral') -param modelDeploymentType = readEnvironmentVariable('AZURE_ENV_MODEL_DEPLOYMENT_TYPE', 'GlobalStandard') -param gptModelName = readEnvironmentVariable('AZURE_ENV_MODEL_NAME', 'gpt-4o') -param gptModelVersion = readEnvironmentVariable('AZURE_ENV_MODEL_VERSION', '2024-08-06') -param imageTag = readEnvironmentVariable('AZURE_ENV_IMAGETAG', 'latest') -param enableTelemetry = bool(readEnvironmentVariable('AZURE_ENV_ENABLE_TELEMETRY', 'true')) -param logAnalyticsWorkspaceConfiguration = { - dataRetentionInDays: 30 - existingWorkspaceResourceId: '' -} -param applicationInsightsConfiguration = { - retentionInDays: 30 -} -param virtualNetworkConfiguration = { - enabled: false -} -param webServerFarmConfiguration = { - skuCapacity: 1 - skuName: 'B2' -} diff --git a/infra/main.parameters.json b/infra/main.parameters.json index d93f00640..a1d690070 100644 --- a/infra/main.parameters.json +++ b/infra/main.parameters.json @@ -18,12 +18,36 @@ } ] }, - "environmentName": { + "solutionPrefix": { "value": "${AZURE_ENV_NAME}" }, - "location": { + "solutionLocation": { "value": "${AZURE_LOCATION}" }, + "aiDeploymentsLocation": { + "value": "${AZURE_ENV_OPENAI_LOCATION}" + }, + "modelDeploymentType": { + "value": "${AZURE_ENV_MODEL_DEPLOYMENT_TYPE}" + }, + "gptModelName": { + "value": "${AZURE_ENV_MODEL_NAME}" + }, + "gptModelVersion": { + "value": "${AZURE_ENV_MODEL_VERSION}" + }, + "gptModelCapacity": { + "value": "${AZURE_ENV_MODEL_CAPACITY}" + }, + "imageTag": { + "value": "${AZURE_ENV_IMAGE_TAG}" + }, + "enableTelemetry": { + "value": "${AZURE_ENV_ENABLE_TELEMETRY}" + }, + "existingLogAnalyticsWorkspaceId": { + "value": "${AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID}" + }, "backendExists": { "value": "${SERVICE_BACKEND_RESOURCE_EXISTS=false}" }, diff --git a/infra/main.waf-aligned.bicepparam b/infra/main.waf-aligned.bicepparam deleted file mode 100644 index ac45cdcf3..000000000 --- a/infra/main.waf-aligned.bicepparam +++ /dev/null @@ -1,18 +0,0 @@ -using './main.bicep' - -param solutionPrefix = readEnvironmentVariable('AZURE_ENV_NAME', 'macae') -param solutionLocation = readEnvironmentVariable('AZURE_LOCATION', 'swedencentral') -param azureOpenAILocation = readEnvironmentVariable('AZURE_ENV_OPENAI_LOCATION', 'swedencentral') -param modelDeploymentType = readEnvironmentVariable('AZURE_ENV_MODEL_DEPLOYMENT_TYPE', 'GlobalStandard') -param gptModelName = readEnvironmentVariable('AZURE_ENV_MODEL_NAME', 'gpt-4o') -param gptModelVersion = readEnvironmentVariable('AZURE_ENV_MODEL_VERSION', '2024-08-06') -param imageTag = readEnvironmentVariable('AZURE_ENV_IMAGETAG', 'latest') -param enableTelemetry = bool(readEnvironmentVariable('AZURE_ENV_ENABLE_TELEMETRY', 'true')) -param virtualMachineConfiguration = { - adminUsername: 'adminuser' - adminPassword: 'P@ssw0rd1234' -} - -param logAnalyticsWorkspaceConfiguration = { - existingWorkspaceResourceId: '' -}