Skip to content

Commit a812e8b

Browse files
Merge branch 'dev' into kings-docgen-dev
2 parents f458fec + 5766c0b commit a812e8b

14 files changed

Lines changed: 101 additions & 69 deletions

.github/ISSUE_TEMPLATE/subtask.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: Sub task
3+
about: A sub task
4+
title: ''
5+
labels: subtask
6+
assignees: ''
7+
8+
---
9+
10+
Required by <link to parent issue>
11+
12+
# Description
13+
14+
A clear and concise description of what this subtask is.
15+
16+
# Tasks
17+
18+
_To be filled in by the engineer picking up the subtask
19+
20+
- [ ] Task 1
21+
- [ ] Task 2
22+
- [ ] ...

.github/workflows/deploy.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ jobs:
138138
az deployment group create \
139139
--name ${{ env.SOLUTION_PREFIX }}-deployment \
140140
--resource-group ${{ env.RESOURCE_GROUP_NAME }} \
141-
--template-file infra/main.json \
141+
--template-file infra/main.bicep \
142142
--parameters \
143143
solutionName="${{ env.SOLUTION_PREFIX }}" \
144144
secondaryLocation="northcentralus" \
@@ -168,8 +168,8 @@ jobs:
168168
echo "KEY_VAULT_NAME=$KEY_VAULT_NAME" >> $GITHUB_ENV
169169
COSMOSDB_ACCOUNT_NAME=$(echo $BICEP_OUTPUT | jq -r '.cosmosdB_ACCOUNT_NAME.value')
170170
echo "COSMOSDB_ACCOUNT_NAME=$COSMOSDB_ACCOUNT_NAME" >> $GITHUB_ENV
171-
AI_FOUNDRY_NAME=$(echo $BICEP_OUTPUT | jq -r '.aI_FOUNDRY_NAME.value')
172-
echo "AI_FOUNDRY_NAME=$AI_FOUNDRY_NAME" >> $GITHUB_ENV
171+
AI_FOUNDRY_RESOURCE_ID=$(echo $BICEP_OUTPUT | jq -r '.aI_FOUNDRY_RESOURCE_ID.value')
172+
echo "AI_FOUNDRY_RESOURCE_ID=$AI_FOUNDRY_RESOURCE_ID" >> $GITHUB_ENV
173173
AI_SEARCH_SERVICE_NAME=$(echo $BICEP_OUTPUT | jq -r '.aI_SEARCH_SERVICE_NAME.value')
174174
echo "AI_SEARCH_SERVICE_NAME=$AI_SEARCH_SERVICE_NAME" >> $GITHUB_ENV
175175
echo "Deployment output: $BICEP_OUTPUT"
@@ -190,10 +190,9 @@ jobs:
190190
bash ./infra/scripts/run_create_index_scripts.sh \
191191
"${{ env.KEY_VAULT_NAME }}" \
192192
"${{ env.RESOURCE_GROUP_NAME }}" \
193-
"${{ env.AI_FOUNDRY_NAME }}" \
194-
"${{ env.RESOURCE_GROUP_NAME }}" \
195193
"${{ env.AI_SEARCH_SERVICE_NAME }}" \
196-
"${{ secrets.AZURE_CLIENT_ID }}"
194+
"${{ secrets.AZURE_CLIENT_ID }}" \
195+
"${{ env.AI_FOUNDRY_RESOURCE_ID }}"
197196
198197
- name: Logout from Azure
199198
if: always()

infra/deploy_ai_foundry.bicep

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ var aiModelDeployments = [
102102
name: embeddingModel
103103
model: embeddingModel
104104
sku: {
105-
name: 'Standard'
105+
name: 'GlobalStandard'
106106
capacity: embeddingDeploymentCapacity
107107
}
108108
version: '2'
@@ -511,6 +511,10 @@ output aiFoundryName string = !empty(existingAIFoundryName) ? existingAIFoundryN
511511

512512
@description('Contains Name of AI Foundry RG.')
513513
output aiFoundryRgName string = !empty(existingAIServiceResourceGroup) ? existingAIServiceResourceGroup : resourceGroup().name
514+
=======
515+
output aiFoundryId string = !empty(azureExistingAIProjectResourceId)
516+
? existingAiFoundry.id
517+
: aiFoundry.id
514518

515519
@description('Contains Application Insights ID.')
516520
output applicationInsightsId string = applicationInsights.id

infra/deploy_app_service.bicep

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ resource searchIndexDataReaderAssignment 'Microsoft.Authorization/roleAssignment
379379
properties: {
380380
roleDefinitionId: searchIndexDataReader.id
381381
principalId: Website.identity.principalId
382+
principalType: 'ServicePrincipal'
382383
}
383384
}
384385

@@ -438,3 +439,16 @@ module assignAiUserRoleToAiProject 'deploy_foundry_role_assignment.bicep' = {
438439

439440
@description('Contains the URL of WebApp.')
440441
output webAppUrl string = 'https://${websiteName}.azurewebsites.net'
442+
output webAppUrl string = 'https://${WebsiteName}.azurewebsites.net'
443+
output azureOpenAISystemMessage string = azureOpenAISystemMessage
444+
output azureOpenAiGenerateSectionContentPrompt string = azureOpenAiGenerateSectionContentPrompt
445+
output azureOpenAiTemplateSystemMessage string = azureOpenAiTemplateSystemMessage
446+
output azureOpenAiTitlePrompt string = azureOpenAiTitlePrompt
447+
output azureOpenAIModel string = AzureOpenAIModel
448+
output azureOpenAIResource string = azureOpenaiResource
449+
output AzureSearchIndex string = AzureSearchIndex
450+
output aiSearchService string = aiSearchService
451+
output AZURE_COSMOSDB_ENABLE_FEEDBACK string = AZURE_COSMOSDB_ENABLE_FEEDBACK
452+
output AzureSearchQueryType string = AzureSearchQueryType
453+
output AzureSearchVectorFields string = AzureSearchVectorFields
454+

infra/main.bicep

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,11 @@ param AZURE_LOCATION string = ''
1616
// ========== AI Deployments Location ========== //
1717
@allowed([
1818
'australiaeast'
19-
'canadaeast'
20-
'centraluseuap'
2119
'eastus'
2220
'eastus2'
2321
'francecentral'
2422
'japaneast'
2523
'koreacentral'
26-
'norwayeast'
27-
'polandcentral'
28-
'southeastasia'
29-
'southindia'
3024
'swedencentral'
3125
'switzerlandnorth'
3226
'uaenorth'
@@ -40,7 +34,7 @@ param AZURE_LOCATION string = ''
4034
type: 'location'
4135
usageName: [
4236
'OpenAI.GlobalStandard.gpt4.1,150'
43-
'OpenAI.Standard.text-embedding-ada-002,80'
37+
'OpenAI.GlobalStandard.text-embedding-ada-002,80'
4438
]
4539
}
4640
})
@@ -262,7 +256,26 @@ output AI_FOUNDRY_NAME string = aifoundry.outputs.aiFoundryName
262256
output AI_FOUNDRY_RG_NAME string = aifoundry.outputs.aiFoundryRgName
263257

264258
@description('Contains AI Search Service Name')
259+
output AI_FOUNDRY_RESOURCE_ID string = aifoundry.outputs.aiFoundryId
265260
output AI_SEARCH_SERVICE_NAME string = aifoundry.outputs.aiSearchService
266261

267262
@description('Contains Azure Search Connection Name')
268263
output AZURE_SEARCH_CONNECTION_NAME string = aifoundry.outputs.aiSearchConnectionName
264+
output AZURE_OPENAI_TITLE_PROMPT string = appserviceModule.outputs.azureOpenAiTitlePrompt
265+
output AZURE_OPENAI_GENERATE_SECTION_CONTENT_PROMPT string = appserviceModule.outputs.azureOpenAiGenerateSectionContentPrompt
266+
output AZURE_OPENAI_TEMPLATE_SYSTEM_MESSAGE string = appserviceModule.outputs.azureOpenAiTemplateSystemMessage
267+
output AZURE_OPENAI_SYSTEM_MESSAGE string = appserviceModule.outputs.azureOpenAISystemMessage
268+
output AZURE_OPENAI_MODEL string = appserviceModule.outputs.azureOpenAIModel
269+
output AZURE_OPENAI_RESOURCE string = appserviceModule.outputs.azureOpenAIResource
270+
output AZURE_SEARCH_SERVICE string = appserviceModule.outputs.aiSearchService
271+
output AZURE_SEARCH_INDEX string = appserviceModule.outputs.AzureSearchIndex
272+
output AZURE_COSMOSDB_ACCOUNT string = cosmosDBModule.outputs.cosmosAccountName
273+
output AZURE_COSMOSDB_DATABASE string = cosmosDBModule.outputs.cosmosDatabaseName
274+
output AZURE_COSMOSDB_CONVERSATIONS_CONTAINER string = cosmosDBModule.outputs.cosmosContainerName
275+
output AZURE_COSMOSDB_ENABLE_FEEDBACK string = appserviceModule.outputs.AZURE_COSMOSDB_ENABLE_FEEDBACK
276+
output AZURE_SEARCH_QUERY_TYPE string = appserviceModule.outputs.AzureSearchQueryType
277+
output AZURE_SEARCH_VECTOR_COLUMNS string = appserviceModule.outputs.AzureSearchVectorFields
278+
output AZURE_AI_AGENT_ENDPOINT string = aifoundry.outputs.aiFoundryProjectEndpoint
279+
output AZURE_AI_AGENT_API_VERSION string = azureAiAgentApiVersion
280+
output AZURE_AI_AGENT_MODEL_DEPLOYMENT_NAME string = appserviceModule.outputs.azureOpenAIModel
281+
output AZURE_APPLICATION_INSIGHTS_CONNECTION_STRING string = aifoundry.outputs.applicationInsightsConnectionString

infra/main.json

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"_generator": {
66
"name": "bicep",
77
"version": "0.36.177.2456",
8-
"templateHash": "5067006710993312117"
8+
"templateHash": "1702044992104018188"
99
}
1010
},
1111
"parameters": {
@@ -36,17 +36,11 @@
3636
"type": "string",
3737
"allowedValues": [
3838
"australiaeast",
39-
"canadaeast",
40-
"centraluseuap",
4139
"eastus",
4240
"eastus2",
4341
"francecentral",
4442
"japaneast",
4543
"koreacentral",
46-
"norwayeast",
47-
"polandcentral",
48-
"southeastasia",
49-
"southindia",
5044
"swedencentral",
5145
"switzerlandnorth",
5246
"uaenorth",
@@ -59,7 +53,7 @@
5953
"type": "location",
6054
"usageName": [
6155
"OpenAI.GlobalStandard.gpt4.1,150",
62-
"OpenAI.Standard.text-embedding-ada-002,80"
56+
"OpenAI.GlobalStandard.text-embedding-ada-002,80"
6357
]
6458
},
6559
"description": "Location for AI deployments. This should be a valid Azure region where OpenAI services are available."
@@ -665,7 +659,7 @@
665659
"_generator": {
666660
"name": "bicep",
667661
"version": "0.36.177.2456",
668-
"templateHash": "5405168643980957312"
662+
"templateHash": "4676644507101240486"
669663
}
670664
},
671665
"parameters": {
@@ -976,7 +970,7 @@
976970
"name": "[parameters('embeddingModel')]",
977971
"model": "[parameters('embeddingModel')]",
978972
"sku": {
979-
"name": "Standard",
973+
"name": "GlobalStandard",
980974
"capacity": "[parameters('embeddingDeploymentCapacity')]"
981975
},
982976
"version": "2",
@@ -1565,9 +1559,9 @@
15651559
"type": "string",
15661560
"value": "[if(not(empty(variables('existingAIFoundryName'))), variables('existingAIFoundryName'), variables('aiFoundryName'))]"
15671561
},
1568-
"aiFoundryRgName": {
1562+
"aiFoundryId": {
15691563
"type": "string",
1570-
"value": "[if(not(empty(variables('existingAIServiceResourceGroup'))), variables('existingAIServiceResourceGroup'), resourceGroup().name)]"
1564+
"value": "[if(not(empty(parameters('azureExistingAIProjectResourceId'))), extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', variables('existingAIServiceSubscription'), variables('existingAIServiceResourceGroup')), 'Microsoft.CognitiveServices/accounts', variables('existingAIFoundryName')), resourceId('Microsoft.CognitiveServices/accounts', variables('aiFoundryName')))]"
15711565
},
15721566
"applicationInsightsId": {
15731567
"type": "string",
@@ -1868,7 +1862,7 @@
18681862
"_generator": {
18691863
"name": "bicep",
18701864
"version": "0.36.177.2456",
1871-
"templateHash": "7711665754275271950"
1865+
"templateHash": "5423105461678227247"
18721866
}
18731867
},
18741868
"parameters": {
@@ -2361,7 +2355,8 @@
23612355
"name": "[guid(parameters('WebsiteName'), parameters('aiSearchName'), resourceId('Microsoft.Authorization/roleDefinitions', '1407120a-92aa-4202-b7e9-c0e197c71c8f'))]",
23622356
"properties": {
23632357
"roleDefinitionId": "[resourceId('Microsoft.Authorization/roleDefinitions', '1407120a-92aa-4202-b7e9-c0e197c71c8f')]",
2364-
"principalId": "[reference(resourceId('Microsoft.Web/sites', parameters('WebsiteName')), '2020-06-01', 'full').identity.principalId]"
2358+
"principalId": "[reference(resourceId('Microsoft.Web/sites', parameters('WebsiteName')), '2020-06-01', 'full').identity.principalId]",
2359+
"principalType": "ServicePrincipal"
23652360
},
23662361
"dependsOn": [
23672362
"[resourceId('Microsoft.Web/sites', parameters('WebsiteName'))]"
@@ -2726,13 +2721,9 @@
27262721
"type": "string",
27272722
"value": "[resourceGroup().name]"
27282723
},
2729-
"AI_FOUNDRY_NAME": {
2730-
"type": "string",
2731-
"value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_ai_foundry'), '2022-09-01').outputs.aiFoundryName.value]"
2732-
},
2733-
"AI_FOUNDRY_RG_NAME": {
2724+
"AI_FOUNDRY_RESOURCE_ID": {
27342725
"type": "string",
2735-
"value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_ai_foundry'), '2022-09-01').outputs.aiFoundryRgName.value]"
2726+
"value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_ai_foundry'), '2022-09-01').outputs.aiFoundryId.value]"
27362727
},
27372728
"AI_SEARCH_SERVICE_NAME": {
27382729
"type": "string",

infra/scripts/process_sample_data.sh

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ fileSystem="$2"
66
keyvaultName="$3"
77
cosmosDbAccountName="$4"
88
resourceGroupName="$5"
9-
aiFoundryName="$6"
10-
aiFoundryRgName="$7"
11-
aiSearchName="$8"
12-
managedIdentityClientId="$9"
9+
aiSearchName="$6"
10+
managedIdentityClientId="$7"
11+
aif_resource_id="${8}"
1312

1413
# get parameters from azd env, if not provided
1514
if [ -z "$resourceGroupName" ]; then
@@ -32,23 +31,19 @@ if [ -z "$keyvaultName" ]; then
3231
keyvaultName=$(azd env get-value KEY_VAULT_NAME)
3332
fi
3433

35-
if [ -z "$aiFoundryName" ]; then
36-
aiFoundryName=$(azd env get-value AI_FOUNDRY_NAME)
37-
fi
38-
39-
if [ -z "$aiFoundryRgName" ]; then
40-
aiFoundryRgName=$(azd env get-value AI_FOUNDRY_RG_NAME)
41-
fi
42-
4334
if [ -z "$aiSearchName" ]; then
4435
aiSearchName=$(azd env get-value AI_SEARCH_SERVICE_NAME)
4536
fi
4637

38+
if [ -z "$aif_resource_id" ]; then
39+
aif_resource_id=$(azd env get-value AI_FOUNDRY_RESOURCE_ID)
40+
fi
41+
4742
azSubscriptionId=$(azd env get-value AZURE_SUBSCRIPTION_ID)
4843

4944
# Check if all required arguments are provided
50-
if [ -z "$storageAccount" ] || [ -z "$fileSystem" ] || [ -z "$keyvaultName" ] || [ -z "$cosmosDbAccountName" ] || [ -z "$resourceGroupName" ] || [ -z "$aiFoundryName" ] || [ -z "$aiFoundryRgName" ] || [ -z "$aiSearchName" ]; then
51-
echo "Usage: $0 <storageAccount> <storageContainerName> <keyvaultName> <cosmosDbAccountName> <resourceGroupName> <aiFoundryName> <aiFoundryRgName> <aiSearchName>"
45+
if [ -z "$storageAccount" ] || [ -z "$fileSystem" ] || [ -z "$keyvaultName" ] || [ -z "$cosmosDbAccountName" ] || [ -z "$resourceGroupName" ] || [ -z "$aif_resource_id" ] || [ -z "$aiSearchName" ]; then
46+
echo "Usage: $0 <storageAccount> <storageContainerName> <keyvaultName> <cosmosDbAccountName> <resourceGroupName> <aiSearchName> <managedIdentityClientId> <aif_resource_id>"
5247
exit 1
5348
fi
5449

@@ -130,7 +125,7 @@ echo "copy_kb_files.sh completed successfully."
130125

131126
# Call run_create_index_scripts.sh
132127
echo "Running run_create_index_scripts.sh"
133-
bash infra/scripts/run_create_index_scripts.sh "$keyvaultName" "$resourceGroupName" "$aiFoundryName" "$aiFoundryRgName" "$aiSearchName" "$managedIdentityClientId"
128+
bash infra/scripts/run_create_index_scripts.sh "$keyvaultName" "$resourceGroupName" "$aiSearchName" "$managedIdentityClientId" "$aif_resource_id"
134129
if [ $? -ne 0 ]; then
135130
echo "Error: run_create_index_scripts.sh failed."
136131
exit 1

infra/scripts/run_create_index_scripts.sh

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
# baseUrl="$1"
55
keyvaultName="$1"
66
resourceGroupName="$2"
7-
aiFoundryName="$3"
8-
aiFoundryRgName="$4"
9-
aiSearchName="$5"
10-
managedIdentityClientId="$6"
7+
aiSearchName="$3"
8+
managedIdentityClientId="$4"
9+
aif_resource_id="$5"
1110
# requirementFile="infra/scripts/index_scripts/requirements.txt"
1211
# requirementFileUrl=${baseUrl}"infra/scripts/index_scripts/requirements.txt"
1312

@@ -66,8 +65,7 @@ fi
6665

6766
### Assign Azure AI User role to the signed in user ###
6867

69-
echo "Getting Azure AI resource id"
70-
aif_resource_id=$(az cognitiveservices account show --name $aiFoundryName --resource-group $aiFoundryRgName --query id --output tsv)
68+
echo "Using provided Azure AI resource id: $aif_resource_id"
7169

7270
# Check if the user has the Azure AI User role
7371
echo "Checking if user has the Azure AI User role"

scripts/checkquota.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ declare -A MIN_CAPACITY=(
3535

3636
["OpenAI.GlobalStandard.gpt4.1"]=$GPT_MIN_CAPACITY
3737

38-
["OpenAI.Standard.text-embedding-ada-002"]=$TEXT_EMBEDDING_MIN_CAPACITY
38+
["OpenAI.GlobalStandard.text-embedding-ada-002"]=$TEXT_EMBEDDING_MIN_CAPACITY
3939
)
4040

4141
VALID_REGION=""

scripts/quota_check_params.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,7 @@ for REGION in "${REGIONS[@]}"; do
165165
FOUND=false
166166
INSUFFICIENT_QUOTA=false
167167

168-
if [ "$MODEL_NAME" = "text-embedding-ada-002" ]; then
169-
MODEL_TYPES=("openai.standard.$MODEL_NAME")
170-
else
171-
MODEL_TYPES=("openai.standard.$MODEL_NAME" "openai.globalstandard.$MODEL_NAME")
172-
fi
168+
MODEL_TYPES=("openai.standard.$MODEL_NAME" "openai.globalstandard.$MODEL_NAME")
173169

174170
for MODEL_TYPE in "${MODEL_TYPES[@]}"; do
175171
FOUND=false

0 commit comments

Comments
 (0)