Skip to content

Commit 905fdd9

Browse files
authored
Merge pull request #27 from eamonoreilly/main
Moving app settings into flex bicep script
2 parents 3e36c76 + 5cae02c commit 905fdd9

File tree

2 files changed

+43
-27
lines changed

2 files changed

+43
-27
lines changed

infra/app/processor.bicep

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -32,32 +32,6 @@ module processor '../core/host/functions-flexconsumption.bicep' = {
3232
name: name
3333
location: location
3434
tags: union(tags, { 'azd-service-name': serviceName })
35-
appSettings: union(appSettings,
36-
{
37-
AZURE_OPENAI_SERVICE: azureOpenaiService
38-
AZURE_OPENAI_ENDPOINT: 'https://${azureOpenaiService}.openai.azure.com/'
39-
AZURE_OPENAI_CHATGPT_DEPLOYMENT: azureOpenaiChatgptDeployment
40-
AZURE_OPENAI_EMB_DEPLOYMENT: azureOpenaiEmbeddingDeployment
41-
SYSTEM_PROMPT: 'You are a helpful assistant. You are responding to requests from a user about internal emails and documents. You can and should refer to the internal documents to help respond to requests. If a user makes a request thats not covered by the documents provided in the query, you must say that you do not have access to the information and not try and get information from other places besides the documents provided. The following is a list of documents that you can refer to when answering questions. The documents are in the format [filename]: [text] and are separated by newlines. If you answer a question by referencing any of the documents, please cite the document in your answer. For example, if you answer a question by referencing info.txt, you should add "Reference: info.txt" to the end of your answer on a separate line.'
42-
AZURE_SEARCH_SERVICE: azureSearchService
43-
AZURE_SEARCH_ENDPOINT: 'https://${azureSearchService}.search.windows.net'
44-
AZURE_SEARCH_INDEX: azureSearchIndex
45-
fileShare : '/mounts/${shareName}'
46-
//OpenAI extension not yet supports MSI for the table storage connection
47-
OpenAiStorageConnection: 'DefaultEndpointsProtocol=https;AccountName=${stg.name};EndpointSuffix=${environment().suffixes.storage};AccountKey=${stg.listKeys().keys[0].value}'
48-
ServiceBusConnection__fullyQualifiedNamespace: serviceBusNamespaceFQDN
49-
ServiceBusQueueName: serviceBusQueueName
50-
APPLICATIONINSIGHTS_AUTHENTICATION_STRING: applicationInsightsIdentity
51-
})
52-
storageConfigProperties: {
53-
'${shareName}': {
54-
type: 'AzureFiles'
55-
shareName: shareName
56-
mountPath: '/mounts/${shareName}'
57-
accountName: stg.name
58-
accessKey: stg.listKeys().keys[0].value
59-
}
60-
}
6135
appInsightsConnectionString: appInsightsConnectionString
6236
appServicePlanId: appServicePlanId
6337
runtimeName: runtimeName
@@ -66,6 +40,15 @@ module processor '../core/host/functions-flexconsumption.bicep' = {
6640
virtualNetworkSubnetId: virtualNetworkSubnetId
6741
instanceMemoryMB: instanceMemoryMB
6842
maximumInstanceCount: maximumInstanceCount
43+
azureOpenaiService: azureOpenaiService
44+
azureOpenaiChatgptDeployment: azureOpenaiChatgptDeployment
45+
azureOpenaiEmbeddingDeployment: azureOpenaiEmbeddingDeployment
46+
azureSearchService: azureSearchService
47+
azureSearchIndex: azureSearchIndex
48+
serviceBusQueueName: serviceBusQueueName
49+
serviceBusNamespaceFQDN: serviceBusNamespaceFQDN
50+
shareName: shareName
51+
applicationInsightsIdentity: applicationInsightsIdentity
6952
}
7053
}
7154

infra/core/host/functions-flexconsumption.bicep

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ param storageAccountName string
99
param virtualNetworkSubnetId string = ''
1010
param allowedOrigins array = []
1111

12+
param azureOpenaiService string
13+
param azureOpenaiChatgptDeployment string
14+
param azureOpenaiEmbeddingDeployment string
15+
param azureSearchService string
16+
param azureSearchIndex string
17+
param serviceBusQueueName string
18+
param serviceBusNamespaceFQDN string
19+
param shareName string
20+
param applicationInsightsIdentity string
21+
1222
// Runtime Properties
1323
@allowed([
1424
'dotnet-isolated', 'node', 'python', 'java', 'powershell', 'custom'
@@ -20,10 +30,19 @@ param kind string = 'functionapp,linux'
2030

2131
// Microsoft.Web/sites/config
2232
param appSettings object = {}
23-
param storageConfigProperties object = {}
2433
param instanceMemoryMB int = 2048
2534
param maximumInstanceCount int = 100
2635

36+
var storageConfigProperties = {
37+
'${shareName}': {
38+
type: 'AzureFiles'
39+
shareName: shareName
40+
mountPath: '/mounts/${shareName}'
41+
accountName: stg.name
42+
accessKey: stg.listKeys().keys[0].value
43+
}
44+
}
45+
2746
resource stg 'Microsoft.Storage/storageAccounts@2022-09-01' existing = {
2847
name: storageAccountName
2948
}
@@ -71,6 +90,20 @@ resource functions 'Microsoft.Web/sites@2023-12-01' = {
7190
AzureWebJobsStorage__accountName: stg.name
7291
DEPLOYMENT_STORAGE_CONNECTION_STRING: stg.name
7392
APPLICATIONINSIGHTS_CONNECTION_STRING: appInsightsConnectionString
93+
AZURE_OPENAI_SERVICE: azureOpenaiService
94+
AZURE_OPENAI_ENDPOINT: 'https://${azureOpenaiService}.openai.azure.com/'
95+
AZURE_OPENAI_CHATGPT_DEPLOYMENT: azureOpenaiChatgptDeployment
96+
AZURE_OPENAI_EMB_DEPLOYMENT: azureOpenaiEmbeddingDeployment
97+
SYSTEM_PROMPT: 'You are a helpful assistant. You are responding to requests from a user about internal emails and documents. You can and should refer to the internal documents to help respond to requests. If a user makes a request thats not covered by the documents provided in the query, you must say that you do not have access to the information and not try and get information from other places besides the documents provided. The following is a list of documents that you can refer to when answering questions. The documents are in the format [filename]: [text] and are separated by newlines. If you answer a question by referencing any of the documents, please cite the document in your answer. For example, if you answer a question by referencing info.txt, you should add "Reference: info.txt" to the end of your answer on a separate line.'
98+
AZURE_SEARCH_SERVICE: azureSearchService
99+
AZURE_SEARCH_ENDPOINT: 'https://${azureSearchService}.search.windows.net'
100+
AZURE_SEARCH_INDEX: azureSearchIndex
101+
fileShare : '/mounts/${shareName}'
102+
//OpenAI extension not yet supports MSI for the table storage connection
103+
OpenAiStorageConnection: 'DefaultEndpointsProtocol=https;AccountName=${stg.name};EndpointSuffix=${environment().suffixes.storage};AccountKey=${stg.listKeys().keys[0].value}'
104+
ServiceBusConnection__fullyQualifiedNamespace: serviceBusNamespaceFQDN
105+
ServiceBusQueueName: serviceBusQueueName
106+
APPLICATIONINSIGHTS_AUTHENTICATION_STRING: applicationInsightsIdentity
74107
})
75108
}
76109
resource configStorageSetting 'config' = {

0 commit comments

Comments
 (0)