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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .github/workflows/test-automation.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
name: Test Automation KMGeneric

on:
push:
branches:
- main
- dev
paths:
- 'tests/e2e-test/**'

workflow_dispatch:
# NEW: Add workflow_call to make it reusable
workflow_call:
inputs:
KMGENERIC_URL:
Expand Down
1 change: 0 additions & 1 deletion documents/CustomizingAzdParameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ By default this template will use the environment name as the prefix to prevent
| `AZURE_ENV_IMAGETAG` | string | `latest` | Sets the image tag (`latest`, `dev`, `hotfix`, etc.). |
| `AZURE_OPENAI_EMBEDDING_MODEL_CAPACITY` | integer | `80` | Sets the capacity for the embedding model deployment. |
| `AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID` | string | Guide to get your [Existing Workspace ID](/documents/re-use-log-analytics.md) | Reuses an existing Log Analytics Workspace instead of creating a new one. |
| `USE_LOCAL_BUILD` | string | `false` | Indicates whether to use a local container build for deployment. |
| `AZURE_EXISTING_AI_PROJECT_RESOURCE_ID` | string | `<Existing AI Project resource Id>` | Reuses an existing AIFoundry and AIFoundryProject instead of creating a new one. |


Expand Down
18 changes: 18 additions & 0 deletions documents/DeploymentGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,24 @@ Once you've opened the project in [Codespaces](#github-codespaces), [Dev Contain

- Follow steps in [Delete Resource Group](./DeleteResourceGroup.md) if your deployment fails and/or you need to clean up the resources.

3. **Optional: Publishing Local Build Container to Azure Container Registry**

If you need to rebuild the source code and push the updated container to the deployed Azure Container Registry, follow these steps:

- **Linux/macOS**:
```bash
cd ./infra/scripts/
./docker-build.sh
```

- **Windows (PowerShell)**:
```powershell
cd .\infra\scripts\
.\docker-build.ps1
```

This will create a new Azure Container Registry, rebuild the source code, package it into a container, and push it to the Container Registry created.

## For Local Debugging

Follow steps in [Local Debugging Setup](./LocalDebuggingSetup.md) to configure your local development environment for debugging the solution.
Expand Down
2 changes: 0 additions & 2 deletions infra/deploy_app_service.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ param appSettings object = {}
param appServicePlanId string
param appImageName string
param userassignedIdentityId string = ''
param useLocalBuild string

resource appService 'Microsoft.Web/sites@2020-06-01' = {
name: solutionName
Expand All @@ -28,7 +27,6 @@ resource appService 'Microsoft.Web/sites@2020-06-01' = {
properties: {
serverFarmId: appServicePlanId
siteConfig: {
acrUseManagedIdentityCreds: useLocalBuild == 'true'
alwaysOn: true
ftpsState: 'Disabled'
linuxFxVersion: appImageName
Expand Down
21 changes: 2 additions & 19 deletions infra/deploy_backend_docker.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ param appServicePlanId string
param userassignedIdentityId string
param keyVaultName string
param aiServicesName string
param useLocalBuild string
param azureExistingAIProjectResourceId string = ''
param aiSearchName string
param aideploymentsLocation string
Expand Down Expand Up @@ -94,7 +93,6 @@ module appService 'deploy_app_service.bicep' = {
appServicePlanId: appServicePlanId
appImageName: imageName
userassignedIdentityId:userassignedIdentityId
useLocalBuild: useLocalBuild
appSettings: union(
appSettings,
{
Expand Down Expand Up @@ -191,24 +189,9 @@ module assignAiUserRoleToAiProject 'deploy_foundry_role_assignment.bicep' = {
}
}

resource containerRegistry 'Microsoft.ContainerRegistry/registries@2021-09-01' existing = if (useLocalBuild == 'true') {
name: acrName
}

resource AcrPull 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = if (useLocalBuild == 'true') {
name: '7f951dda-4ed3-4680-a7ca-43fe172d538d'
}

resource acrPullRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = if (useLocalBuild == 'true') {
name: guid(appService.name, AcrPull.id)
scope: containerRegistry
properties: {
roleDefinitionId: AcrPull.id
principalId: appService.outputs.identityPrincipalId
principalType: 'ServicePrincipal'
}
}

output appUrl string = appService.outputs.appUrl
output reactAppLayoutConfig string = reactAppLayoutConfig
output appInsightInstrumentationKey string = reference(applicationInsightsId, '2015-05-01').InstrumentationKey
output backendManagedIdentityPrincipalId string = appService.outputs.identityPrincipalId
output backendAppName string = name
25 changes: 21 additions & 4 deletions infra/deploy_container_registry.bicep
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
targetScope = 'resourceGroup'

param environmentName string
param solutionName string
param solutionLocation string = resourceGroup().location

var uniqueId = toLower(uniqueString(subscription().id, environmentName, solutionLocation))
var solutionName = 'km${padLeft(take(uniqueId, 12), 12, '0')}'
var abbrs = loadJsonContent('./abbreviations.json')
var containerRegistryName = '${abbrs.containers.containerRegistry}${solutionName}'
var containerRegistryNameCleaned = replace(containerRegistryName, '-', '')

@description('List of Principal Ids to which ACR pull role assignment is required')
param acrPullPrincipalIds array = []

@description('Provide a tier of your Azure Container Registry.')
param acrSku string = 'Premium'

resource containerRegistry 'Microsoft.ContainerRegistry/registries@2021-09-01' = {
name: containerRegistryName
location: solutionLocation
sku: {
name: 'Premium'
name: acrSku
}
properties: {
dataEndpointEnabled: false
Expand All @@ -38,6 +42,19 @@ resource containerRegistry 'Microsoft.ContainerRegistry/registries@2021-09-01' =
zoneRedundancy: 'Disabled'
}
}

// Add Role assignments for required principal id's
resource acrPullRoleAssignments 'Microsoft.Authorization/roleAssignments@2022-04-01' = [for principalId in acrPullPrincipalIds: {
name: guid(principalId, 'acrpull')
scope: containerRegistry
properties: {
roleDefinitionId: subscriptionResourceId(
'Microsoft.Authorization/roleDefinitions',
'7f951dda-4ed3-4680-a7ca-43fe172d538d'
)
principalId: principalId
}
}]

output createdAcrName string = containerRegistryNameCleaned
output createdAcrId string = containerRegistry.id
Expand Down
21 changes: 2 additions & 19 deletions infra/deploy_frontend_docker.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ param solutionLocation string
@secure()
param appSettings object = {}
param appServicePlanId string
param useLocalBuild string

var imageName = 'DOCKER|${acrName}.azurecr.io/km-app:${imageTag}'
//var name = '${solutionName}-app'
Expand All @@ -20,7 +19,6 @@ module appService 'deploy_app_service.bicep' = {
solutionName: name
appServicePlanId: appServicePlanId
appImageName: imageName
useLocalBuild: useLocalBuild
appSettings: union(
appSettings,
{
Expand All @@ -30,22 +28,7 @@ module appService 'deploy_app_service.bicep' = {
}
}

resource containerRegistry 'Microsoft.ContainerRegistry/registries@2021-09-01' existing = if (useLocalBuild == 'true') {
name: acrName
}

resource AcrPull 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = if (useLocalBuild == 'true') {
name: '7f951dda-4ed3-4680-a7ca-43fe172d538d'
}

resource acrPullRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = if (useLocalBuild == 'true') {
name: guid(appService.name, AcrPull.id)
scope: containerRegistry
properties: {
roleDefinitionId: AcrPull.id
principalId: appService.outputs.identityPrincipalId
principalType: 'ServicePrincipal'
}
}

output appUrl string = appService.outputs.appUrl
output frontendManagedIdentityPrincipalId string = appService.outputs.identityPrincipalId
output frontendAppName string = name
17 changes: 6 additions & 11 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@ param imageTag string = 'latest_fdp'
param AZURE_LOCATION string=''
var solutionLocation = empty(AZURE_LOCATION) ? resourceGroup().location : AZURE_LOCATION

@description('Set this flag to true only if you are deploying from Local')
param useLocalBuild string = 'false'

// Convert input to lowercase
var useLocalBuildLower = toLower(useLocalBuild)

var uniqueId = toLower(uniqueString(subscription().id, environmentName, solutionLocation, resourceGroup().name))


Expand All @@ -89,9 +83,7 @@ param aiDeploymentsLocation string

var solutionPrefix = 'km${padLeft(take(uniqueId, 12), 12, '0')}'

var containerRegistryName = '${abbrs.containers.containerRegistry}${solutionPrefix}'
var containerRegistryNameCleaned = replace(containerRegistryName, '-', '')
var acrName = useLocalBuildLower == 'true' ? containerRegistryNameCleaned : 'kmcontainerreg'
var acrName = 'kmcontainerreg'

var baseUrl = 'https://raw.githubusercontent.com/microsoft/Conversation-Knowledge-Mining-Solution-Accelerator/main/'

Expand Down Expand Up @@ -241,7 +233,6 @@ module backend_docker 'deploy_backend_docker.bicep' = {
userassignedIdentityId: managedIdentityModule.outputs.managedIdentityBackendAppOutput.id
keyVaultName: kvault.outputs.keyvaultName
aiServicesName: aifoundry.outputs.aiServicesName
useLocalBuild: useLocalBuildLower
azureExistingAIProjectResourceId: azureExistingAIProjectResourceId
aiSearchName: aifoundry.outputs.aiSearchName
appSettings: {
Expand Down Expand Up @@ -284,7 +275,6 @@ module frontend_docker 'deploy_frontend_docker.bicep' = {
acrName: acrName
appServicePlanId: hostingplan.outputs.name
applicationInsightsId: aifoundry.outputs.applicationInsightsId
useLocalBuild: useLocalBuildLower
appSettings:{
APP_API_BASE_URL:backend_docker.outputs.appUrl
}
Expand Down Expand Up @@ -335,3 +325,8 @@ output APPLICATIONINSIGHTS_CONNECTION_STRING string = aifoundry.outputs.applicat

output API_APP_URL string = backend_docker.outputs.appUrl
output WEB_APP_URL string = frontend_docker.outputs.appUrl

output BACKEND_APP_NAME string = backend_docker.outputs.backendAppName
output FRONTEND_APP_NAME string = frontend_docker.outputs.frontendAppName
output BACKEND_MANAGED_IDENTITY_PRINCIPAL_ID string = backend_docker.outputs.backendManagedIdentityPrincipalId
output FRONTEND_MANAGED_IDENTITY_PRINCIPAL_ID string = frontend_docker.outputs.frontendManagedIdentityPrincipalId
Loading