Skip to content

Commit 9a78401

Browse files
Merge pull request #568 from microsoft/dev
refactor: Cleanup local registry build code references
2 parents 5f1d4ab + 54d0673 commit 9a78401

File tree

9 files changed

+11
-368
lines changed

9 files changed

+11
-368
lines changed

documents/DeploymentGuide.md

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -193,17 +193,9 @@ Once you've opened the project in [Codespaces](#github-codespaces), [Dev Contain
193193
194194
2. **Deleting Resources After a Failed Deployment**
195195
196-
- Follow steps in [Delete Resource Group](./DeleteResourceGroup.md) if your deployment fails and/or you need to clean up the resources.
197-
198-
## Environment configuration for local development & debugging
199-
> Set APP_ENV in your .env file to control Azure authentication.Set the environment variable to dev to use Azure CLI credentials, or to prod to use Managed Identity for production. **Ensure you're logged in via az login when using dev in local**.
200-
To configure your environment:
201-
- Navigate to the `src\api` folder.
202-
- Create a `.env` file based on the `.env.sample` file.
203-
- Fill in the `.env` file using deployment output or the Azure Portal under "Deployments" in your resource group.
204-
- Ensure that `APP_ENV` is set to "**dev**".
205-
206-
## For Local Debugging
196+
- Follow steps in [Delete Resource Group](./DeleteResourceGroup.md) if your deployment fails and/or you need to clean up the resources.
197+
198+
## For local development & debugging
207199
208200
Follow steps in [Local Debugging Setup](./LocalDebuggingSetup.md) to configure your local development environment for debugging the solution.
209201

documents/LocalDebuggingSetup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ If you don't have an existing environment, you must first deploy the Azure resou
7070
|-------------|-------|------|
7171
| `SOLUTION_NAME` | | Prefix used to uniquely identify resources in the deployment |
7272
| `RESOURCE_GROUP_NAME` | | Name of the Azure Resource Group |
73-
| `APP_ENV` | `dev` | Environment type (dev for local debugging, prod for deployment) |
73+
| `APP_ENV` | `dev` | Set APP_ENV in your .env file to control Azure authentication. Set the environment variable to dev to use Azure CLI credentials, or to prod to use Managed Identity for production. Ensure you're logged in via az login when using dev in local. |
7474
| `APPINSIGHTS_INSTRUMENTATIONKEY` | | Instrumentation Key for Azure Application Insights |
7575
| `APPLICATIONINSIGHTS_CONNECTION_STRING` | | Connection string for Application Insights |
7676
| `AZURE_AI_PROJECT_CONN_STRING` | | Connection string for the Azure AI project |

infra/deploy_app_service.bicep

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ param appSettings object = {}
1212
param appServicePlanId string
1313
param appImageName string
1414
param userassignedIdentityId string = ''
15-
param useLocalBuild string
1615

1716
resource appService 'Microsoft.Web/sites@2020-06-01' = {
1817
name: solutionName
@@ -28,7 +27,6 @@ resource appService 'Microsoft.Web/sites@2020-06-01' = {
2827
properties: {
2928
serverFarmId: appServicePlanId
3029
siteConfig: {
31-
acrUseManagedIdentityCreds: useLocalBuild == 'true'
3230
alwaysOn: true
3331
ftpsState: 'Disabled'
3432
linuxFxVersion: appImageName

infra/deploy_backend_docker.bicep

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ param appServicePlanId string
1111
param userassignedIdentityId string
1212
param keyVaultName string
1313
param aiServicesName string
14-
param useLocalBuild string
1514
param azureExistingAIProjectResourceId string = ''
1615
param aiSearchName string
17-
param aideploymentsLocation string
1816
var existingAIServiceSubscription = !empty(azureExistingAIProjectResourceId) ? split(azureExistingAIProjectResourceId, '/')[2] : subscription().subscriptionId
1917
var existingAIServiceResourceGroup = !empty(azureExistingAIProjectResourceId) ? split(azureExistingAIProjectResourceId, '/')[4] : resourceGroup().name
2018
var existingAIServicesName = !empty(azureExistingAIProjectResourceId) ? split(azureExistingAIProjectResourceId, '/')[8] : ''
@@ -94,7 +92,6 @@ module appService 'deploy_app_service.bicep' = {
9492
appServicePlanId: appServicePlanId
9593
appImageName: imageName
9694
userassignedIdentityId:userassignedIdentityId
97-
useLocalBuild: useLocalBuild
9895
appSettings: union(
9996
appSettings,
10097
{
@@ -191,24 +188,6 @@ module assignAiUserRoleToAiProject 'deploy_foundry_role_assignment.bicep' = {
191188
}
192189
}
193190

194-
resource containerRegistry 'Microsoft.ContainerRegistry/registries@2021-09-01' existing = if (useLocalBuild == 'true') {
195-
name: acrName
196-
}
197-
198-
resource AcrPull 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = if (useLocalBuild == 'true') {
199-
name: '7f951dda-4ed3-4680-a7ca-43fe172d538d'
200-
}
201-
202-
resource acrPullRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = if (useLocalBuild == 'true') {
203-
name: guid(appService.name, AcrPull.id)
204-
scope: containerRegistry
205-
properties: {
206-
roleDefinitionId: AcrPull.id
207-
principalId: appService.outputs.identityPrincipalId
208-
principalType: 'ServicePrincipal'
209-
}
210-
}
211-
212191
output appUrl string = appService.outputs.appUrl
213192
output reactAppLayoutConfig string = reactAppLayoutConfig
214193
output appInsightInstrumentationKey string = reference(applicationInsightsId, '2015-05-01').InstrumentationKey

infra/deploy_frontend_docker.bicep

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ param solutionLocation string
88
@secure()
99
param appSettings object = {}
1010
param appServicePlanId string
11-
param useLocalBuild string
1211

1312
var imageName = 'DOCKER|${acrName}.azurecr.io/km-app:${imageTag}'
1413
//var name = '${solutionName}-app'
@@ -20,7 +19,6 @@ module appService 'deploy_app_service.bicep' = {
2019
solutionName: name
2120
appServicePlanId: appServicePlanId
2221
appImageName: imageName
23-
useLocalBuild: useLocalBuild
2422
appSettings: union(
2523
appSettings,
2624
{
@@ -30,22 +28,4 @@ module appService 'deploy_app_service.bicep' = {
3028
}
3129
}
3230

33-
resource containerRegistry 'Microsoft.ContainerRegistry/registries@2021-09-01' existing = if (useLocalBuild == 'true') {
34-
name: acrName
35-
}
36-
37-
resource AcrPull 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = if (useLocalBuild == 'true') {
38-
name: '7f951dda-4ed3-4680-a7ca-43fe172d538d'
39-
}
40-
41-
resource acrPullRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = if (useLocalBuild == 'true') {
42-
name: guid(appService.name, AcrPull.id)
43-
scope: containerRegistry
44-
properties: {
45-
roleDefinitionId: AcrPull.id
46-
principalId: appService.outputs.identityPrincipalId
47-
principalType: 'ServicePrincipal'
48-
}
49-
}
50-
5131
output appUrl string = appService.outputs.appUrl

infra/main.bicep

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,6 @@ param imageTag string = 'latest_fdp'
6666
param AZURE_LOCATION string=''
6767
var solutionLocation = empty(AZURE_LOCATION) ? resourceGroup().location : AZURE_LOCATION
6868

69-
@description('Set this flag to true only if you are deploying from Local')
70-
param useLocalBuild string = 'false'
71-
72-
// Convert input to lowercase
73-
var useLocalBuildLower = toLower(useLocalBuild)
74-
7569
var uniqueId = toLower(uniqueString(subscription().id, environmentName, solutionLocation, resourceGroup().name))
7670

7771

@@ -89,9 +83,7 @@ param aiDeploymentsLocation string
8983

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

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

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

@@ -233,15 +225,13 @@ module backend_docker 'deploy_backend_docker.bicep' = {
233225
params: {
234226
name: 'api-${solutionPrefix}'
235227
solutionLocation: solutionLocation
236-
aideploymentsLocation: aiDeploymentsLocation
237228
imageTag: imageTag
238229
acrName: acrName
239230
appServicePlanId: hostingplan.outputs.name
240231
applicationInsightsId: aifoundry.outputs.applicationInsightsId
241232
userassignedIdentityId: managedIdentityModule.outputs.managedIdentityBackendAppOutput.id
242233
keyVaultName: kvault.outputs.keyvaultName
243234
aiServicesName: aifoundry.outputs.aiServicesName
244-
useLocalBuild: useLocalBuildLower
245235
azureExistingAIProjectResourceId: azureExistingAIProjectResourceId
246236
aiSearchName: aifoundry.outputs.aiSearchName
247237
appSettings: {
@@ -284,7 +274,6 @@ module frontend_docker 'deploy_frontend_docker.bicep' = {
284274
acrName: acrName
285275
appServicePlanId: hostingplan.outputs.name
286276
applicationInsightsId: aifoundry.outputs.applicationInsightsId
287-
useLocalBuild: useLocalBuildLower
288277
appSettings:{
289278
APP_API_BASE_URL:backend_docker.outputs.appUrl
290279
}

0 commit comments

Comments
 (0)