Skip to content

Commit 27b0234

Browse files
fixbug
1 parent 7c30f39 commit 27b0234

5 files changed

Lines changed: 25 additions & 35 deletions

File tree

infra/deploy_ai_foundry.bicep

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,9 @@ output aoaiEndpoint string = !empty(existingOpenAIEndpoint)
436436
? existingOpenAIEndpoint
437437
: aiFoundry.properties.endpoints['OpenAI Language Model Instance API']
438438
output aiFoundryName string = !empty(existingAIFoundryName) ? existingAIFoundryName : aiFoundryName
439-
output aiFoundryRgName string = !empty(existingAIServiceResourceGroup) ? existingAIServiceResourceGroup : resourceGroup().name
439+
output aiFoundryId string = !empty(azureExistingAIProjectResourceId)
440+
? existingAiFoundry.id
441+
: aiFoundry.id
440442

441443
output applicationInsightsId string = applicationInsights.id
442444
output logAnalyticsWorkspaceResourceName string = useExisting ? existingLogAnalyticsWorkspace.name : logAnalytics.name

infra/main.bicep

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ output STORAGE_CONTAINER_NAME string = storageAccount.outputs.storageContainer
215215
output KEY_VAULT_NAME string = kvault.outputs.keyvaultName
216216
output COSMOSDB_ACCOUNT_NAME string = cosmosDBModule.outputs.cosmosAccountName
217217
output RESOURCE_GROUP_NAME string = resourceGroup().name
218-
output AI_FOUNDRY_NAME string = aifoundry.outputs.aiFoundryName
219-
output AI_FOUNDRY_RG_NAME string = aifoundry.outputs.aiFoundryRgName
218+
output AI_FOUNDRY_RESOURCE_ID string = aifoundry.outputs.aiFoundryId
220219
output AI_SEARCH_SERVICE_NAME string = aifoundry.outputs.aiSearchService
221220
output AZURE_SEARCH_CONNECTION_NAME string = aifoundry.outputs.aiSearchConnectionName

infra/main.json

Lines changed: 7 additions & 11 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": "8521527893631804786"
8+
"templateHash": "1702044992104018188"
99
}
1010
},
1111
"parameters": {
@@ -659,7 +659,7 @@
659659
"_generator": {
660660
"name": "bicep",
661661
"version": "0.36.177.2456",
662-
"templateHash": "5405168643980957312"
662+
"templateHash": "4676644507101240486"
663663
}
664664
},
665665
"parameters": {
@@ -1559,9 +1559,9 @@
15591559
"type": "string",
15601560
"value": "[if(not(empty(variables('existingAIFoundryName'))), variables('existingAIFoundryName'), variables('aiFoundryName'))]"
15611561
},
1562-
"aiFoundryRgName": {
1562+
"aiFoundryId": {
15631563
"type": "string",
1564-
"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')))]"
15651565
},
15661566
"applicationInsightsId": {
15671567
"type": "string",
@@ -1862,7 +1862,7 @@
18621862
"_generator": {
18631863
"name": "bicep",
18641864
"version": "0.36.177.2456",
1865-
"templateHash": "7711665754275271950"
1865+
"templateHash": "5423105461678227247"
18661866
}
18671867
},
18681868
"parameters": {
@@ -2721,13 +2721,9 @@
27212721
"type": "string",
27222722
"value": "[resourceGroup().name]"
27232723
},
2724-
"AI_FOUNDRY_NAME": {
2724+
"AI_FOUNDRY_RESOURCE_ID": {
27252725
"type": "string",
2726-
"value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_ai_foundry'), '2022-09-01').outputs.aiFoundryName.value]"
2727-
},
2728-
"AI_FOUNDRY_RG_NAME": {
2729-
"type": "string",
2730-
"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]"
27312727
},
27322728
"AI_SEARCH_SERVICE_NAME": {
27332729
"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"

0 commit comments

Comments
 (0)