diff --git a/.azdo/pipelines/azure-dev.yml b/.azdo/pipelines/azure-dev.yml index 22616675..728f2e28 100644 --- a/.azdo/pipelines/azure-dev.yml +++ b/.azdo/pipelines/azure-dev.yml @@ -2,8 +2,6 @@ # Set this to the mainline branch you are using trigger: - main - - master - - feature/azd-semantickernel # Azure Pipelines workflow to deploy to Azure using azd # To configure required secrets and service connection for connecting to Azure, simply run `azd pipeline config --provider azdo` diff --git a/.flake8 b/.flake8 index 08367ecd..5b72c2ab 100644 --- a/.flake8 +++ b/.flake8 @@ -1,5 +1,5 @@ [flake8] max-line-length = 88 extend-ignore = E501 -exclude = .venv, frontend +exclude = .venv, frontend, src/backend/tests ignore = E203, W503, G004, G200, E402 \ No newline at end of file diff --git a/.github/workflows/azure-dev.yml b/.github/workflows/azure-dev.yml index 0976ea17..915411a8 100644 --- a/.github/workflows/azure-dev.yml +++ b/.github/workflows/azure-dev.yml @@ -2,9 +2,7 @@ name: Azure Template Validation on: push: branches: - - dev - main - - feature/azd-semantickernel workflow_dispatch: permissions: @@ -15,69 +13,19 @@ permissions: jobs: template_validation_job: runs-on: ubuntu-latest - name: Template validation + name: template validation steps: - # Step 1: Checkout the code from your repository - - name: Checkout code - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - # Step 2: Set up Python - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.9" - - # Step 3: Create and populate the virtual environment - - name: Create virtual environment and install dependencies - run: | - python -m venv .venv - source .venv/bin/activate - python -m pip install --upgrade pip - pip install azure-mgmt-resource azure-identity azure-core azure-mgmt-subscription azure-cli-core - # Install any other dependencies that might be needed - pip freeze > requirements-installed.txt - echo "Virtual environment created with these packages:" - cat requirements-installed.txt - - # Step 4: Create azd directory if it doesn't exist - - name: Create azd directory - run: | - mkdir -p ./.azd || true - touch ./.azd/.env || true - - # Step 5: Validate the Azure template - - name: Validate Azure Template - uses: microsoft/template-validation-action@v0.3.5 + - uses: microsoft/template-validation-action@Latest id: validation env: - AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} - AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} - AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - AZURE_ENV_NAME: ${{ secrets.AZURE_ENV_NAME }} - AZURE_LOCATION: ${{ secrets.AZURE_LOCATION }} + AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }} + AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }} + AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }} + AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }} + AZURE_LOCATION: ${{ vars.AZURE_LOCATION }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # Step 6: Debug output in case of failure - - name: Debug on failure - if: failure() - run: | - echo "Validation failed. Checking environment:" - ls -la - if [ -d ".venv" ]; then - echo ".venv directory exists" - ls -la .venv/bin/ - else - echo ".venv directory does not exist" - fi - if [ -d "tva_*" ]; then - echo "TVA directory exists:" - find . -name "tva_*" -type d - ls -la $(find . -name "tva_*" -type d) - else - echo "No TVA directory found" - fi - - # Step 7: Print the result of the validation - - name: Print result - if: success() + - name: print result run: cat ${{ steps.validation.outputs.resultFile }} diff --git a/.github/workflows/docker-build-and-push.yml b/.github/workflows/docker-build-and-push.yml index 383ef2fc..a6d2c59a 100644 --- a/.github/workflows/docker-build-and-push.yml +++ b/.github/workflows/docker-build-and-push.yml @@ -18,7 +18,7 @@ on: - dev - demo - hotfix - workflow_dispatch: + workflow_dispatch: jobs: build-and-push: @@ -32,14 +32,19 @@ jobs: uses: docker/setup-buildx-action@v1 - name: Log in to Azure Container Registry - if: ${{ (github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo' || github.ref_name == 'hotfix') }} + if: ${{ github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo' || github.ref_name == 'hotfix' }} uses: azure/docker-login@v2 with: login-server: ${{ secrets.ACR_LOGIN_SERVER }} username: ${{ secrets.ACR_USERNAME }} password: ${{ secrets.ACR_PASSWORD }} - - name: Set Docker image tag + - name: Get current date + id: date + run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT + + - name: Determine Tag Name Based on Branch + id: determine_tag run: | if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then echo "TAG=latest" >> $GITHUB_ENV @@ -52,24 +57,30 @@ jobs: else echo "TAG=pullrequest-ignore" >> $GITHUB_ENV fi - - - name: Build and push Docker images optionally + + - name: Set Historical Tag run: | - cd src/backend - docker build -t ${{ secrets.ACR_LOGIN_SERVER }}/macaebackend:${{ env.TAG }} -f Dockerfile . && \ - if [[ "${{ env.TAG }}" == "latest" || "${{ env.TAG }}" == "dev" || "${{ env.TAG }}" == "demo" || "${{ env.TAG }}" == "hotfix" ]]; then - docker push ${{ secrets.ACR_LOGIN_SERVER }}/macaebackend:${{ env.TAG }} && \ - echo "Backend image built and pushed successfully." - else - echo "Skipping Docker push for backend with tag: ${{ env.TAG }}" - fi - cd ../frontend - docker build -t ${{ secrets.ACR_LOGIN_SERVER }}/macaefrontend:${{ env.TAG }} -f Dockerfile . && \ - if [[ "${{ env.TAG }}" == "latest" || "${{ env.TAG }}" == "dev" || "${{ env.TAG }}" == "demo" || "${{ env.TAG }}" == "hotfix" ]]; then - docker push ${{ secrets.ACR_LOGIN_SERVER }}/macaefrontend:${{ env.TAG }} && \ - echo "Frontend image built and pushed successfully." - else - echo "Skipping Docker push for frontend with tag: ${{ env.TAG }}" - fi + DATE_TAG=$(date +'%Y-%m-%d') + RUN_ID=${{ github.run_number }} + # Create historical tag using TAG, DATE_TAG, and RUN_ID + echo "HISTORICAL_TAG=${{ env.TAG }}_${DATE_TAG}_${RUN_ID}" >> $GITHUB_ENV - + - name: Build and optionally push Backend Docker image + uses: docker/build-push-action@v6 + with: + context: ./src/backend + file: ./src/backend/Dockerfile + push: ${{ env.TAG != 'pullrequest-ignore' }} + tags: | + ${{ secrets.ACR_LOGIN_SERVER }}/macaebackend:${{ env.TAG }} + ${{ secrets.ACR_LOGIN_SERVER }}/macaebackend:${{ env.HISTORICAL_TAG }} + + - name: Build and optionally push Frontend Docker image + uses: docker/build-push-action@v6 + with: + context: ./src/frontend + file: ./src/frontend/Dockerfile + push: ${{ env.TAG != 'pullrequest-ignore' }} + tags: | + ${{ secrets.ACR_LOGIN_SERVER }}/macaefrontend:${{ env.TAG }} + ${{ secrets.ACR_LOGIN_SERVER }}/macaefrontend:${{ env.HISTORICAL_TAG }} \ No newline at end of file diff --git a/infra/abbreviations.json b/infra/abbreviations.json index 1533dee5..93b95656 100644 --- a/infra/abbreviations.json +++ b/infra/abbreviations.json @@ -1,136 +1,227 @@ { - "analysisServicesServers": "as", - "apiManagementService": "apim-", - "appConfigurationStores": "appcs-", - "appManagedEnvironments": "cae-", - "appContainerApps": "ca-", - "authorizationPolicyDefinitions": "policy-", - "automationAutomationAccounts": "aa-", - "blueprintBlueprints": "bp-", - "blueprintBlueprintsArtifacts": "bpa-", - "cacheRedis": "redis-", - "cdnProfiles": "cdnp-", - "cdnProfilesEndpoints": "cdne-", - "cognitiveServicesAccounts": "cog-", - "cognitiveServicesFormRecognizer": "cog-fr-", - "cognitiveServicesTextAnalytics": "cog-ta-", - "computeAvailabilitySets": "avail-", - "computeCloudServices": "cld-", - "computeDiskEncryptionSets": "des", - "computeDisks": "disk", - "computeDisksOs": "osdisk", - "computeGalleries": "gal", - "computeSnapshots": "snap-", - "computeVirtualMachines": "vm", - "computeVirtualMachineScaleSets": "vmss-", - "containerInstanceContainerGroups": "ci", - "containerRegistryRegistries": "cr", - "containerServiceManagedClusters": "aks-", - "databricksWorkspaces": "dbw-", - "dataFactoryFactories": "adf-", - "dataLakeAnalyticsAccounts": "dla", - "dataLakeStoreAccounts": "dls", - "dataMigrationServices": "dms-", - "dBforMySQLServers": "mysql-", - "dBforPostgreSQLServers": "psql-", - "devicesIotHubs": "iot-", - "devicesProvisioningServices": "provs-", - "devicesProvisioningServicesCertificates": "pcert-", - "documentDBDatabaseAccounts": "cosmos-", - "documentDBMongoDatabaseAccounts": "cosmon-", - "eventGridDomains": "evgd-", - "eventGridDomainsTopics": "evgt-", - "eventGridEventSubscriptions": "evgs-", - "eventHubNamespaces": "evhns-", - "eventHubNamespacesEventHubs": "evh-", - "hdInsightClustersHadoop": "hadoop-", - "hdInsightClustersHbase": "hbase-", - "hdInsightClustersKafka": "kafka-", - "hdInsightClustersMl": "mls-", - "hdInsightClustersSpark": "spark-", - "hdInsightClustersStorm": "storm-", - "hybridComputeMachines": "arcs-", - "insightsActionGroups": "ag-", - "insightsComponents": "appi-", - "keyVaultVaults": "kv-", - "kubernetesConnectedClusters": "arck", - "kustoClusters": "dec", - "kustoClustersDatabases": "dedb", - "logicIntegrationAccounts": "ia-", - "logicWorkflows": "logic-", - "machineLearningServicesWorkspaces": "mlw-", - "managedIdentityUserAssignedIdentities": "id-", - "managementManagementGroups": "mg-", - "migrateAssessmentProjects": "migr-", - "networkApplicationGateways": "agw-", - "networkApplicationSecurityGroups": "asg-", - "networkAzureFirewalls": "afw-", - "networkBastionHosts": "bas-", - "networkConnections": "con-", - "networkDnsZones": "dnsz-", - "networkExpressRouteCircuits": "erc-", - "networkFirewallPolicies": "afwp-", - "networkFirewallPoliciesWebApplication": "waf", - "networkFirewallPoliciesRuleGroups": "wafrg", - "networkFrontDoors": "fd-", - "networkFrontdoorWebApplicationFirewallPolicies": "fdfp-", - "networkLoadBalancersExternal": "lbe-", - "networkLoadBalancersInternal": "lbi-", - "networkLoadBalancersInboundNatRules": "rule-", - "networkLocalNetworkGateways": "lgw-", - "networkNatGateways": "ng-", - "networkNetworkInterfaces": "nic-", - "networkNetworkSecurityGroups": "nsg-", - "networkNetworkSecurityGroupsSecurityRules": "nsgsr-", - "networkNetworkWatchers": "nw-", - "networkPrivateDnsZones": "pdnsz-", - "networkPrivateLinkServices": "pl-", - "networkPublicIPAddresses": "pip-", - "networkPublicIPPrefixes": "ippre-", - "networkRouteFilters": "rf-", - "networkRouteTables": "rt-", - "networkRouteTablesRoutes": "udr-", - "networkTrafficManagerProfiles": "traf-", - "networkVirtualNetworkGateways": "vgw-", - "networkVirtualNetworks": "vnet-", - "networkVirtualNetworksSubnets": "snet-", - "networkVirtualNetworksVirtualNetworkPeerings": "peer-", - "networkVirtualWans": "vwan-", - "networkVpnGateways": "vpng-", - "networkVpnGatewaysVpnConnections": "vcn-", - "networkVpnGatewaysVpnSites": "vst-", - "notificationHubsNamespaces": "ntfns-", - "notificationHubsNamespacesNotificationHubs": "ntf-", - "operationalInsightsWorkspaces": "log-", - "portalDashboards": "dash-", - "powerBIDedicatedCapacities": "pbi-", - "purviewAccounts": "pview-", - "recoveryServicesVaults": "rsv-", - "resourcesResourceGroups": "rg-", - "searchSearchServices": "srch-", - "serviceBusNamespaces": "sb-", - "serviceBusNamespacesQueues": "sbq-", - "serviceBusNamespacesTopics": "sbt-", - "serviceEndPointPolicies": "se-", - "serviceFabricClusters": "sf-", - "signalRServiceSignalR": "sigr", - "sqlManagedInstances": "sqlmi-", - "sqlServers": "sql-", - "sqlServersDataWarehouse": "sqldw-", - "sqlServersDatabases": "sqldb-", - "sqlServersDatabasesStretch": "sqlstrdb-", - "storageStorageAccounts": "st", - "storageStorageAccountsVm": "stvm", - "storSimpleManagers": "ssimp", - "streamAnalyticsCluster": "asa-", - "synapseWorkspaces": "syn", - "synapseWorkspacesAnalyticsWorkspaces": "synw", - "synapseWorkspacesSqlPoolsDedicated": "syndp", - "synapseWorkspacesSqlPoolsSpark": "synsp", - "timeSeriesInsightsEnvironments": "tsi-", - "webServerFarms": "plan-", - "webSitesAppService": "app-", - "webSitesAppServiceEnvironment": "ase-", - "webSitesFunctions": "func-", - "webStaticSites": "stapp-" -} + "ai": { + "aiSearch": "srch-", + "aiServices": "aisa-", + "aiVideoIndexer": "avi-", + "machineLearningWorkspace": "mlw-", + "openAIService": "oai-", + "botService": "bot-", + "computerVision": "cv-", + "contentModerator": "cm-", + "contentSafety": "cs-", + "customVisionPrediction": "cstv-", + "customVisionTraining": "cstvt-", + "documentIntelligence": "di-", + "faceApi": "face-", + "healthInsights": "hi-", + "immersiveReader": "ir-", + "languageService": "lang-", + "speechService": "spch-", + "translator": "trsl-", + "aiHub": "aih-", + "aiHubProject": "aihp-" + }, + "analytics": { + "analysisServicesServer": "as", + "databricksWorkspace": "dbw-", + "dataExplorerCluster": "dec", + "dataExplorerClusterDatabase": "dedb", + "dataFactory": "adf-", + "digitalTwin": "dt-", + "streamAnalytics": "asa-", + "synapseAnalyticsPrivateLinkHub": "synplh-", + "synapseAnalyticsSQLDedicatedPool": "syndp", + "synapseAnalyticsSparkPool": "synsp", + "synapseAnalyticsWorkspaces": "synw", + "dataLakeStoreAccount": "dls", + "dataLakeAnalyticsAccount": "dla", + "eventHubsNamespace": "evhns-", + "eventHub": "evh-", + "eventGridDomain": "evgd-", + "eventGridSubscriptions": "evgs-", + "eventGridTopic": "evgt-", + "eventGridSystemTopic": "egst-", + "hdInsightHadoopCluster": "hadoop-", + "hdInsightHBaseCluster": "hbase-", + "hdInsightKafkaCluster": "kafka-", + "hdInsightSparkCluster": "spark-", + "hdInsightStormCluster": "storm-", + "hdInsightMLServicesCluster": "mls-", + "iotHub": "iot-", + "provisioningServices": "provs-", + "provisioningServicesCertificate": "pcert-", + "powerBIEmbedded": "pbi-", + "timeSeriesInsightsEnvironment": "tsi-" + }, + "compute": { + "appServiceEnvironment": "ase-", + "appServicePlan": "asp-", + "loadTesting": "lt-", + "availabilitySet": "avail-", + "arcEnabledServer": "arcs-", + "arcEnabledKubernetesCluster": "arck", + "batchAccounts": "ba-", + "cloudService": "cld-", + "communicationServices": "acs-", + "diskEncryptionSet": "des", + "functionApp": "func-", + "gallery": "gal", + "hostingEnvironment": "host-", + "imageTemplate": "it-", + "managedDiskOS": "osdisk", + "managedDiskData": "disk", + "notificationHubs": "ntf-", + "notificationHubsNamespace": "ntfns-", + "proximityPlacementGroup": "ppg-", + "restorePointCollection": "rpc-", + "snapshot": "snap-", + "staticWebApp": "stapp-", + "virtualMachine": "vm", + "virtualMachineScaleSet": "vmss-", + "virtualMachineMaintenanceConfiguration": "mc-", + "virtualMachineStorageAccount": "stvm", + "webApp": "app-" + }, + "containers": { + "aksCluster": "aks-", + "aksSystemNodePool": "npsystem-", + "aksUserNodePool": "np-", + "containerApp": "ca-", + "containerAppsEnvironment": "cae-", + "containerRegistry": "cr", + "containerInstance": "ci", + "serviceFabricCluster": "sf-", + "serviceFabricManagedCluster": "sfmc-" + }, + "databases": { + "cosmosDBDatabase": "cosmos-", + "cosmosDBApacheCassandra": "coscas-", + "cosmosDBMongoDB": "cosmon-", + "cosmosDBNoSQL": "cosno-", + "cosmosDBTable": "costab-", + "cosmosDBGremlin": "cosgrm-", + "cosmosDBPostgreSQL": "cospos-", + "cacheForRedis": "redis-", + "sqlDatabaseServer": "sql-", + "sqlDatabase": "sqldb-", + "sqlElasticJobAgent": "sqlja-", + "sqlElasticPool": "sqlep-", + "mariaDBServer": "maria-", + "mariaDBDatabase": "mariadb-", + "mySQLDatabase": "mysql-", + "postgreSQLDatabase": "psql-", + "sqlServerStretchDatabase": "sqlstrdb-", + "sqlManagedInstance": "sqlmi-" + }, + "developerTools": { + "appConfigurationStore": "appcs-", + "mapsAccount": "map-", + "signalR": "sigr", + "webPubSub": "wps-" + }, + "devOps": { + "managedGrafana": "amg-" + }, + "integration": { + "apiManagementService": "apim-", + "integrationAccount": "ia-", + "logicApp": "logic-", + "serviceBusNamespace": "sbns-", + "serviceBusQueue": "sbq-", + "serviceBusTopic": "sbt-", + "serviceBusTopicSubscription": "sbts-" + }, + "managementGovernance": { + "automationAccount": "aa-", + "applicationInsights": "appi-", + "monitorActionGroup": "ag-", + "monitorDataCollectionRules": "dcr-", + "monitorAlertProcessingRule": "apr-", + "blueprint": "bp-", + "blueprintAssignment": "bpa-", + "dataCollectionEndpoint": "dce-", + "logAnalyticsWorkspace": "log-", + "logAnalyticsQueryPacks": "pack-", + "managementGroup": "mg-", + "purviewInstance": "pview-", + "resourceGroup": "rg-", + "templateSpecsName": "ts-" + }, + "migration": { + "migrateProject": "migr-", + "databaseMigrationService": "dms-", + "recoveryServicesVault": "rsv-" + }, + "networking": { + "applicationGateway": "agw-", + "applicationSecurityGroup": "asg-", + "cdnProfile": "cdnp-", + "cdnEndpoint": "cdne-", + "connections": "con-", + "dnsForwardingRuleset": "dnsfrs-", + "dnsPrivateResolver": "dnspr-", + "dnsPrivateResolverInboundEndpoint": "in-", + "dnsPrivateResolverOutboundEndpoint": "out-", + "firewall": "afw-", + "firewallPolicy": "afwp-", + "expressRouteCircuit": "erc-", + "expressRouteGateway": "ergw-", + "frontDoorProfile": "afd-", + "frontDoorEndpoint": "fde-", + "frontDoorFirewallPolicy": "fdfp-", + "ipGroups": "ipg-", + "loadBalancerInternal": "lbi-", + "loadBalancerExternal": "lbe-", + "loadBalancerRule": "rule-", + "localNetworkGateway": "lgw-", + "natGateway": "ng-", + "networkInterface": "nic-", + "networkSecurityGroup": "nsg-", + "networkSecurityGroupSecurityRules": "nsgsr-", + "networkWatcher": "nw-", + "privateLink": "pl-", + "privateEndpoint": "pep-", + "publicIPAddress": "pip-", + "publicIPAddressPrefix": "ippre-", + "routeFilter": "rf-", + "routeServer": "rtserv-", + "routeTable": "rt-", + "serviceEndpointPolicy": "se-", + "trafficManagerProfile": "traf-", + "userDefinedRoute": "udr-", + "virtualNetwork": "vnet-", + "virtualNetworkGateway": "vgw-", + "virtualNetworkManager": "vnm-", + "virtualNetworkPeering": "peer-", + "virtualNetworkSubnet": "snet-", + "virtualWAN": "vwan-", + "virtualWANHub": "vhub-" + }, + "security": { + "bastion": "bas-", + "keyVault": "kv-", + "keyVaultManagedHSM": "kvmhsm-", + "managedIdentity": "id-", + "sshKey": "sshkey-", + "vpnGateway": "vpng-", + "vpnConnection": "vcn-", + "vpnSite": "vst-", + "webApplicationFirewallPolicy": "waf", + "webApplicationFirewallPolicyRuleGroup": "wafrg" + }, + "storage": { + "storSimple": "ssimp", + "backupVault": "bvault-", + "backupVaultPolicy": "bkpol-", + "fileShare": "share-", + "storageAccount": "st", + "storageSyncService": "sss-" + }, + "virtualDesktop": { + "labServicesPlan": "lp-", + "virtualDesktopHostPool": "vdpool-", + "virtualDesktopApplicationGroup": "vdag-", + "virtualDesktopWorkspace": "vdws-", + "virtualDesktopScalingPlan": "vdscaling-" + } + } \ No newline at end of file diff --git a/infra/deploy_ai_foundry.bicep b/infra/deploy_ai_foundry.bicep index ee9b3b37..11b40bf0 100644 --- a/infra/deploy_ai_foundry.bicep +++ b/infra/deploy_ai_foundry.bicep @@ -9,18 +9,21 @@ param aiServicesEndpoint string param aiServicesKey string param aiServicesId string -var storageName = '${solutionName}hubstorage' +// Load the abbrevations file required to name the azure resources. +var abbrs = loadJsonContent('./abbreviations.json') + +var storageName = '${abbrs.storage.storageAccount}${solutionName}hub' var storageSkuName = 'Standard_LRS' -var aiServicesName = '${solutionName}-aiservices' -var workspaceName = '${solutionName}-workspace' -var keyvaultName = '${solutionName}-kv' +var aiServicesName = '${abbrs.ai.aiServices}${solutionName}' +var workspaceName = '${abbrs.managementGovernance.logAnalyticsWorkspace}${solutionName}hub' +//var keyvaultName = '${abbrs.security.keyVault}${solutionName}' var location = solutionLocation -var aiHubName = '${solutionName}-aihub' +var aiHubName = '${abbrs.ai.aiHub}${solutionName}' var aiHubFriendlyName = aiHubName -var aiHubDescription = 'AI Hub for KM template' -var aiProjectName = '${solutionName}-aiproject' +var aiHubDescription = 'AI Hub for MACAE template' +var aiProjectName = '${abbrs.ai.aiHubProject}${solutionName}' var aiProjectFriendlyName = aiProjectName -var aiSearchName = '${solutionName}-search' +var aiSearchName = '${abbrs.ai.aiSearch}${solutionName}' resource keyVault 'Microsoft.KeyVault/vaults@2022-07-01' existing = { @@ -133,11 +136,8 @@ resource aiHub 'Microsoft.MachineLearningServices/workspaces@2023-08-01-preview' properties: { category: 'AIServices' target: aiServicesEndpoint - authType: 'ApiKey' + authType: 'AAD' isSharedToAll: true - credentials: { - key: aiServicesKey - } metadata: { ApiType: 'Azure' ResourceId: aiServicesId @@ -159,6 +159,19 @@ resource aiHubProject 'Microsoft.MachineLearningServices/workspaces@2024-01-01-p } } +resource aiDeveloper 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = { + name: '64702f94-c441-49e6-a78b-ef80e0188fee' +} + +resource aiDevelopertoAIProject 'Microsoft.Authorization/roleAssignments@2022-04-01' = { + name: guid(aiHubProject.id, aiDeveloper.id) + scope: resourceGroup() + properties: { + roleDefinitionId: aiDeveloper.id + principalId: aiHubProject.identity.principalId + } +} + resource tenantIdEntry 'Microsoft.KeyVault/vaults/secrets@2021-11-01-preview' = { parent: keyVault name: 'TENANT-ID' @@ -287,7 +300,7 @@ resource azureLocatioEntry 'Microsoft.KeyVault/vaults/secrets@2021-11-01-preview } } -output keyvaultName string = keyvaultName +output keyvaultName string = keyVaultName output keyvaultId string = keyVault.id output aiServicesName string = aiServicesName diff --git a/infra/deploy_keyvault.bicep b/infra/deploy_keyvault.bicep index 5222a9f8..3a5c1f76 100644 --- a/infra/deploy_keyvault.bicep +++ b/infra/deploy_keyvault.bicep @@ -1,11 +1,8 @@ -@minLength(3) -@maxLength(15) -@description('Solution Name') -param solutionName string param solutionLocation string param managedIdentityObjectId string -var keyvaultName = '${solutionName}-kv' +@description('KeyVault Name') +param keyvaultName string resource keyVault 'Microsoft.KeyVault/vaults@2022-07-01' = { name: keyvaultName @@ -35,9 +32,7 @@ resource keyVault 'Microsoft.KeyVault/vaults@2022-07-01' = { enabledForDeployment: true enabledForDiskEncryption: true enabledForTemplateDeployment: true - enableSoftDelete: false enableRbacAuthorization: true - enablePurgeProtection: true publicNetworkAccess: 'enabled' sku: { family: 'A' diff --git a/infra/deploy_managed_identity.bicep b/infra/deploy_managed_identity.bicep index 08a2b51a..5288872c 100644 --- a/infra/deploy_managed_identity.bicep +++ b/infra/deploy_managed_identity.bicep @@ -1,18 +1,13 @@ // ========== Managed Identity ========== // targetScope = 'resourceGroup' -@minLength(3) -@maxLength(15) -@description('Solution Name') -param solutionName string - @description('Solution Location') //param solutionLocation string param managedIdentityId string param managedIdentityPropPrin string param managedIdentityLocation string -@description('Name') -param miName string = '${ solutionName }-managed-identity' +@description('Managed Identity Name') +param miName string // resource managedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = { // name: miName diff --git a/infra/main.bicep b/infra/main.bicep index fd4cf634..9630ff10 100644 --- a/infra/main.bicep +++ b/infra/main.bicep @@ -1,6 +1,4 @@ targetScope = 'resourceGroup' -@description('Location for all resources.') -param location string @allowed([ 'australiaeast' @@ -28,16 +26,23 @@ param location string 'westus3' ]) @description('Location for all Ai services resources. This location can be different from the resource group location.') -param azureOpenAILocation string = 'eastus2' // The location used for all deployed resources. This location must be in the same region as the resource group. +param azureOpenAILocation string @minLength(3) @maxLength(20) @description('A unique prefix for all resources in this deployment. This should be 3-20 characters long:') param environmentName string - -var uniqueId = toLower(uniqueString(subscription().id, environmentName, resourceGroup().location)) + +@description('Set this if you want to deploy to a different region than the resource group. Otherwise, it will use the resource group location by default.') +param AZURE_LOCATION string='' +var solutionLocation = empty(AZURE_LOCATION) ? resourceGroup().location : AZURE_LOCATION + +var uniqueId = toLower(uniqueString(subscription().id, environmentName, solutionLocation)) var solutionPrefix = 'ma${padLeft(take(uniqueId, 12), 12, '0')}' +// Load the abbrevations file required to name the azure resources. +var abbrs = loadJsonContent('./abbreviations.json') + @description('Tags to apply to all deployed resources') param tags object = {} @@ -62,7 +67,7 @@ param resourceSize { param capacity int = 140 var modelVersion = '2024-08-06' -var aiServicesName = '${solutionPrefix}-aiservices' +var aiServicesName = '${abbrs.ai.aiServices}${solutionPrefix}' var deploymentType = 'GlobalStandard' var gptModelVersion = 'gpt-4o' var appVersion = 'latest' @@ -73,12 +78,12 @@ var dockerRegistryUrl = 'https://${resgistryName}.azurecr.io' var backendDockerImageURL = '${resgistryName}.azurecr.io/macaebackend:${appVersion}' var frontendDockerImageURL = '${resgistryName}.azurecr.io/macaefrontend:${appVersion}' -var uniqueNameFormat = '${solutionPrefix}-{0}-${uniqueString(resourceGroup().id, solutionPrefix)}' +//var uniqueNameFormat = '${solutionPrefix}-{0}-${uniqueString(resourceGroup().id, solutionPrefix)}' var aoaiApiVersion = '2025-01-01-preview' resource logAnalytics 'Microsoft.OperationalInsights/workspaces@2023-09-01' = { - name: format(uniqueNameFormat, 'logs') - location: location + name: '${abbrs.managementGovernance.logAnalyticsWorkspace}${solutionPrefix}' + location: solutionLocation tags: tags properties: { retentionInDays: 30 @@ -89,8 +94,8 @@ resource logAnalytics 'Microsoft.OperationalInsights/workspaces@2023-09-01' = { } resource appInsights 'Microsoft.Insights/components@2020-02-02-preview' = { - name: format(uniqueNameFormat, 'appins') - location: location + name: '${abbrs.managementGovernance.applicationInsights}${solutionPrefix}' + location: solutionLocation kind: 'web' properties: { Application_Type: 'web' @@ -113,7 +118,7 @@ var aiModelDeployments = [ resource aiServices 'Microsoft.CognitiveServices/accounts@2024-04-01-preview' = { name: aiServicesName - location: location + location: azureOpenAILocation sku: { name: 'S0' } @@ -123,7 +128,8 @@ resource aiServices 'Microsoft.CognitiveServices/accounts@2024-04-01-preview' = apiProperties: { //statisticsEnabled: false } - //disableLocalAuth: true + disableLocalAuth: true + publicNetworkAccess: 'Enabled' } } @@ -149,9 +155,9 @@ resource aiServicesDeployments 'Microsoft.CognitiveServices/accounts/deployments module kvault 'deploy_keyvault.bicep' = { name: 'deploy_keyvault' params: { - solutionName: solutionPrefix - solutionLocation: location + solutionLocation: solutionLocation managedIdentityObjectId: managedIdentityModule.outputs.managedIdentityOutput.objectId + keyvaultName: '${abbrs.security.keyVault}${solutionPrefix}' } scope: resourceGroup(resourceGroup().name) } @@ -191,8 +197,8 @@ resource acaAoaiRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04- } resource cosmos 'Microsoft.DocumentDB/databaseAccounts@2024-05-15' = { - name: format(uniqueNameFormat, 'cosmos') - location: location + name: '${abbrs.databases.cosmosDBDatabase}${solutionPrefix}' + location: solutionLocation tags: tags kind: 'GlobalDocumentDB' properties: { @@ -201,7 +207,7 @@ resource cosmos 'Microsoft.DocumentDB/databaseAccounts@2024-05-15' = { locations: [ { failoverPriority: 0 - locationName: location + locationName: solutionLocation } ] capabilities: [{ name: 'EnableServerless' }] @@ -212,11 +218,11 @@ resource cosmos 'Microsoft.DocumentDB/databaseAccounts@2024-05-15' = { name: '00000000-0000-0000-0000-000000000002' } - resource autogenDb 'sqlDatabases' = { - name: 'autogen' + resource macaeDb 'sqlDatabases' = { + name: 'macae' properties: { resource: { - id: 'autogen' + id: 'macae' createMode: 'Default' } } @@ -241,13 +247,13 @@ resource cosmos 'Microsoft.DocumentDB/databaseAccounts@2024-05-15' = { // Define existing ACR resource resource pullIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-07-31-preview' = { - name: format(uniqueNameFormat, 'containerapp-pull') - location: location + name: '${abbrs.security.managedIdentity}${solutionPrefix}-containerapp-pull' + location: solutionLocation } resource containerAppEnv 'Microsoft.App/managedEnvironments@2024-03-01' = { - name: format(uniqueNameFormat, 'containerapp') - location: location + name: '${abbrs.containers.containerAppsEnvironment}${solutionPrefix}' + location: solutionLocation tags: tags properties: { daprAIConnectionString: appInsights.properties.ConnectionString @@ -279,8 +285,8 @@ resource acaCosomsRoleAssignment 'Microsoft.DocumentDB/databaseAccounts/sqlRoleA @description('') resource containerApp 'Microsoft.App/containerApps@2024-03-01' = { - name: '${solutionPrefix}-backend' - location: location + name: '${abbrs.containers.containerApp}${solutionPrefix}-backend' + location: solutionLocation tags: tags identity: { type: 'SystemAssigned, UserAssigned' @@ -296,8 +302,8 @@ resource containerApp 'Microsoft.App/containerApps@2024-03-01' = { external: true corsPolicy: { allowedOrigins: [ - 'https://${format(uniqueNameFormat, 'frontend')}.azurewebsites.net' - 'http://${format(uniqueNameFormat, 'frontend')}.azurewebsites.net' + 'https://${abbrs.compute.webApp}${solutionPrefix}-frontend.azurewebsites.net' + 'http://${abbrs.compute.webApp}${solutionPrefix}-frontend.azurewebsites.net' ] } } @@ -333,11 +339,11 @@ resource containerApp 'Microsoft.App/containerApps@2024-03-01' = { } { name: 'COSMOSDB_DATABASE' - value: cosmos::autogenDb.name + value: cosmos::macaeDb.name } { name: 'COSMOSDB_CONTAINER' - value: cosmos::autogenDb::memoryContainer.name + value: cosmos::macaeDb::memoryContainer.name } { name: 'AZURE_OPENAI_ENDPOINT' @@ -381,7 +387,7 @@ resource containerApp 'Microsoft.App/containerApps@2024-03-01' = { } { name: 'FRONTEND_SITE_NAME' - value: 'https://${format(uniqueNameFormat, 'frontend')}.azurewebsites.net' + value: 'https://${abbrs.compute.webApp}${solutionPrefix}-frontend.azurewebsites.net' } ] } @@ -390,13 +396,13 @@ resource containerApp 'Microsoft.App/containerApps@2024-03-01' = { } } resource frontendAppServicePlan 'Microsoft.Web/serverfarms@2021-02-01' = { - name: format(uniqueNameFormat, 'frontend-plan') - location: location + name: '${abbrs.compute.appServicePlan}${solutionPrefix}-frontend' + location: solutionLocation tags: tags sku: { - name: 'P1v2' + name: 'B2' capacity: 1 - tier: 'PremiumV2' + tier: 'Basic' } properties: { reserved: true @@ -405,8 +411,8 @@ resource frontendAppServicePlan 'Microsoft.Web/serverfarms@2021-02-01' = { } resource frontendAppService 'Microsoft.Web/sites@2021-02-01' = { - name: format(uniqueNameFormat, 'frontend') - location: location + name: '${abbrs.compute.webApp}${solutionPrefix}-frontend' + location: solutionLocation tags: tags kind: 'app,linux,container' properties: { @@ -440,7 +446,7 @@ resource frontendAppService 'Microsoft.Web/sites@2021-02-01' = { } dependsOn: [containerApp] identity: { - type: 'SystemAssigned,UserAssigned' + type: 'SystemAssigned, UserAssigned' userAssignedIdentities: { '${pullIdentity.id}': {} } @@ -448,7 +454,7 @@ resource frontendAppService 'Microsoft.Web/sites@2021-02-01' = { } resource aiHubProject 'Microsoft.MachineLearningServices/workspaces@2024-01-01-preview' existing = { - name: '${solutionPrefix}-aiproject' // aiProjectName must be calculated - available at main start. + name: '${abbrs.ai.aiHubProject}${solutionPrefix}' // aiProjectName must be calculated - available at main start. } resource aiDeveloper 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = { @@ -469,11 +475,11 @@ var cosmosAssignCli = 'az cosmosdb sql role assignment create --resource-group " module managedIdentityModule 'deploy_managed_identity.bicep' = { name: 'deploy_managed_identity' params: { - solutionName: solutionPrefix //solutionLocation: location managedIdentityId: pullIdentity.id managedIdentityPropPrin: pullIdentity.properties.principalId managedIdentityLocation: pullIdentity.location + miName: '${abbrs.security.managedIdentity}${solutionPrefix}' } scope: resourceGroup(resourceGroup().name) } @@ -486,7 +492,7 @@ module deploymentScriptCLI 'br/public:avm/res/resources/deployment-script:0.5.1' name: 'rdsmin001' // Non-required parameters azCliVersion: '2.69.0' - location: location + location: solutionLocation managedIdentities: { userAssignedResourceIds: [ managedIdentityModule.outputs.managedIdentityId diff --git a/infra/main.bicepparam b/infra/main.bicepparam new file mode 100644 index 00000000..a95a9f06 --- /dev/null +++ b/infra/main.bicepparam @@ -0,0 +1,5 @@ +using './main.bicep' + +param environmentName = readEnvironmentVariable('AZURE_ENV_NAME', 'macaetemplate') +param AZURE_LOCATION = readEnvironmentVariable('AZURE_LOCATION', '') +param azureOpenAILocation = readEnvironmentVariable('AZURE_OPENAI_LOCATION', 'eastus2') diff --git a/infra/main.json b/infra/main.json index 5f59e03b..010b65f6 100644 --- a/infra/main.json +++ b/infra/main.json @@ -10,15 +10,8 @@ } }, "parameters": { - "location": { - "type": "string", - "metadata": { - "description": "Location for all resources." - } - }, "azureOpenAILocation": { "type": "string", - "defaultValue": "eastus2", "allowedValues": [ "australiaeast", "brazilsouth", @@ -56,6 +49,13 @@ "description": "A unique prefix for all resources in this deployment. This should be 3-20 characters long:" } }, + "AZURE_LOCATION": { + "type": "string", + "defaultValue": "", + "metadata": { + "description": "Set this if you want to deploy to a different region than the resource group. Otherwise, it will use the resource group location by default." + } + }, "tags": { "type": "object", "defaultValue": {}, @@ -106,10 +106,239 @@ } }, "variables": { - "uniqueId": "[toLower(uniqueString(subscription().id, parameters('environmentName'), resourceGroup().location))]", + "$fxv#0": { + "ai": { + "aiSearch": "srch-", + "aiServices": "aisa-", + "aiVideoIndexer": "avi-", + "machineLearningWorkspace": "mlw-", + "openAIService": "oai-", + "botService": "bot-", + "computerVision": "cv-", + "contentModerator": "cm-", + "contentSafety": "cs-", + "customVisionPrediction": "cstv-", + "customVisionTraining": "cstvt-", + "documentIntelligence": "di-", + "faceApi": "face-", + "healthInsights": "hi-", + "immersiveReader": "ir-", + "languageService": "lang-", + "speechService": "spch-", + "translator": "trsl-", + "aiHub": "aih-", + "aiHubProject": "aihp-" + }, + "analytics": { + "analysisServicesServer": "as", + "databricksWorkspace": "dbw-", + "dataExplorerCluster": "dec", + "dataExplorerClusterDatabase": "dedb", + "dataFactory": "adf-", + "digitalTwin": "dt-", + "streamAnalytics": "asa-", + "synapseAnalyticsPrivateLinkHub": "synplh-", + "synapseAnalyticsSQLDedicatedPool": "syndp", + "synapseAnalyticsSparkPool": "synsp", + "synapseAnalyticsWorkspaces": "synw", + "dataLakeStoreAccount": "dls", + "dataLakeAnalyticsAccount": "dla", + "eventHubsNamespace": "evhns-", + "eventHub": "evh-", + "eventGridDomain": "evgd-", + "eventGridSubscriptions": "evgs-", + "eventGridTopic": "evgt-", + "eventGridSystemTopic": "egst-", + "hdInsightHadoopCluster": "hadoop-", + "hdInsightHBaseCluster": "hbase-", + "hdInsightKafkaCluster": "kafka-", + "hdInsightSparkCluster": "spark-", + "hdInsightStormCluster": "storm-", + "hdInsightMLServicesCluster": "mls-", + "iotHub": "iot-", + "provisioningServices": "provs-", + "provisioningServicesCertificate": "pcert-", + "powerBIEmbedded": "pbi-", + "timeSeriesInsightsEnvironment": "tsi-" + }, + "compute": { + "appServiceEnvironment": "ase-", + "appServicePlan": "asp-", + "loadTesting": "lt-", + "availabilitySet": "avail-", + "arcEnabledServer": "arcs-", + "arcEnabledKubernetesCluster": "arck", + "batchAccounts": "ba-", + "cloudService": "cld-", + "communicationServices": "acs-", + "diskEncryptionSet": "des", + "functionApp": "func-", + "gallery": "gal", + "hostingEnvironment": "host-", + "imageTemplate": "it-", + "managedDiskOS": "osdisk", + "managedDiskData": "disk", + "notificationHubs": "ntf-", + "notificationHubsNamespace": "ntfns-", + "proximityPlacementGroup": "ppg-", + "restorePointCollection": "rpc-", + "snapshot": "snap-", + "staticWebApp": "stapp-", + "virtualMachine": "vm", + "virtualMachineScaleSet": "vmss-", + "virtualMachineMaintenanceConfiguration": "mc-", + "virtualMachineStorageAccount": "stvm", + "webApp": "app-" + }, + "containers": { + "aksCluster": "aks-", + "aksSystemNodePool": "npsystem-", + "aksUserNodePool": "np-", + "containerApp": "ca-", + "containerAppsEnvironment": "cae-", + "containerRegistry": "cr", + "containerInstance": "ci", + "serviceFabricCluster": "sf-", + "serviceFabricManagedCluster": "sfmc-" + }, + "databases": { + "cosmosDBDatabase": "cosmos-", + "cosmosDBApacheCassandra": "coscas-", + "cosmosDBMongoDB": "cosmon-", + "cosmosDBNoSQL": "cosno-", + "cosmosDBTable": "costab-", + "cosmosDBGremlin": "cosgrm-", + "cosmosDBPostgreSQL": "cospos-", + "cacheForRedis": "redis-", + "sqlDatabaseServer": "sql-", + "sqlDatabase": "sqldb-", + "sqlElasticJobAgent": "sqlja-", + "sqlElasticPool": "sqlep-", + "mariaDBServer": "maria-", + "mariaDBDatabase": "mariadb-", + "mySQLDatabase": "mysql-", + "postgreSQLDatabase": "psql-", + "sqlServerStretchDatabase": "sqlstrdb-", + "sqlManagedInstance": "sqlmi-" + }, + "developerTools": { + "appConfigurationStore": "appcs-", + "mapsAccount": "map-", + "signalR": "sigr", + "webPubSub": "wps-" + }, + "devOps": { + "managedGrafana": "amg-" + }, + "integration": { + "apiManagementService": "apim-", + "integrationAccount": "ia-", + "logicApp": "logic-", + "serviceBusNamespace": "sbns-", + "serviceBusQueue": "sbq-", + "serviceBusTopic": "sbt-", + "serviceBusTopicSubscription": "sbts-" + }, + "managementGovernance": { + "automationAccount": "aa-", + "applicationInsights": "appi-", + "monitorActionGroup": "ag-", + "monitorDataCollectionRules": "dcr-", + "monitorAlertProcessingRule": "apr-", + "blueprint": "bp-", + "blueprintAssignment": "bpa-", + "dataCollectionEndpoint": "dce-", + "logAnalyticsWorkspace": "log-", + "logAnalyticsQueryPacks": "pack-", + "managementGroup": "mg-", + "purviewInstance": "pview-", + "resourceGroup": "rg-", + "templateSpecsName": "ts-" + }, + "migration": { + "migrateProject": "migr-", + "databaseMigrationService": "dms-", + "recoveryServicesVault": "rsv-" + }, + "networking": { + "applicationGateway": "agw-", + "applicationSecurityGroup": "asg-", + "cdnProfile": "cdnp-", + "cdnEndpoint": "cdne-", + "connections": "con-", + "dnsForwardingRuleset": "dnsfrs-", + "dnsPrivateResolver": "dnspr-", + "dnsPrivateResolverInboundEndpoint": "in-", + "dnsPrivateResolverOutboundEndpoint": "out-", + "firewall": "afw-", + "firewallPolicy": "afwp-", + "expressRouteCircuit": "erc-", + "expressRouteGateway": "ergw-", + "frontDoorProfile": "afd-", + "frontDoorEndpoint": "fde-", + "frontDoorFirewallPolicy": "fdfp-", + "ipGroups": "ipg-", + "loadBalancerInternal": "lbi-", + "loadBalancerExternal": "lbe-", + "loadBalancerRule": "rule-", + "localNetworkGateway": "lgw-", + "natGateway": "ng-", + "networkInterface": "nic-", + "networkSecurityGroup": "nsg-", + "networkSecurityGroupSecurityRules": "nsgsr-", + "networkWatcher": "nw-", + "privateLink": "pl-", + "privateEndpoint": "pep-", + "publicIPAddress": "pip-", + "publicIPAddressPrefix": "ippre-", + "routeFilter": "rf-", + "routeServer": "rtserv-", + "routeTable": "rt-", + "serviceEndpointPolicy": "se-", + "trafficManagerProfile": "traf-", + "userDefinedRoute": "udr-", + "virtualNetwork": "vnet-", + "virtualNetworkGateway": "vgw-", + "virtualNetworkManager": "vnm-", + "virtualNetworkPeering": "peer-", + "virtualNetworkSubnet": "snet-", + "virtualWAN": "vwan-", + "virtualWANHub": "vhub-" + }, + "security": { + "bastion": "bas-", + "keyVault": "kv-", + "keyVaultManagedHSM": "kvmhsm-", + "managedIdentity": "id-", + "sshKey": "sshkey-", + "vpnGateway": "vpng-", + "vpnConnection": "vcn-", + "vpnSite": "vst-", + "webApplicationFirewallPolicy": "waf", + "webApplicationFirewallPolicyRuleGroup": "wafrg" + }, + "storage": { + "storSimple": "ssimp", + "backupVault": "bvault-", + "backupVaultPolicy": "bkpol-", + "fileShare": "share-", + "storageAccount": "st", + "storageSyncService": "sss-" + }, + "virtualDesktop": { + "labServicesPlan": "lp-", + "virtualDesktopHostPool": "vdpool-", + "virtualDesktopApplicationGroup": "vdag-", + "virtualDesktopWorkspace": "vdws-", + "virtualDesktopScalingPlan": "vdscaling-" + } + }, + "solutionLocation": "[if(empty(parameters('AZURE_LOCATION')), resourceGroup().location, parameters('AZURE_LOCATION'))]", + "uniqueId": "[toLower(uniqueString(subscription().id, parameters('environmentName'), variables('solutionLocation')))]", "solutionPrefix": "[format('ma{0}', padLeft(take(variables('uniqueId'), 12), 12, '0'))]", + "abbrs": "[variables('$fxv#0')]", "modelVersion": "2024-08-06", - "aiServicesName": "[format('{0}-aiservices', variables('solutionPrefix'))]", + "aiServicesName": "[format('{0}{1}', variables('abbrs').ai.aiServices, variables('solutionPrefix'))]", "deploymentType": "GlobalStandard", "gptModelVersion": "gpt-4o", "appVersion": "latest", @@ -117,7 +346,6 @@ "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}', variables('solutionPrefix'), uniqueString(resourceGroup().id, variables('solutionPrefix')))]", "aoaiApiVersion": "2025-01-01-preview", "aiModelDeployments": [ { @@ -133,10 +361,10 @@ ] }, "resources": { - "cosmos::autogenDb::memoryContainer": { + "cosmos::macaeDb::memoryContainer": { "type": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers", "apiVersion": "2024-05-15", - "name": "[format('{0}/{1}/{2}', format(variables('uniqueNameFormat'), 'cosmos'), 'autogen', 'memory')]", + "name": "[format('{0}/{1}/{2}', format('{0}{1}', variables('abbrs').databases.cosmosDBDatabase, variables('solutionPrefix')), 'macae', 'memory')]", "properties": { "resource": { "id": "memory", @@ -150,25 +378,25 @@ } }, "dependsOn": [ - "cosmos::autogenDb" + "cosmos::macaeDb" ] }, "cosmos::contributorRoleDefinition": { "existing": true, "type": "Microsoft.DocumentDB/databaseAccounts/sqlRoleDefinitions", "apiVersion": "2024-05-15", - "name": "[format('{0}/{1}', format(variables('uniqueNameFormat'), 'cosmos'), '00000000-0000-0000-0000-000000000002')]", + "name": "[format('{0}/{1}', format('{0}{1}', variables('abbrs').databases.cosmosDBDatabase, variables('solutionPrefix')), '00000000-0000-0000-0000-000000000002')]", "dependsOn": [ "cosmos" ] }, - "cosmos::autogenDb": { + "cosmos::macaeDb": { "type": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases", "apiVersion": "2024-05-15", - "name": "[format('{0}/{1}', format(variables('uniqueNameFormat'), 'cosmos'), 'autogen')]", + "name": "[format('{0}/{1}', format('{0}{1}', variables('abbrs').databases.cosmosDBDatabase, variables('solutionPrefix')), 'macae')]", "properties": { "resource": { - "id": "autogen", + "id": "macae", "createMode": "Default" } }, @@ -179,7 +407,7 @@ "containerAppEnv::aspireDashboard": { "type": "Microsoft.App/managedEnvironments/dotNetComponents", "apiVersion": "2024-02-02-preview", - "name": "[format('{0}/{1}', format(variables('uniqueNameFormat'), 'containerapp'), 'aspire-dashboard')]", + "name": "[format('{0}/{1}', format('{0}{1}', variables('abbrs').containers.containerAppsEnvironment, variables('solutionPrefix')), 'aspire-dashboard')]", "properties": { "componentType": "AspireDashboard" }, @@ -190,8 +418,8 @@ "logAnalytics": { "type": "Microsoft.OperationalInsights/workspaces", "apiVersion": "2023-09-01", - "name": "[format(variables('uniqueNameFormat'), 'logs')]", - "location": "[parameters('location')]", + "name": "[format('{0}{1}', variables('abbrs').managementGovernance.logAnalyticsWorkspace, variables('solutionPrefix'))]", + "location": "[variables('solutionLocation')]", "tags": "[parameters('tags')]", "properties": { "retentionInDays": 30, @@ -203,12 +431,12 @@ "appInsights": { "type": "Microsoft.Insights/components", "apiVersion": "2020-02-02-preview", - "name": "[format(variables('uniqueNameFormat'), 'appins')]", - "location": "[parameters('location')]", + "name": "[format('{0}{1}', variables('abbrs').managementGovernance.applicationInsights, variables('solutionPrefix'))]", + "location": "[variables('solutionLocation')]", "kind": "web", "properties": { "Application_Type": "web", - "WorkspaceResourceId": "[resourceId('Microsoft.OperationalInsights/workspaces', format(variables('uniqueNameFormat'), 'logs'))]" + "WorkspaceResourceId": "[resourceId('Microsoft.OperationalInsights/workspaces', format('{0}{1}', variables('abbrs').managementGovernance.logAnalyticsWorkspace, variables('solutionPrefix')))]" }, "dependsOn": [ "logAnalytics" @@ -218,14 +446,16 @@ "type": "Microsoft.CognitiveServices/accounts", "apiVersion": "2024-04-01-preview", "name": "[variables('aiServicesName')]", - "location": "[parameters('location')]", + "location": "[parameters('azureOpenAILocation')]", "sku": { "name": "S0" }, "kind": "AIServices", "properties": { "customSubDomainName": "[variables('aiServicesName')]", - "apiProperties": {} + "apiProperties": {}, + "disableLocalAuth": true, + "publicNetworkAccess": "Enabled" } }, "aiServicesDeployments": { @@ -262,7 +492,7 @@ "type": "Microsoft.Authorization/roleAssignments", "apiVersion": "2022-04-01", "scope": "[format('Microsoft.CognitiveServices/accounts/{0}', variables('aiServicesName'))]", - "name": "[guid(resourceId('Microsoft.App/containerApps', format('{0}-backend', variables('solutionPrefix'))), resourceId('Microsoft.CognitiveServices/accounts', variables('aiServicesName')), resourceId('Microsoft.Authorization/roleDefinitions', '5e0bd9bd-7b93-4f28-af87-19fc36ad61bd'))]", + "name": "[guid(resourceId('Microsoft.App/containerApps', format('{0}{1}-backend', variables('abbrs').containers.containerApp, variables('solutionPrefix'))), resourceId('Microsoft.CognitiveServices/accounts', variables('aiServicesName')), resourceId('Microsoft.Authorization/roleDefinitions', '5e0bd9bd-7b93-4f28-af87-19fc36ad61bd'))]", "properties": { "principalId": "[reference('containerApp', '2024-03-01', 'full').identity.principalId]", "roleDefinitionId": "[resourceId('Microsoft.Authorization/roleDefinitions', '5e0bd9bd-7b93-4f28-af87-19fc36ad61bd')]", @@ -276,8 +506,8 @@ "cosmos": { "type": "Microsoft.DocumentDB/databaseAccounts", "apiVersion": "2024-05-15", - "name": "[format(variables('uniqueNameFormat'), 'cosmos')]", - "location": "[parameters('location')]", + "name": "[format('{0}{1}', variables('abbrs').databases.cosmosDBDatabase, variables('solutionPrefix'))]", + "location": "[variables('solutionLocation')]", "tags": "[parameters('tags')]", "kind": "GlobalDocumentDB", "properties": { @@ -286,7 +516,7 @@ "locations": [ { "failoverPriority": 0, - "locationName": "[parameters('location')]" + "locationName": "[variables('solutionLocation')]" } ], "capabilities": [ @@ -300,14 +530,14 @@ "pullIdentity": { "type": "Microsoft.ManagedIdentity/userAssignedIdentities", "apiVersion": "2023-07-31-preview", - "name": "[format(variables('uniqueNameFormat'), 'containerapp-pull')]", - "location": "[parameters('location')]" + "name": "[format('{0}{1}-containerapp-pull', variables('abbrs').security.managedIdentity, variables('solutionPrefix'))]", + "location": "[variables('solutionLocation')]" }, "containerAppEnv": { "type": "Microsoft.App/managedEnvironments", "apiVersion": "2024-03-01", - "name": "[format(variables('uniqueNameFormat'), 'containerapp')]", - "location": "[parameters('location')]", + "name": "[format('{0}{1}', variables('abbrs').containers.containerAppsEnvironment, variables('solutionPrefix'))]", + "location": "[variables('solutionLocation')]", "tags": "[parameters('tags')]", "properties": { "daprAIConnectionString": "[reference('appInsights').ConnectionString]", @@ -327,11 +557,11 @@ "acaCosomsRoleAssignment": { "type": "Microsoft.DocumentDB/databaseAccounts/sqlRoleAssignments", "apiVersion": "2024-05-15", - "name": "[format('{0}/{1}', format(variables('uniqueNameFormat'), 'cosmos'), guid(resourceId('Microsoft.App/containerApps', format('{0}-backend', variables('solutionPrefix'))), resourceId('Microsoft.DocumentDB/databaseAccounts/sqlRoleDefinitions', format(variables('uniqueNameFormat'), 'cosmos'), '00000000-0000-0000-0000-000000000002')))]", + "name": "[format('{0}/{1}', format('{0}{1}', variables('abbrs').databases.cosmosDBDatabase, variables('solutionPrefix')), guid(resourceId('Microsoft.App/containerApps', format('{0}{1}-backend', variables('abbrs').containers.containerApp, variables('solutionPrefix'))), resourceId('Microsoft.DocumentDB/databaseAccounts/sqlRoleDefinitions', format('{0}{1}', variables('abbrs').databases.cosmosDBDatabase, variables('solutionPrefix')), '00000000-0000-0000-0000-000000000002')))]", "properties": { "principalId": "[reference('containerApp', '2024-03-01', 'full').identity.principalId]", - "roleDefinitionId": "[resourceId('Microsoft.DocumentDB/databaseAccounts/sqlRoleDefinitions', format(variables('uniqueNameFormat'), 'cosmos'), '00000000-0000-0000-0000-000000000002')]", - "scope": "[resourceId('Microsoft.DocumentDB/databaseAccounts', format(variables('uniqueNameFormat'), 'cosmos'))]" + "roleDefinitionId": "[resourceId('Microsoft.DocumentDB/databaseAccounts/sqlRoleDefinitions', format('{0}{1}', variables('abbrs').databases.cosmosDBDatabase, variables('solutionPrefix')), '00000000-0000-0000-0000-000000000002')]", + "scope": "[resourceId('Microsoft.DocumentDB/databaseAccounts', format('{0}{1}', variables('abbrs').databases.cosmosDBDatabase, variables('solutionPrefix')))]" }, "dependsOn": [ "containerApp", @@ -341,25 +571,25 @@ "containerApp": { "type": "Microsoft.App/containerApps", "apiVersion": "2024-03-01", - "name": "[format('{0}-backend', variables('solutionPrefix'))]", - "location": "[parameters('location')]", + "name": "[format('{0}{1}-backend', variables('abbrs').containers.containerApp, variables('solutionPrefix'))]", + "location": "[variables('solutionLocation')]", "tags": "[parameters('tags')]", "identity": { "type": "SystemAssigned, UserAssigned", "userAssignedIdentities": { - "[format('{0}', resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', format(variables('uniqueNameFormat'), 'containerapp-pull')))]": {} + "[format('{0}', resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', format('{0}{1}-containerapp-pull', variables('abbrs').security.managedIdentity, variables('solutionPrefix'))))]": {} } }, "properties": { - "managedEnvironmentId": "[resourceId('Microsoft.App/managedEnvironments', format(variables('uniqueNameFormat'), 'containerapp'))]", + "managedEnvironmentId": "[resourceId('Microsoft.App/managedEnvironments', format('{0}{1}', variables('abbrs').containers.containerAppsEnvironment, variables('solutionPrefix')))]", "configuration": { "ingress": { "targetPort": 8000, "external": true, "corsPolicy": { "allowedOrigins": [ - "[format('https://{0}.azurewebsites.net', format(variables('uniqueNameFormat'), 'frontend'))]", - "[format('http://{0}.azurewebsites.net', format(variables('uniqueNameFormat'), 'frontend'))]" + "[format('https://{0}{1}-frontend.azurewebsites.net', variables('abbrs').compute.webApp, variables('solutionPrefix'))]", + "[format('http://{0}{1}-frontend.azurewebsites.net', variables('abbrs').compute.webApp, variables('solutionPrefix'))]" ] } }, @@ -395,7 +625,7 @@ }, { "name": "COSMOSDB_DATABASE", - "value": "autogen" + "value": "macae" }, { "name": "COSMOSDB_CONTAINER", @@ -443,7 +673,7 @@ }, { "name": "FRONTEND_SITE_NAME", - "value": "[format('https://{0}.azurewebsites.net', format(variables('uniqueNameFormat'), 'frontend'))]" + "value": "[format('https://{0}{1}-frontend.azurewebsites.net', variables('abbrs').compute.webApp, variables('solutionPrefix'))]" } ] } @@ -456,8 +686,8 @@ "appInsights", "containerAppEnv", "cosmos", - "cosmos::autogenDb", - "cosmos::autogenDb::memoryContainer", + "cosmos::macaeDb", + "cosmos::macaeDb::memoryContainer", "pullIdentity" ], "metadata": { @@ -467,13 +697,13 @@ "frontendAppServicePlan": { "type": "Microsoft.Web/serverfarms", "apiVersion": "2021-02-01", - "name": "[format(variables('uniqueNameFormat'), 'frontend-plan')]", - "location": "[parameters('location')]", + "name": "[format('{0}{1}-frontend', variables('abbrs').compute.appServicePlan, variables('solutionPrefix'))]", + "location": "[variables('solutionLocation')]", "tags": "[parameters('tags')]", "sku": { - "name": "P1v2", + "name": "B2", "capacity": 1, - "tier": "PremiumV2" + "tier": "Basic" }, "properties": { "reserved": true @@ -483,12 +713,12 @@ "frontendAppService": { "type": "Microsoft.Web/sites", "apiVersion": "2021-02-01", - "name": "[format(variables('uniqueNameFormat'), 'frontend')]", - "location": "[parameters('location')]", + "name": "[format('{0}{1}-frontend', variables('abbrs').compute.webApp, variables('solutionPrefix'))]", + "location": "[variables('solutionLocation')]", "tags": "[parameters('tags')]", "kind": "app,linux,container", "properties": { - "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', format(variables('uniqueNameFormat'), 'frontend-plan'))]", + "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', format('{0}{1}-frontend', variables('abbrs').compute.appServicePlan, variables('solutionPrefix')))]", "reserved": true, "siteConfig": { "linuxFxVersion": "[format('DOCKER|{0}', variables('frontendDockerImageURL'))]", @@ -517,9 +747,9 @@ } }, "identity": { - "type": "SystemAssigned,UserAssigned", + "type": "SystemAssigned, UserAssigned", "userAssignedIdentities": { - "[format('{0}', resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', format(variables('uniqueNameFormat'), 'containerapp-pull')))]": {} + "[format('{0}', resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', format('{0}{1}-containerapp-pull', variables('abbrs').security.managedIdentity, variables('solutionPrefix'))))]": {} } }, "dependsOn": [ @@ -532,7 +762,7 @@ "existing": true, "type": "Microsoft.MachineLearningServices/workspaces", "apiVersion": "2024-01-01-preview", - "name": "[format('{0}-aiproject', variables('solutionPrefix'))]" + "name": "[format('{0}{1}', variables('abbrs').ai.aiHubProject, variables('solutionPrefix'))]" }, "aiDeveloper": { "existing": true, @@ -543,8 +773,8 @@ "aiDeveloperAccessProj": { "type": "Microsoft.Authorization/roleAssignments", "apiVersion": "2022-04-01", - "scope": "[format('Microsoft.MachineLearningServices/workspaces/{0}', format('{0}-aiproject', variables('solutionPrefix')))]", - "name": "[guid(format('{0}-backend', variables('solutionPrefix')), resourceId('Microsoft.MachineLearningServices/workspaces', format('{0}-aiproject', variables('solutionPrefix'))), resourceId('Microsoft.Authorization/roleDefinitions', '64702f94-c441-49e6-a78b-ef80e0188fee'))]", + "scope": "[format('Microsoft.MachineLearningServices/workspaces/{0}', format('{0}{1}', variables('abbrs').ai.aiHubProject, variables('solutionPrefix')))]", + "name": "[guid(format('{0}{1}-backend', variables('abbrs').containers.containerApp, variables('solutionPrefix')), resourceId('Microsoft.MachineLearningServices/workspaces', format('{0}{1}', variables('abbrs').ai.aiHubProject, variables('solutionPrefix'))), 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]" @@ -564,14 +794,14 @@ }, "mode": "Incremental", "parameters": { - "solutionName": { - "value": "[variables('solutionPrefix')]" - }, "solutionLocation": { - "value": "[parameters('location')]" + "value": "[variables('solutionLocation')]" }, "managedIdentityObjectId": { "value": "[reference('managedIdentityModule').outputs.managedIdentityOutput.value.objectId]" + }, + "keyvaultName": { + "value": "[format('{0}{1}', variables('abbrs').security.keyVault, variables('solutionPrefix'))]" } }, "template": { @@ -581,33 +811,28 @@ "_generator": { "name": "bicep", "version": "0.35.1.17967", - "templateHash": "5761607453167859573" + "templateHash": "7119862929918770475" } }, "parameters": { - "solutionName": { - "type": "string", - "minLength": 3, - "maxLength": 15, - "metadata": { - "description": "Solution Name" - } - }, "solutionLocation": { "type": "string" }, "managedIdentityObjectId": { "type": "string" + }, + "keyvaultName": { + "type": "string", + "metadata": { + "description": "KeyVault Name" + } } }, - "variables": { - "keyvaultName": "[format('{0}-kv', parameters('solutionName'))]" - }, "resources": [ { "type": "Microsoft.KeyVault/vaults", "apiVersion": "2022-07-01", - "name": "[variables('keyvaultName')]", + "name": "[parameters('keyvaultName')]", "location": "[parameters('solutionLocation')]", "properties": { "createMode": "default", @@ -634,9 +859,7 @@ "enabledForDeployment": true, "enabledForDiskEncryption": true, "enabledForTemplateDeployment": true, - "enableSoftDelete": false, "enableRbacAuthorization": true, - "enablePurgeProtection": true, "publicNetworkAccess": "enabled", "sku": { "family": "A", @@ -660,11 +883,11 @@ "outputs": { "keyvaultName": { "type": "string", - "value": "[variables('keyvaultName')]" + "value": "[parameters('keyvaultName')]" }, "keyvaultId": { "type": "string", - "value": "[resourceId('Microsoft.KeyVault/vaults', variables('keyvaultName'))]" + "value": "[resourceId('Microsoft.KeyVault/vaults', parameters('keyvaultName'))]" } } } @@ -719,7 +942,7 @@ "_generator": { "name": "bicep", "version": "0.35.1.17967", - "templateHash": "9490638595753234802" + "templateHash": "13047093698365252995" } }, "parameters": { @@ -752,18 +975,245 @@ } }, "variables": { - "storageName": "[format('{0}hubstorage', parameters('solutionName'))]", + "$fxv#0": { + "ai": { + "aiSearch": "srch-", + "aiServices": "aisa-", + "aiVideoIndexer": "avi-", + "machineLearningWorkspace": "mlw-", + "openAIService": "oai-", + "botService": "bot-", + "computerVision": "cv-", + "contentModerator": "cm-", + "contentSafety": "cs-", + "customVisionPrediction": "cstv-", + "customVisionTraining": "cstvt-", + "documentIntelligence": "di-", + "faceApi": "face-", + "healthInsights": "hi-", + "immersiveReader": "ir-", + "languageService": "lang-", + "speechService": "spch-", + "translator": "trsl-", + "aiHub": "aih-", + "aiHubProject": "aihp-" + }, + "analytics": { + "analysisServicesServer": "as", + "databricksWorkspace": "dbw-", + "dataExplorerCluster": "dec", + "dataExplorerClusterDatabase": "dedb", + "dataFactory": "adf-", + "digitalTwin": "dt-", + "streamAnalytics": "asa-", + "synapseAnalyticsPrivateLinkHub": "synplh-", + "synapseAnalyticsSQLDedicatedPool": "syndp", + "synapseAnalyticsSparkPool": "synsp", + "synapseAnalyticsWorkspaces": "synw", + "dataLakeStoreAccount": "dls", + "dataLakeAnalyticsAccount": "dla", + "eventHubsNamespace": "evhns-", + "eventHub": "evh-", + "eventGridDomain": "evgd-", + "eventGridSubscriptions": "evgs-", + "eventGridTopic": "evgt-", + "eventGridSystemTopic": "egst-", + "hdInsightHadoopCluster": "hadoop-", + "hdInsightHBaseCluster": "hbase-", + "hdInsightKafkaCluster": "kafka-", + "hdInsightSparkCluster": "spark-", + "hdInsightStormCluster": "storm-", + "hdInsightMLServicesCluster": "mls-", + "iotHub": "iot-", + "provisioningServices": "provs-", + "provisioningServicesCertificate": "pcert-", + "powerBIEmbedded": "pbi-", + "timeSeriesInsightsEnvironment": "tsi-" + }, + "compute": { + "appServiceEnvironment": "ase-", + "appServicePlan": "asp-", + "loadTesting": "lt-", + "availabilitySet": "avail-", + "arcEnabledServer": "arcs-", + "arcEnabledKubernetesCluster": "arck", + "batchAccounts": "ba-", + "cloudService": "cld-", + "communicationServices": "acs-", + "diskEncryptionSet": "des", + "functionApp": "func-", + "gallery": "gal", + "hostingEnvironment": "host-", + "imageTemplate": "it-", + "managedDiskOS": "osdisk", + "managedDiskData": "disk", + "notificationHubs": "ntf-", + "notificationHubsNamespace": "ntfns-", + "proximityPlacementGroup": "ppg-", + "restorePointCollection": "rpc-", + "snapshot": "snap-", + "staticWebApp": "stapp-", + "virtualMachine": "vm", + "virtualMachineScaleSet": "vmss-", + "virtualMachineMaintenanceConfiguration": "mc-", + "virtualMachineStorageAccount": "stvm", + "webApp": "app-" + }, + "containers": { + "aksCluster": "aks-", + "aksSystemNodePool": "npsystem-", + "aksUserNodePool": "np-", + "containerApp": "ca-", + "containerAppsEnvironment": "cae-", + "containerRegistry": "cr", + "containerInstance": "ci", + "serviceFabricCluster": "sf-", + "serviceFabricManagedCluster": "sfmc-" + }, + "databases": { + "cosmosDBDatabase": "cosmos-", + "cosmosDBApacheCassandra": "coscas-", + "cosmosDBMongoDB": "cosmon-", + "cosmosDBNoSQL": "cosno-", + "cosmosDBTable": "costab-", + "cosmosDBGremlin": "cosgrm-", + "cosmosDBPostgreSQL": "cospos-", + "cacheForRedis": "redis-", + "sqlDatabaseServer": "sql-", + "sqlDatabase": "sqldb-", + "sqlElasticJobAgent": "sqlja-", + "sqlElasticPool": "sqlep-", + "mariaDBServer": "maria-", + "mariaDBDatabase": "mariadb-", + "mySQLDatabase": "mysql-", + "postgreSQLDatabase": "psql-", + "sqlServerStretchDatabase": "sqlstrdb-", + "sqlManagedInstance": "sqlmi-" + }, + "developerTools": { + "appConfigurationStore": "appcs-", + "mapsAccount": "map-", + "signalR": "sigr", + "webPubSub": "wps-" + }, + "devOps": { + "managedGrafana": "amg-" + }, + "integration": { + "apiManagementService": "apim-", + "integrationAccount": "ia-", + "logicApp": "logic-", + "serviceBusNamespace": "sbns-", + "serviceBusQueue": "sbq-", + "serviceBusTopic": "sbt-", + "serviceBusTopicSubscription": "sbts-" + }, + "managementGovernance": { + "automationAccount": "aa-", + "applicationInsights": "appi-", + "monitorActionGroup": "ag-", + "monitorDataCollectionRules": "dcr-", + "monitorAlertProcessingRule": "apr-", + "blueprint": "bp-", + "blueprintAssignment": "bpa-", + "dataCollectionEndpoint": "dce-", + "logAnalyticsWorkspace": "log-", + "logAnalyticsQueryPacks": "pack-", + "managementGroup": "mg-", + "purviewInstance": "pview-", + "resourceGroup": "rg-", + "templateSpecsName": "ts-" + }, + "migration": { + "migrateProject": "migr-", + "databaseMigrationService": "dms-", + "recoveryServicesVault": "rsv-" + }, + "networking": { + "applicationGateway": "agw-", + "applicationSecurityGroup": "asg-", + "cdnProfile": "cdnp-", + "cdnEndpoint": "cdne-", + "connections": "con-", + "dnsForwardingRuleset": "dnsfrs-", + "dnsPrivateResolver": "dnspr-", + "dnsPrivateResolverInboundEndpoint": "in-", + "dnsPrivateResolverOutboundEndpoint": "out-", + "firewall": "afw-", + "firewallPolicy": "afwp-", + "expressRouteCircuit": "erc-", + "expressRouteGateway": "ergw-", + "frontDoorProfile": "afd-", + "frontDoorEndpoint": "fde-", + "frontDoorFirewallPolicy": "fdfp-", + "ipGroups": "ipg-", + "loadBalancerInternal": "lbi-", + "loadBalancerExternal": "lbe-", + "loadBalancerRule": "rule-", + "localNetworkGateway": "lgw-", + "natGateway": "ng-", + "networkInterface": "nic-", + "networkSecurityGroup": "nsg-", + "networkSecurityGroupSecurityRules": "nsgsr-", + "networkWatcher": "nw-", + "privateLink": "pl-", + "privateEndpoint": "pep-", + "publicIPAddress": "pip-", + "publicIPAddressPrefix": "ippre-", + "routeFilter": "rf-", + "routeServer": "rtserv-", + "routeTable": "rt-", + "serviceEndpointPolicy": "se-", + "trafficManagerProfile": "traf-", + "userDefinedRoute": "udr-", + "virtualNetwork": "vnet-", + "virtualNetworkGateway": "vgw-", + "virtualNetworkManager": "vnm-", + "virtualNetworkPeering": "peer-", + "virtualNetworkSubnet": "snet-", + "virtualWAN": "vwan-", + "virtualWANHub": "vhub-" + }, + "security": { + "bastion": "bas-", + "keyVault": "kv-", + "keyVaultManagedHSM": "kvmhsm-", + "managedIdentity": "id-", + "sshKey": "sshkey-", + "vpnGateway": "vpng-", + "vpnConnection": "vcn-", + "vpnSite": "vst-", + "webApplicationFirewallPolicy": "waf", + "webApplicationFirewallPolicyRuleGroup": "wafrg" + }, + "storage": { + "storSimple": "ssimp", + "backupVault": "bvault-", + "backupVaultPolicy": "bkpol-", + "fileShare": "share-", + "storageAccount": "st", + "storageSyncService": "sss-" + }, + "virtualDesktop": { + "labServicesPlan": "lp-", + "virtualDesktopHostPool": "vdpool-", + "virtualDesktopApplicationGroup": "vdag-", + "virtualDesktopWorkspace": "vdws-", + "virtualDesktopScalingPlan": "vdscaling-" + } + }, + "abbrs": "[variables('$fxv#0')]", + "storageName": "[format('{0}{1}hub', variables('abbrs').storage.storageAccount, parameters('solutionName'))]", "storageSkuName": "Standard_LRS", - "aiServicesName": "[format('{0}-aiservices', parameters('solutionName'))]", - "workspaceName": "[format('{0}-workspace', parameters('solutionName'))]", - "keyvaultName": "[format('{0}-kv', parameters('solutionName'))]", + "aiServicesName": "[format('{0}{1}', variables('abbrs').ai.aiServices, parameters('solutionName'))]", + "workspaceName": "[format('{0}{1}hub', variables('abbrs').managementGovernance.logAnalyticsWorkspace, parameters('solutionName'))]", "location": "[parameters('solutionLocation')]", - "aiHubName": "[format('{0}-aihub', parameters('solutionName'))]", + "aiHubName": "[format('{0}{1}', variables('abbrs').ai.aiHub, parameters('solutionName'))]", "aiHubFriendlyName": "[variables('aiHubName')]", - "aiHubDescription": "AI Hub for KM template", - "aiProjectName": "[format('{0}-aiproject', parameters('solutionName'))]", + "aiHubDescription": "AI Hub for MACAE template", + "aiProjectName": "[format('{0}{1}', variables('abbrs').ai.aiHubProject, parameters('solutionName'))]", "aiProjectFriendlyName": "[variables('aiProjectName')]", - "aiSearchName": "[format('{0}-search', parameters('solutionName'))]", + "aiSearchName": "[format('{0}{1}', variables('abbrs').ai.aiSearch, parameters('solutionName'))]", "storageNameCleaned": "[replace(variables('storageName'), '-', '')]" }, "resources": [ @@ -774,11 +1224,8 @@ "properties": { "category": "AIServices", "target": "[parameters('aiServicesEndpoint')]", - "authType": "ApiKey", + "authType": "AAD", "isSharedToAll": true, - "credentials": { - "key": "[parameters('aiServicesKey')]" - }, "metadata": { "ApiType": "Azure", "ResourceId": "[parameters('aiServicesId')]" @@ -904,6 +1351,18 @@ "[resourceId('Microsoft.MachineLearningServices/workspaces', variables('aiHubName'))]" ] }, + { + "type": "Microsoft.Authorization/roleAssignments", + "apiVersion": "2022-04-01", + "name": "[guid(resourceId('Microsoft.MachineLearningServices/workspaces', variables('aiProjectName')), resourceId('Microsoft.Authorization/roleDefinitions', '64702f94-c441-49e6-a78b-ef80e0188fee'))]", + "properties": { + "roleDefinitionId": "[resourceId('Microsoft.Authorization/roleDefinitions', '64702f94-c441-49e6-a78b-ef80e0188fee')]", + "principalId": "[reference(resourceId('Microsoft.MachineLearningServices/workspaces', variables('aiProjectName')), '2024-01-01-preview', 'full').identity.principalId]" + }, + "dependsOn": [ + "[resourceId('Microsoft.MachineLearningServices/workspaces', variables('aiProjectName'))]" + ] + }, { "type": "Microsoft.KeyVault/vaults/secrets", "apiVersion": "2021-11-01-preview", @@ -1039,7 +1498,7 @@ "outputs": { "keyvaultName": { "type": "string", - "value": "[variables('keyvaultName')]" + "value": "[parameters('keyVaultName')]" }, "keyvaultId": { "type": "string", @@ -1093,17 +1552,17 @@ }, "mode": "Incremental", "parameters": { - "solutionName": { - "value": "[variables('solutionPrefix')]" - }, "managedIdentityId": { - "value": "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', format(variables('uniqueNameFormat'), 'containerapp-pull'))]" + "value": "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', format('{0}{1}-containerapp-pull', variables('abbrs').security.managedIdentity, variables('solutionPrefix')))]" }, "managedIdentityPropPrin": { "value": "[reference('pullIdentity').principalId]" }, "managedIdentityLocation": { "value": "[reference('pullIdentity', '2023-07-31-preview', 'full').location]" + }, + "miName": { + "value": "[format('{0}{1}', variables('abbrs').security.managedIdentity, variables('solutionPrefix'))]" } }, "template": { @@ -1113,18 +1572,10 @@ "_generator": { "name": "bicep", "version": "0.35.1.17967", - "templateHash": "12327197428621494853" + "templateHash": "14769217536017297821" } }, "parameters": { - "solutionName": { - "type": "string", - "minLength": 3, - "maxLength": 15, - "metadata": { - "description": "Solution Name" - } - }, "managedIdentityId": { "type": "string", "metadata": { @@ -1139,9 +1590,8 @@ }, "miName": { "type": "string", - "defaultValue": "[format('{0}-managed-identity', parameters('solutionName'))]", "metadata": { - "description": "Name" + "description": "Managed Identity Name" } } }, @@ -1199,7 +1649,7 @@ "value": "2.69.0" }, "location": { - "value": "[parameters('location')]" + "value": "[variables('solutionLocation')]" }, "managedIdentities": { "value": { @@ -1209,7 +1659,7 @@ } }, "scriptContent": { - "value": "[format('az cosmosdb sql role assignment create --resource-group \"{0}\" --account-name \"{1}\" --role-definition-id \"{2}\" --scope \"{3}\" --principal-id \"{4}\"', resourceGroup().name, format(variables('uniqueNameFormat'), 'cosmos'), resourceId('Microsoft.DocumentDB/databaseAccounts/sqlRoleDefinitions', format(variables('uniqueNameFormat'), 'cosmos'), '00000000-0000-0000-0000-000000000002'), resourceId('Microsoft.DocumentDB/databaseAccounts', format(variables('uniqueNameFormat'), 'cosmos')), reference('containerApp', '2024-03-01', 'full').identity.principalId)]" + "value": "[format('az cosmosdb sql role assignment create --resource-group \"{0}\" --account-name \"{1}\" --role-definition-id \"{2}\" --scope \"{3}\" --principal-id \"{4}\"', resourceGroup().name, format('{0}{1}', variables('abbrs').databases.cosmosDBDatabase, variables('solutionPrefix')), resourceId('Microsoft.DocumentDB/databaseAccounts/sqlRoleDefinitions', format('{0}{1}', variables('abbrs').databases.cosmosDBDatabase, variables('solutionPrefix')), '00000000-0000-0000-0000-000000000002'), resourceId('Microsoft.DocumentDB/databaseAccounts', format('{0}{1}', variables('abbrs').databases.cosmosDBDatabase, variables('solutionPrefix'))), reference('containerApp', '2024-03-01', 'full').identity.principalId)]" } }, "template": { diff --git a/src/backend/app_config.py b/src/backend/app_config.py index ad8b9c55..798a510d 100644 --- a/src/backend/app_config.py +++ b/src/backend/app_config.py @@ -1,15 +1,12 @@ # app_config.py import logging import os -from typing import Any, Dict, List, Optional +from typing import Optional from azure.ai.projects.aio import AIProjectClient from azure.cosmos.aio import CosmosClient -from azure.identity import ClientSecretCredential, DefaultAzureCredential +from azure.identity import DefaultAzureCredential from dotenv import load_dotenv -from semantic_kernel.agents.azure_ai.azure_ai_agent import AzureAIAgent -from semantic_kernel.contents import ChatHistory -from semantic_kernel.functions import KernelFunction from semantic_kernel.kernel import Kernel # Load environment variables from .env file diff --git a/src/backend/app_kernel.py b/src/backend/app_kernel.py index 674290a2..5275f7ad 100644 --- a/src/backend/app_kernel.py +++ b/src/backend/app_kernel.py @@ -1,21 +1,15 @@ # app_kernel.py import asyncio -import json import logging -import os -import re import uuid -from typing import Any, Dict, List, Optional +from typing import Dict, List, Optional # Semantic Kernel imports -import semantic_kernel as sk from app_config import config from auth.auth_utils import get_authenticated_user_details # Azure monitoring -from azure.monitor.opentelemetry import configure_azure_monitor from config_kernel import Config -from context.cosmos_memory_kernel import CosmosMemoryContext from event_utils import track_event_if_configured # FastAPI imports @@ -26,21 +20,17 @@ # Local imports from middleware.health_check import HealthCheckMiddleware from models.messages_kernel import ( - ActionRequest, - ActionResponse, AgentMessage, AgentType, HumanClarification, HumanFeedback, InputTask, - Plan, PlanWithSteps, Step, ) # Updated import for KernelArguments -from semantic_kernel.functions.kernel_arguments import KernelArguments -from utils_kernel import get_agents, initialize_runtime_and_context, rai_success +from utils_kernel import initialize_runtime_and_context, rai_success # # Check if the Application Insights Instrumentation Key is set in the environment variables # connection_string = os.getenv("APPLICATIONINSIGHTS_CONNECTION_STRING") diff --git a/src/backend/config_kernel.py b/src/backend/config_kernel.py index 31ee1ea9..6227292d 100644 --- a/src/backend/config_kernel.py +++ b/src/backend/config_kernel.py @@ -1,18 +1,3 @@ -# config_kernel.py -import os -import logging -import semantic_kernel as sk -from semantic_kernel.kernel import Kernel - -# Updated imports for compatibility -try: - # Try newer structure - from semantic_kernel.contents import ChatHistory -except ImportError: - # Fall back to older structure for compatibility - from semantic_kernel.connectors.ai.chat_completion_client import ChatHistory -from semantic_kernel.agents.azure_ai.azure_ai_agent import AzureAIAgent - # Import AppConfig from app_config from app_config import config diff --git a/src/backend/context/cosmos_memory_kernel.py b/src/backend/context/cosmos_memory_kernel.py index ec8e47de..7893e8bc 100644 --- a/src/backend/context/cosmos_memory_kernel.py +++ b/src/backend/context/cosmos_memory_kernel.py @@ -525,8 +525,8 @@ async def get_collections(self) -> List[str]: try: query = """ - SELECT DISTINCT c.collection - FROM c + SELECT DISTINCT c.collection + FROM c WHERE c.data_type = 'memory' AND c.session_id = @session_id """ parameters = [{"name": "@session_id", "value": self.session_id}] @@ -595,7 +595,7 @@ async def get_memory_record( ) -> Optional[MemoryRecord]: """Retrieve a memory record.""" query = """ - SELECT * FROM c + SELECT * FROM c WHERE c.collection=@collection AND c.key=@key AND c.session_id=@session_id AND c.data_type=@data_type """ parameters = [ @@ -625,7 +625,7 @@ async def get_memory_record( async def remove_memory_record(self, collection: str, key: str) -> None: """Remove a memory record.""" query = """ - SELECT c.id FROM c + SELECT c.id FROM c WHERE c.collection=@collection AND c.key=@key AND c.session_id=@session_id AND c.data_type=@data_type """ parameters = [ @@ -668,7 +668,7 @@ async def get_memory_records( query = """ SELECT * FROM c - WHERE c.collection = @collection + WHERE c.collection = @collection AND c.data_type = 'memory' AND c.session_id = @session_id ORDER BY c._ts DESC diff --git a/src/backend/handlers/runtime_interrupt_kernel.py b/src/backend/handlers/runtime_interrupt_kernel.py index dfa02524..2965457a 100644 --- a/src/backend/handlers/runtime_interrupt_kernel.py +++ b/src/backend/handlers/runtime_interrupt_kernel.py @@ -1,7 +1,6 @@ from typing import Any, Dict, List, Optional import semantic_kernel as sk -from semantic_kernel.kernel_arguments import KernelArguments from semantic_kernel.kernel_pydantic import KernelBaseModel diff --git a/src/backend/kernel_agents/agent_base.py b/src/backend/kernel_agents/agent_base.py index 9bfebf46..9abab5fb 100644 --- a/src/backend/kernel_agents/agent_base.py +++ b/src/backend/kernel_agents/agent_base.py @@ -1,11 +1,7 @@ -import json import logging -import os -from abc import ABC, abstractmethod -from typing import (Any, Awaitable, Callable, Dict, List, Mapping, Optional, - Union) +from abc import abstractmethod +from typing import (Any, List, Mapping, Optional) -import semantic_kernel as sk # Import the new AppConfig instance from app_config import config from context.cosmos_memory_kernel import CosmosMemoryContext @@ -14,8 +10,6 @@ AgentMessage, Step, StepStatus) from semantic_kernel.agents.azure_ai.azure_ai_agent import AzureAIAgent from semantic_kernel.functions import KernelFunction -from semantic_kernel.functions.kernel_arguments import KernelArguments -from semantic_kernel.functions.kernel_function_decorator import kernel_function # Default formatting instructions used across agents DEFAULT_FORMATTING_INSTRUCTIONS = "Instructions: returning the output of this function call verbatim to the user in markdown. Then write AGENT SUMMARY: and then include a summary of what you did." diff --git a/src/backend/kernel_agents/agent_factory.py b/src/backend/kernel_agents/agent_factory.py index 38a3ab47..440fa205 100644 --- a/src/backend/kernel_agents/agent_factory.py +++ b/src/backend/kernel_agents/agent_factory.py @@ -2,8 +2,7 @@ import inspect import logging -from types import SimpleNamespace -from typing import Any, Callable, Dict, List, Optional, Type +from typing import Any, Dict, Optional, Type # Import the new AppConfig instance from app_config import config @@ -22,12 +21,8 @@ from kernel_agents.product_agent import ProductAgent from kernel_agents.tech_support_agent import TechSupportAgent from models.messages_kernel import AgentType, PlannerResponsePlan -from semantic_kernel import Kernel -from semantic_kernel.agents import AzureAIAgentThread # pylint:disable=E0611 +# pylint:disable=E0611 from semantic_kernel.agents.azure_ai.azure_ai_agent import AzureAIAgent -from semantic_kernel.functions import KernelFunction -from semantic_kernel.prompt_template.prompt_template_config import \ - PromptTemplateConfig logger = logging.getLogger(__name__) @@ -174,7 +169,6 @@ async def create_agent( } agent = await agent_class.create(**filtered_kwargs) - except Exception as e: logger.error( f"Error creating agent of type {agent_type} with parameters: {e}" diff --git a/src/backend/kernel_agents/agent_utils.py b/src/backend/kernel_agents/agent_utils.py index ee16c3db..8d5ab5b9 100644 --- a/src/backend/kernel_agents/agent_utils.py +++ b/src/backend/kernel_agents/agent_utils.py @@ -2,8 +2,7 @@ from typing import Optional import semantic_kernel as sk -from semantic_kernel.kernel_pydantic import KernelBaseModel -from pydantic import BaseModel, Field +from pydantic import BaseModel from context.cosmos_memory_kernel import CosmosMemoryContext from models.messages_kernel import Step diff --git a/src/backend/kernel_agents/generic_agent.py b/src/backend/kernel_agents/generic_agent.py index 4fd55fd0..63d31c35 100644 --- a/src/backend/kernel_agents/generic_agent.py +++ b/src/backend/kernel_agents/generic_agent.py @@ -1,7 +1,6 @@ import logging from typing import Dict, List, Optional -import semantic_kernel as sk from context.cosmos_memory_kernel import CosmosMemoryContext from kernel_agents.agent_base import BaseAgent from kernel_tools.generic_tools import GenericTools diff --git a/src/backend/kernel_agents/group_chat_manager.py b/src/backend/kernel_agents/group_chat_manager.py index 6f86ccc1..9b20c0bd 100644 --- a/src/backend/kernel_agents/group_chat_manager.py +++ b/src/backend/kernel_agents/group_chat_manager.py @@ -1,20 +1,14 @@ -import json import logging -import re from datetime import datetime -from typing import Any, Dict, List, Optional, Tuple +from typing import Dict, List, Optional -import semantic_kernel as sk from context.cosmos_memory_kernel import CosmosMemoryContext from event_utils import track_event_if_configured from kernel_agents.agent_base import BaseAgent -from models.messages_kernel import (ActionRequest, ActionResponse, - AgentMessage, AgentType, HumanFeedback, - HumanFeedbackStatus, InputTask, Plan, - PlanStatus, Step, StepStatus) -from semantic_kernel.agents import AgentGroupChat # pylint: disable=E0611 -from semantic_kernel.agents.strategies import (SequentialSelectionStrategy, - TerminationStrategy) +from models.messages_kernel import (ActionRequest, AgentMessage, AgentType, + HumanFeedback, HumanFeedbackStatus, InputTask, + Plan, Step, StepStatus) +# pylint: disable=E0611 from semantic_kernel.functions.kernel_function import KernelFunction diff --git a/src/backend/kernel_agents/hr_agent.py b/src/backend/kernel_agents/hr_agent.py index a5427dae..e8ab748f 100644 --- a/src/backend/kernel_agents/hr_agent.py +++ b/src/backend/kernel_agents/hr_agent.py @@ -1,7 +1,6 @@ import logging from typing import Dict, List, Optional -import semantic_kernel as sk from context.cosmos_memory_kernel import CosmosMemoryContext from kernel_agents.agent_base import BaseAgent from kernel_tools.hr_tools import HrTools @@ -110,7 +109,7 @@ async def create( except Exception as e: logging.error(f"Failed to create Azure AI Agent for PlannerAgent: {e}") raise - + @staticmethod def default_system_message(agent_name=None) -> str: """Get the default system message for the agent. diff --git a/src/backend/kernel_agents/human_agent.py b/src/backend/kernel_agents/human_agent.py index 7eb1ef0f..ad0b0a34 100644 --- a/src/backend/kernel_agents/human_agent.py +++ b/src/backend/kernel_agents/human_agent.py @@ -1,15 +1,13 @@ import logging from typing import Dict, List, Optional -import semantic_kernel as sk from context.cosmos_memory_kernel import CosmosMemoryContext from event_utils import track_event_if_configured from kernel_agents.agent_base import BaseAgent -from models.messages_kernel import (ActionRequest, AgentMessage, AgentType, +from models.messages_kernel import (AgentMessage, AgentType, ApprovalRequest, HumanClarification, - HumanFeedback, Step, StepStatus) + HumanFeedback, StepStatus) from semantic_kernel.functions import KernelFunction -from semantic_kernel.functions.kernel_arguments import KernelArguments class HumanAgent(BaseAgent): @@ -159,7 +157,7 @@ async def handle_human_feedback(self, human_feedback: HumanFeedback) -> str: # Track the event track_event_if_configured( - f"Human Agent - Received feedback for step and added into the cosmos", + "Human Agent - Received feedback for step and added into the cosmos", { "session_id": human_feedback.session_id, "user_id": self._user_id, @@ -183,7 +181,7 @@ async def handle_human_feedback(self, human_feedback: HumanFeedback) -> str: # Track the approval request event track_event_if_configured( - f"Human Agent - Approval request sent for step and added into the cosmos", + "Human Agent - Approval request sent for step and added into the cosmos", { "session_id": human_feedback.session_id, "user_id": self._user_id, diff --git a/src/backend/kernel_agents/marketing_agent.py b/src/backend/kernel_agents/marketing_agent.py index 951fa4fe..422f05ba 100644 --- a/src/backend/kernel_agents/marketing_agent.py +++ b/src/backend/kernel_agents/marketing_agent.py @@ -1,7 +1,6 @@ import logging from typing import Dict, List, Optional -import semantic_kernel as sk from context.cosmos_memory_kernel import CosmosMemoryContext from kernel_agents.agent_base import BaseAgent from kernel_tools.marketing_tools import MarketingTools diff --git a/src/backend/kernel_agents/planner_agent.py b/src/backend/kernel_agents/planner_agent.py index c9d9d651..a8063fe7 100644 --- a/src/backend/kernel_agents/planner_agent.py +++ b/src/backend/kernel_agents/planner_agent.py @@ -1,12 +1,8 @@ import datetime -import json import logging -import re import uuid from typing import Any, Dict, List, Optional, Tuple -import semantic_kernel as sk -from app_config import config from azure.ai.projects.models import (ResponseFormatJsonSchema, ResponseFormatJsonSchemaType) from context.cosmos_memory_kernel import CosmosMemoryContext @@ -22,7 +18,6 @@ HumanFeedbackStatus, InputTask, Plan, PlannerResponsePlan, PlanStatus, Step, StepStatus) -from pydantic import BaseModel, Field from semantic_kernel.functions import KernelFunction from semantic_kernel.functions.kernel_arguments import KernelArguments @@ -444,8 +439,6 @@ async def _create_structured_plan( # Create a fallback dummy plan when parsing fails logging.info("Creating fallback dummy plan due to parsing error") - import datetime - # Create a dummy plan with the original task description dummy_plan = Plan( id=str(uuid.uuid4()), @@ -575,7 +568,17 @@ def _get_template(): Ensure the summary of the plan and the overall steps is less than 50 words. - Identify any additional information that might be required to complete the task. Include this information in the plan in the human_clarification_request field of the plan. If it is not required, leave it as null. Do not include information that you are waiting for clarification on in the string of the action field, as this otherwise won't get updated. + Identify any additional information that might be required to complete the task. Include this information in the plan in the human_clarification_request field of the plan. If it is not required, leave it as null. + + When identifying required information, consider what input a GenericAgent or fallback LLM model would need to perform the task correctly. This may include: + - Input data, text, or content to process + - A question to answer or topic to describe + - Any referenced material that is mentioned but not actually included (e.g., "the given text") + - A clear subject or target when the task instruction is too vague (e.g., "describe," "summarize," or "analyze" without specifying what to describe) + + If such required input is missing—even if not explicitly referenced—generate a concise clarification request in the human_clarification_request field. + + Do not include information that you are waiting for clarification on in the string of the action field, as this otherwise won't get updated. You must prioritise using the provided functions to accomplish each step. First evaluate each and every function the agents have access too. Only if you cannot find a function needed to complete the task, and you have reviewed each and every function, and determined why each are not suitable, there are two options you can take when generating the plan. First evaluate whether the step could be handled by a typical large language model, without any specialised functions. For example, tasks such as "add 32 to 54", or "convert this SQL code to a python script", or "write a 200 word story about a fictional product strategy". diff --git a/src/backend/kernel_agents/procurement_agent.py b/src/backend/kernel_agents/procurement_agent.py index f70e03c3..675d5c79 100644 --- a/src/backend/kernel_agents/procurement_agent.py +++ b/src/backend/kernel_agents/procurement_agent.py @@ -1,7 +1,6 @@ import logging from typing import Dict, List, Optional -import semantic_kernel as sk from context.cosmos_memory_kernel import CosmosMemoryContext from kernel_agents.agent_base import BaseAgent from kernel_tools.procurement_tools import ProcurementTools diff --git a/src/backend/kernel_agents/product_agent.py b/src/backend/kernel_agents/product_agent.py index 6230bb09..766052a5 100644 --- a/src/backend/kernel_agents/product_agent.py +++ b/src/backend/kernel_agents/product_agent.py @@ -1,7 +1,6 @@ import logging from typing import Dict, List, Optional -import semantic_kernel as sk from context.cosmos_memory_kernel import CosmosMemoryContext from kernel_agents.agent_base import BaseAgent from kernel_tools.product_tools import ProductTools diff --git a/src/backend/kernel_agents/tech_support_agent.py b/src/backend/kernel_agents/tech_support_agent.py index 3c67414f..25a3be15 100644 --- a/src/backend/kernel_agents/tech_support_agent.py +++ b/src/backend/kernel_agents/tech_support_agent.py @@ -1,7 +1,6 @@ import logging from typing import Dict, List, Optional -import semantic_kernel as sk from context.cosmos_memory_kernel import CosmosMemoryContext from kernel_agents.agent_base import BaseAgent from kernel_tools.tech_support_tools import TechSupportTools diff --git a/src/backend/kernel_tools/generic_tools.py b/src/backend/kernel_tools/generic_tools.py index 407fe82a..3cf8b084 100644 --- a/src/backend/kernel_tools/generic_tools.py +++ b/src/backend/kernel_tools/generic_tools.py @@ -1,14 +1,10 @@ import inspect -import time -import logging -from datetime import datetime -from typing import Annotated, Callable, List +from typing import Callable from semantic_kernel.functions import kernel_function from models.messages_kernel import AgentType -import inspect import json -from typing import Any, Dict, List, get_type_hints +from typing import get_type_hints class GenericTools: @@ -116,7 +112,7 @@ def generate_tools_json_doc(cls) -> str: param_type = "string" # Create parameter description - param_desc = param_name.replace("_", " ") + # param_desc = param_name.replace("_", " ") args_dict[param_name] = { "description": param_name, "title": param_name.replace("_", " ").title(), diff --git a/src/backend/kernel_tools/hr_tools.py b/src/backend/kernel_tools/hr_tools.py index 6e712c0c..7eb74c4f 100644 --- a/src/backend/kernel_tools/hr_tools.py +++ b/src/backend/kernel_tools/hr_tools.py @@ -1,13 +1,10 @@ import inspect -import time -from datetime import datetime -from typing import Annotated, Callable, List +from typing import Annotated, Callable from semantic_kernel.functions import kernel_function from models.messages_kernel import AgentType -import inspect import json -from typing import Any, Dict, List, get_type_hints +from typing import get_type_hints class HrTools: @@ -467,7 +464,7 @@ def generate_tools_json_doc(cls) -> str: param_type = "string" # Create parameter description - param_desc = param_name.replace("_", " ") + # param_desc = param_name.replace("_", " ") args_dict[param_name] = { "description": param_name, "title": param_name.replace("_", " ").title(), diff --git a/src/backend/kernel_tools/marketing_tools.py b/src/backend/kernel_tools/marketing_tools.py index 5851e75c..ac154a3f 100644 --- a/src/backend/kernel_tools/marketing_tools.py +++ b/src/backend/kernel_tools/marketing_tools.py @@ -1,15 +1,12 @@ """MarketingTools class provides various marketing functions for a marketing agent.""" import inspect -from typing import Callable, List +import json +from typing import Callable, List, get_type_hints from semantic_kernel.functions import kernel_function from models.messages_kernel import AgentType -import inspect -import json -from typing import Any, Dict, List, get_type_hints - class MarketingTools: """A class that provides various marketing tools and functions.""" @@ -345,7 +342,7 @@ def generate_tools_json_doc(cls) -> str: param_type = "string" # Create parameter description - param_desc = param_name.replace("_", " ") + # param_desc = param_name.replace("_", " ") args_dict[param_name] = { "description": param_name, "title": param_name.replace("_", " ").title(), diff --git a/src/backend/kernel_tools/procurement_tools.py b/src/backend/kernel_tools/procurement_tools.py index 2b680724..64fd2325 100644 --- a/src/backend/kernel_tools/procurement_tools.py +++ b/src/backend/kernel_tools/procurement_tools.py @@ -1,11 +1,10 @@ import inspect -from typing import Annotated, Callable, List, Dict +from typing import Annotated, Callable from semantic_kernel.functions import kernel_function from models.messages_kernel import AgentType -import inspect import json -from typing import Any, Dict, List, get_type_hints +from typing import get_type_hints class ProcurementTools: @@ -619,7 +618,7 @@ def generate_tools_json_doc(cls) -> str: param_type = "string" # Create parameter description - param_desc = param_name.replace("_", " ") + # param_desc = param_name.replace("_", " ") args_dict[param_name] = { "description": param_name, "title": param_name.replace("_", " ").title(), diff --git a/src/backend/kernel_tools/product_tools.py b/src/backend/kernel_tools/product_tools.py index a406a76b..3e43a1fa 100644 --- a/src/backend/kernel_tools/product_tools.py +++ b/src/backend/kernel_tools/product_tools.py @@ -7,9 +7,8 @@ from semantic_kernel.functions import kernel_function from models.messages_kernel import AgentType -import inspect import json -from typing import Any, Dict, List, get_type_hints +from typing import get_type_hints class ProductTools: @@ -672,7 +671,7 @@ def generate_tools_json_doc(cls) -> str: param_type = "string" # Create parameter description - param_desc = param_name.replace("_", " ") + # param_desc = param_name.replace("_", " ") args_dict[param_name] = { "description": param_name, "title": param_name.replace("_", " ").title(), diff --git a/src/backend/kernel_tools/tech_support_tools.py b/src/backend/kernel_tools/tech_support_tools.py index ad116a77..6e8a21c8 100644 --- a/src/backend/kernel_tools/tech_support_tools.py +++ b/src/backend/kernel_tools/tech_support_tools.py @@ -1,11 +1,9 @@ import inspect -from typing import Annotated, Callable, Dict +from typing import Callable, get_type_hints +import json from semantic_kernel.functions import kernel_function from models.messages_kernel import AgentType -import inspect -import json -from typing import Any, Dict, List, get_type_hints class TechSupportTools: @@ -362,7 +360,7 @@ def generate_tools_json_doc(cls) -> str: param_type = "string" # Create parameter description - param_desc = param_name.replace("_", " ") + # param_desc = param_name.replace("_", " ") args_dict[param_name] = { "description": param_name, "title": param_name.replace("_", " ").title(), diff --git a/src/backend/models/messages_kernel.py b/src/backend/models/messages_kernel.py index 32e68cf8..ac10f8e2 100644 --- a/src/backend/models/messages_kernel.py +++ b/src/backend/models/messages_kernel.py @@ -1,5 +1,5 @@ import uuid -from datetime import datetime,timezone +from datetime import datetime, timezone from enum import Enum from typing import Any, Dict, List, Literal, Optional diff --git a/src/backend/requirements.txt b/src/backend/requirements.txt index e45c0944..76568fc8 100644 --- a/src/backend/requirements.txt +++ b/src/backend/requirements.txt @@ -14,10 +14,10 @@ opentelemetry-instrumentation-fastapi opentelemetry-instrumentation-openai opentelemetry-exporter-otlp-proto-http -semantic-kernel[azure] -azure-ai-projects +semantic-kernel[azure]==1.28.1 +azure-ai-projects==1.0.0b10 openai -azure-ai-inference +azure-ai-inference==1.0.0b9 azure-search-documents azure-ai-evaluation diff --git a/src/backend/utils_kernel.py b/src/backend/utils_kernel.py index 9fcc01e4..22a49cd1 100644 --- a/src/backend/utils_kernel.py +++ b/src/backend/utils_kernel.py @@ -16,7 +16,6 @@ # Import agent factory and the new AppConfig from kernel_agents.agent_factory import AgentFactory -from kernel_agents.generic_agent import GenericAgent from kernel_agents.group_chat_manager import GroupChatManager from kernel_agents.hr_agent import HrAgent from kernel_agents.human_agent import HumanAgent @@ -27,7 +26,6 @@ from kernel_agents.tech_support_agent import TechSupportAgent from models.messages_kernel import AgentType from semantic_kernel.agents.azure_ai.azure_ai_agent import AzureAIAgent -from semantic_kernel.functions import KernelFunction logging.basicConfig(level=logging.INFO)