Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ jobs:
export GPT_MIN_CAPACITY="50"
export AZURE_REGIONS="${{ vars.AZURE_REGIONS }}"

chmod +x deploy/scripts/checkquota.sh
if ! deploy/scripts/checkquota.sh; then
chmod +x infra/scripts/checkquota.sh
if ! infra/scripts/checkquota.sh; then
# If quota check fails due to insufficient quota, set the flag
if grep -q "No region with sufficient quota found" deploy/scripts/checkquota.sh; then
if grep -q "No region with sufficient quota found" infra/scripts/checkquota.sh; then
echo "QUOTA_FAILED=true" >> $GITHUB_ENV
fi
exit 1 # Fail the pipeline if any other failure occurs
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:
set -e
az deployment group create \
--resource-group ${{ env.RESOURCE_GROUP_NAME }} \
--template-file deploy/macae.bicep \
--template-file infra/macae.bicep \
--parameters azureOpenAILocation=${{env.AZURE_LOCATION }} cosmosLocation=${{env.AZURE_LOCATION }}


Expand Down Expand Up @@ -282,4 +282,4 @@ jobs:
echo "Purged the openai resource: ${{ env.OPENAI_RESOURCE_NAME }}"
fi

echo "Resource purging completed successfully"
echo "Resource purging completed successfully"
17 changes: 17 additions & 0 deletions azure.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# 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: [email protected]
services:
backend:
project: src/backend
host: containerapp
language: python
docker:
context: src/backend
path: Dockerfile
frontend:
project: src/frontend
host: containerapp
language: python
docker:
context: src/frontend
path: Dockerfile

8 changes: 7 additions & 1 deletion infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ param azureOpenAILocation string = 'eastus2' // The location used for all deploy
@minLength(3)
@maxLength(20)
@description('Prefix for all resources created by this template. This prefix will be used to create unique names for all resources. The prefix must be unique within the resource group.')
param prefix string
param prefix string = 'macae'

@description('Tags to apply to all deployed resources')
param tags object = {}
Expand Down Expand Up @@ -120,6 +120,7 @@ resource aiServices 'Microsoft.CognitiveServices/accounts@2024-04-01-preview' =
apiProperties: {
//statisticsEnabled: false
}
disableLocalAuth: true
}
}

Expand Down Expand Up @@ -152,6 +153,10 @@ module kvault 'deploy_keyvault.bicep' = {
scope: resourceGroup(resourceGroup().name)
}

// First, add this section to store the AI Services key in Key Vault


// Then modify the aifoundry module to reference the secret securely
module aifoundry 'deploy_ai_foundry.bicep' = {
name: 'deploy_ai_foundry'
params: {
Expand Down Expand Up @@ -197,6 +202,7 @@ resource cosmos 'Microsoft.DocumentDB/databaseAccounts@2024-05-15' = {
}
]
capabilities: [{ name: 'EnableServerless' }]
disableLocalAuth: true
}

resource contributorRoleDefinition 'sqlRoleDefinitions' existing = {
Expand Down
118 changes: 101 additions & 17 deletions infra/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,55 @@
"_generator": {
"name": "bicep",
"version": "0.34.44.8038",
"templateHash": "2906892014954666053"
"templateHash": "7719893060553487435"
}
},
"parameters": {
"location": {
"type": "string",
"defaultValue": "EastUS2",
"metadata": {
"description": "Location for all resources."
}
},
"azureOpenAILocation": {
"type": "string",
"defaultValue": "japaneast",
"defaultValue": "eastus2",
"allowedValues": [
"australiaeast",
"brazilsouth",
"canadacentral",
"canadaeast",
"eastus",
"eastus2",
"francecentral",
"germanywestcentral",
"japaneast",
"koreacentral",
"northcentralus",
"norwayeast",
"polandcentral",
"southafricanorth",
"southcentralus",
"southindia",
"swedencentral",
"switzerlandnorth",
"uaenorth",
"uksouth",
"westeurope",
"westus",
"westus3"
],
"metadata": {
"description": "Location for OpenAI resources."
"description": "Location for all Ai services resources. This location can be different from the resource group location."
}
},
"prefix": {
"type": "string",
"defaultValue": "macaeo",
"defaultValue": "macae",
"minLength": 3,
"maxLength": 20,
"metadata": {
"description": "A prefix to add to the start of all resource names. Note: A \"unique\" suffix will also be added"
"description": "Prefix for all resources created by this template. This prefix will be used to create unique names for all resources. The prefix must be unique within the resource group."
}
},
"tags": {
Expand Down Expand Up @@ -77,21 +103,21 @@
},
"capacity": {
"type": "int",
"defaultValue": 1
"defaultValue": 140
}
},
"variables": {
"modelVersion": "2024-08-06",
"aiServicesName": "[format('{0}-aiservices', parameters('prefix'))]",
"deploymentType": "GlobalStandard",
"gptModelVersion": "gpt-4o",
"appVersion": "latest",
"appVersion": "fnd01",
"resgistryName": "biabcontainerreg",
"dockerRegistryUrl": "[format('https://{0}.azurecr.io', variables('resgistryName'))]",
"backendDockerImageURL": "[format('{0}.azurecr.io/macaebackend:{1}', variables('resgistryName'), variables('appVersion'))]",
"frontendDockerImageURL": "[format('{0}.azurecr.io/macaefrontend:{1}', variables('resgistryName'), variables('appVersion'))]",
"uniqueNameFormat": "[format('{0}-{{0}}-{1}', parameters('prefix'), uniqueString(resourceGroup().id, parameters('prefix')))]",
"aoaiApiVersion": "2024-08-01-preview",
"aoaiApiVersion": "2025-01-01-preview",
"aiModelDeployments": [
{
"name": "[variables('gptModelVersion')]",
Expand Down Expand Up @@ -198,9 +224,8 @@
"kind": "AIServices",
"properties": {
"customSubDomainName": "[variables('aiServicesName')]",
"apiProperties": {
"statisticsEnabled": false
}
"apiProperties": {},
"disableLocalAuth": true
}
},
"aiServicesDeployments": {
Expand Down Expand Up @@ -268,7 +293,8 @@
{
"name": "EnableServerless"
}
]
],
"disableLocalAuth": true
}
},
"pullIdentity": {
Expand Down Expand Up @@ -377,7 +403,11 @@
},
{
"name": "AZURE_OPENAI_ENDPOINT",
"value": "[reference('aiServices').endpoint]"
"value": "[replace(reference('aiServices').endpoint, 'cognitiveservices.azure.com', 'openai.azure.com')]"
},
{
"name": "AZURE_OPENAI_MODEL_NAME",
"value": "[variables('gptModelVersion')]"
},
{
"name": "AZURE_OPENAI_DEPLOYMENT_NAME",
Expand All @@ -388,19 +418,40 @@
"value": "[variables('aoaiApiVersion')]"
},
{
"name": "FRONTEND_SITE_NAME",
"value": "[format('https://{0}.azurewebsites.net', format(variables('uniqueNameFormat'), 'frontend'))]"
"name": "APPLICATIONINSIGHTS_INSTRUMENTATION_KEY",
"value": "[reference('appInsights').InstrumentationKey]"
},
{
"name": "APPLICATIONINSIGHTS_CONNECTION_STRING",
"value": "[reference('appInsights').ConnectionString]"
},
{
"name": "AZURE_AI_AGENT_PROJECT_CONNECTION_STRING",
"value": "[reference('aifoundry').outputs.projectConnectionString.value]"
},
{
"name": "AZURE_AI_SUBSCRIPTION_ID",
"value": "[subscription().subscriptionId]"
},
{
"name": "AZURE_AI_RESOURCE_GROUP",
"value": "[resourceGroup().name]"
},
{
"name": "AZURE_AI_PROJECT_NAME",
"value": "[reference('aifoundry').outputs.aiProjectName.value]"
},
{
"name": "FRONTEND_SITE_NAME",
"value": "[format('https://{0}.azurewebsites.net', format(variables('uniqueNameFormat'), 'frontend'))]"
}
]
}
]
}
},
"dependsOn": [
"aifoundry",
"aiServices",
"appInsights",
"containerAppEnv",
Expand Down Expand Up @@ -457,6 +508,10 @@
{
"name": "BACKEND_API_URL",
"value": "[format('https://{0}', reference('containerApp').configuration.ingress.fqdn)]"
},
{
"name": "AUTH_ENABLED",
"value": "false"
}
]
}
Expand All @@ -473,6 +528,31 @@
"pullIdentity"
]
},
"aiHubProject": {
"existing": true,
"type": "Microsoft.MachineLearningServices/workspaces",
"apiVersion": "2024-01-01-preview",
"name": "[format('{0}-aiproject', parameters('prefix'))]"
},
"aiDeveloper": {
"existing": true,
"type": "Microsoft.Authorization/roleDefinitions",
"apiVersion": "2022-04-01",
"name": "64702f94-c441-49e6-a78b-ef80e0188fee"
},
"aiDeveloperAccessProj": {
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"scope": "[format('Microsoft.MachineLearningServices/workspaces/{0}', format('{0}-aiproject', parameters('prefix')))]",
"name": "[guid(format('{0}-backend', parameters('prefix')), resourceId('Microsoft.MachineLearningServices/workspaces', format('{0}-aiproject', parameters('prefix'))), resourceId('Microsoft.Authorization/roleDefinitions', '64702f94-c441-49e6-a78b-ef80e0188fee'))]",
"properties": {
"roleDefinitionId": "[resourceId('Microsoft.Authorization/roleDefinitions', '64702f94-c441-49e6-a78b-ef80e0188fee')]",
"principalId": "[reference('containerApp', '2024-03-01', 'full').identity.principalId]"
},
"dependsOn": [
"containerApp"
]
},
"kvault": {
"type": "Microsoft.Resources/deployments",
"apiVersion": "2022-09-01",
Expand Down Expand Up @@ -639,7 +719,7 @@
"_generator": {
"name": "bicep",
"version": "0.34.44.8038",
"templateHash": "12550713338937452696"
"templateHash": "8087543237770345715"
}
},
"parameters": {
Expand Down Expand Up @@ -988,6 +1068,10 @@
"storageAccountId": {
"type": "string",
"value": "[resourceId('Microsoft.Storage/storageAccounts', variables('storageNameCleaned'))]"
},
"projectConnectionString": {
"type": "string",
"value": "[format('{0};{1};{2};{3}', split(reference(resourceId('Microsoft.MachineLearningServices/workspaces', variables('aiProjectName')), '2024-01-01-preview').discoveryUrl, '/')[2], subscription().subscriptionId, resourceGroup().name, variables('aiProjectName'))]"
}
}
}
Expand Down
Loading