Skip to content

Commit 22097b1

Browse files
Merge pull request #386 from microsoft/PSL-US-16823
feat: added feature to use azure_location environment variable for deployment with Fallback to resource group location
2 parents af1e228 + 7ce4d1f commit 22097b1

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

infra/deploy_app_service.bicep

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ targetScope = 'resourceGroup'
66
@description('Solution Name')
77
param solutionName string
88

9-
// @description('Solution Location')
10-
// param solutionLocation string
9+
@description('Solution Location')
10+
param solutionLocation string
1111

1212
// param identity string
1313

@@ -116,7 +116,7 @@ var azureOpenAiTitlePrompt = 'Summarize the conversation so far into a 4-word or
116116

117117
resource HostingPlan 'Microsoft.Web/serverfarms@2020-06-01' = {
118118
name: HostingPlanName
119-
location: resourceGroup().location
119+
location: solutionLocation
120120
sku: {
121121
name: HostingPlanSku
122122
}
@@ -129,7 +129,7 @@ resource HostingPlan 'Microsoft.Web/serverfarms@2020-06-01' = {
129129

130130
resource Website 'Microsoft.Web/sites@2020-06-01' = {
131131
name: WebsiteName
132-
location: resourceGroup().location
132+
location: solutionLocation
133133
identity: {
134134
type: 'SystemAssigned'
135135
}

infra/main.bicep

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ param embeddingModel string = 'text-embedding-ada-002'
5454
param embeddingDeploymentCapacity int = 80
5555

5656
param imageTag string = 'latest'
57+
param AZURE_LOCATION string=''
58+
var solutionLocation = empty(AZURE_LOCATION) ? resourceGroup().location : AZURE_LOCATION
5759

58-
var uniqueId = toLower(uniqueString(environmentName, subscription().id, resourceGroup().location))
60+
var uniqueId = toLower(uniqueString(environmentName, subscription().id, solutionLocation))
5961
var solutionPrefix = 'dg${padLeft(take(uniqueId, 12), 12, '0')}'
60-
var resourceGroupLocation = resourceGroup().location
6162

62-
var solutionLocation = resourceGroupLocation
6363
var baseUrl = 'https://raw.githubusercontent.com/microsoft/document-generation-solution-accelerator/main/'
6464

6565
var ApplicationInsightsName = 'appi-${solutionPrefix}'
@@ -80,7 +80,7 @@ module kvault 'deploy_keyvault.bicep' = {
8080
name: 'deploy_keyvault'
8181
params: {
8282
solutionName: solutionPrefix
83-
solutionLocation: resourceGroupLocation
83+
solutionLocation: solutionLocation
8484
managedIdentityObjectId:managedIdentityModule.outputs.managedIdentityOutput.objectId
8585
}
8686
scope: resourceGroup(resourceGroup().name)
@@ -91,7 +91,7 @@ module aifoundry 'deploy_ai_foundry.bicep' = {
9191
name: 'deploy_ai_foundry'
9292
params: {
9393
solutionName: solutionPrefix
94-
solutionLocation: resourceGroupLocation
94+
solutionLocation: solutionLocation
9595
keyVaultName: kvault.outputs.keyvaultName
9696
deploymentType: deploymentType
9797
gptModelName: gptModelName
@@ -369,7 +369,7 @@ module appserviceModule 'deploy_app_service.bicep' = {
369369
applicationInsightsId: aifoundry.outputs.applicationInsightsId
370370
// identity:managedIdentityModule.outputs.managedIdentityOutput.id
371371
solutionName: solutionPrefix
372-
// solutionLocation: solutionLocation
372+
solutionLocation: solutionLocation
373373
aiSearchService: aifoundry.outputs.aiSearchService
374374
AzureSearchKey: keyVault.getSecret('AZURE-SEARCH-KEY')
375375
AzureOpenAIEndpoint:aifoundry.outputs.aiServicesTarget
@@ -392,7 +392,7 @@ output WEB_APP_URL string = appserviceModule.outputs.webAppUrl
392392

393393
resource Workspace 'Microsoft.OperationalInsights/workspaces@2020-08-01' = {
394394
name: WorkspaceName
395-
location: resourceGroup().location
395+
location: solutionLocation
396396
properties: {
397397
sku: {
398398
name: 'PerGB2018'
@@ -403,7 +403,7 @@ resource Workspace 'Microsoft.OperationalInsights/workspaces@2020-08-01' = {
403403

404404
resource ApplicationInsights 'Microsoft.Insights/components@2020-02-02' = {
405405
name: ApplicationInsightsName
406-
location: resourceGroup().location
406+
location: solutionLocation
407407
tags: {
408408
'hidden-link:${resourceId('Microsoft.Web/sites',ApplicationInsightsName)}': 'Resource'
409409
}

infra/main.bicepparam

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using './main.bicep'
22

3+
param AZURE_LOCATION = readEnvironmentVariable('AZURE_LOCATION', '')
34
param environmentName = readEnvironmentVariable('AZURE_ENV_NAME', 'env_name')
45
param secondaryLocation = readEnvironmentVariable('AZURE_ENV_SECONDARY_LOCATION', 'eastus2')
56
param deploymentType = readEnvironmentVariable('AZURE_ENV_MODEL_DEPLOYMENT_TYPE', 'GlobalStandard')

0 commit comments

Comments
 (0)