Skip to content

Commit c9ad408

Browse files
Merge pull request #527 from microsoft/dev
fix: merging dev to main
2 parents 538856f + 0b89099 commit c9ad408

19 files changed

+645
-204
lines changed

infra/deploy_ai_foundry.bicep

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ module assignOpenAIRoleToAISearch 'deploy_foundry_role_assignment.bicep' = {
239239
aiFoundryName: !empty(azureExistingAIProjectResourceId) ? existingAIFoundryName : aiFoundryName
240240
aiProjectName: !empty(azureExistingAIProjectResourceId) ? existingAIProjectName : aiProjectName
241241
principalId: aiSearch.identity.principalId
242+
aiModelDeployments: aiModelDeployments
242243
}
243244
}
244245

infra/deploy_app_service.bicep

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ param AzureOpenAIModel string
3131
@description('Azure Open AI Endpoint')
3232
param AzureOpenAIEndpoint string = ''
3333

34+
param azureAiAgentApiVersion string
3435
param azureOpenAIApiVersion string
3536
param azureOpenaiResource string = ''
3637
param USE_CHAT_HISTORY_ENABLED string = ''
@@ -267,7 +268,11 @@ resource Website 'Microsoft.Web/sites@2020-06-01' = {
267268
}
268269
{
269270
name: 'AZURE_AI_AGENT_API_VERSION'
270-
value: azureOpenAIApiVersion
271+
value: azureAiAgentApiVersion
272+
}
273+
{
274+
name: 'SOLUTION_NAME'
275+
value: solutionName
271276
}
272277
{
273278
name: 'USE_CHAT_HISTORY_ENABLED'
@@ -293,6 +298,10 @@ resource Website 'Microsoft.Web/sites@2020-06-01' = {
293298
name: 'UWSGI_THREADS'
294299
value: '2'
295300
}
301+
{
302+
name: 'APP_ENV'
303+
value: 'Prod'
304+
}
296305
]
297306
linuxFxVersion: imageName
298307
}

infra/deploy_foundry_role_assignment.bicep

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ param roleDefinitionId string
33
param roleAssignmentName string = ''
44
param aiFoundryName string
55
param aiProjectName string = ''
6+
param aiModelDeployments array = []
67

78
resource aiServices 'Microsoft.CognitiveServices/accounts@2025-04-01-preview' existing = {
89
name: aiFoundryName
@@ -13,6 +14,24 @@ resource aiProject 'Microsoft.CognitiveServices/accounts/projects@2025-04-01-pre
1314
parent: aiServices
1415
}
1516

17+
@batchSize(1)
18+
resource aiServicesDeployments 'Microsoft.CognitiveServices/accounts/deployments@2025-04-01-preview' = [for aiModeldeployment in aiModelDeployments: if (!empty(aiModelDeployments)) {
19+
parent: aiServices
20+
name: aiModeldeployment.name
21+
properties: {
22+
model: {
23+
format: 'OpenAI'
24+
name: aiModeldeployment.model
25+
}
26+
raiPolicyName: aiModeldeployment.raiPolicyName
27+
}
28+
sku:{
29+
name: aiModeldeployment.sku.name
30+
capacity: aiModeldeployment.sku.capacity
31+
}
32+
}]
33+
34+
1635
resource roleAssignmentToFoundry 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
1736
name: roleAssignmentName
1837
scope: aiServices

infra/main.bicep

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,26 @@ param secondaryLocation string = 'eastus2'
1414
param AZURE_LOCATION string = ''
1515

1616
// ========== AI Deployments Location ========== //
17+
@allowed([
18+
'australiaeast'
19+
'canadaeast'
20+
'centraluseuap'
21+
'eastus'
22+
'eastus2'
23+
'francecentral'
24+
'japaneast'
25+
'koreacentral'
26+
'norwayeast'
27+
'polandcentral'
28+
'southeastasia'
29+
'southindia'
30+
'swedencentral'
31+
'switzerlandnorth'
32+
'uaenorth'
33+
'uksouth'
34+
'westus'
35+
'westus3'
36+
])
1737
@description('Location for AI deployments. This should be a valid Azure region where OpenAI services are available.')
1838
@metadata({
1939
azd: {
@@ -43,6 +63,9 @@ param gptModelVersion string = '2025-04-14'
4363
@description('API version for Azure OpenAI service. This should be a valid API version supported by the service.')
4464
param azureOpenaiAPIVersion string = '2025-01-01-preview'
4565

66+
@description('API version for Azure AI Agent service. This should be a valid API version supported by the service.')
67+
param azureAiAgentApiVersion string = '2025-05-01'
68+
4669
@minValue(10)
4770
@description('Capacity of the GPT deployment:')
4871
// You can increase this, but capacity is limited per model/region, so you will get errors if you go over
@@ -155,6 +178,7 @@ module appserviceModule 'deploy_app_service.bicep' = {
155178
solutionLocation: solutionLocation
156179
aiSearchService: aifoundry.outputs.aiSearchService
157180
aiSearchName: aifoundry.outputs.aiSearchName
181+
azureAiAgentApiVersion: azureAiAgentApiVersion
158182
AzureOpenAIEndpoint: aifoundry.outputs.aoaiEndpoint
159183
AzureOpenAIModel: gptModelName
160184
azureOpenAIApiVersion: azureOpenaiAPIVersion //'2024-02-15-preview'

infra/main.json

Lines changed: 104 additions & 6 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": "2218487437635677522"
8+
"templateHash": "5067006710993312117"
99
}
1010
},
1111
"parameters": {
@@ -34,6 +34,26 @@
3434
},
3535
"aiDeploymentsLocation": {
3636
"type": "string",
37+
"allowedValues": [
38+
"australiaeast",
39+
"canadaeast",
40+
"centraluseuap",
41+
"eastus",
42+
"eastus2",
43+
"francecentral",
44+
"japaneast",
45+
"koreacentral",
46+
"norwayeast",
47+
"polandcentral",
48+
"southeastasia",
49+
"southindia",
50+
"swedencentral",
51+
"switzerlandnorth",
52+
"uaenorth",
53+
"uksouth",
54+
"westus",
55+
"westus3"
56+
],
3757
"metadata": {
3858
"azd": {
3959
"type": "location",
@@ -78,6 +98,13 @@
7898
"description": "API version for Azure OpenAI service. This should be a valid API version supported by the service."
7999
}
80100
},
101+
"azureAiAgentApiVersion": {
102+
"type": "string",
103+
"defaultValue": "2025-05-01",
104+
"metadata": {
105+
"description": "API version for Azure AI Agent service. This should be a valid API version supported by the service."
106+
}
107+
},
81108
"gptDeploymentCapacity": {
82109
"type": "int",
83110
"defaultValue": 150,
@@ -638,7 +665,7 @@
638665
"_generator": {
639666
"name": "bicep",
640667
"version": "0.36.177.2456",
641-
"templateHash": "13327438188493804054"
668+
"templateHash": "5405168643980957312"
642669
}
643670
},
644671
"parameters": {
@@ -1402,6 +1429,9 @@
14021429
"aiProjectName": "[if(not(empty(parameters('azureExistingAIProjectResourceId'))), createObject('value', variables('existingAIProjectName')), createObject('value', variables('aiProjectName')))]",
14031430
"principalId": {
14041431
"value": "[reference(resourceId('Microsoft.Search/searchServices', variables('aiSearchName')), '2024-06-01-preview', 'full').identity.principalId]"
1432+
},
1433+
"aiModelDeployments": {
1434+
"value": "[variables('aiModelDeployments')]"
14051435
}
14061436
},
14071437
"template": {
@@ -1411,7 +1441,7 @@
14111441
"_generator": {
14121442
"name": "bicep",
14131443
"version": "0.36.177.2456",
1414-
"templateHash": "11899270249637077405"
1444+
"templateHash": "9006594324715793103"
14151445
}
14161446
},
14171447
"parameters": {
@@ -1432,9 +1462,36 @@
14321462
"aiProjectName": {
14331463
"type": "string",
14341464
"defaultValue": ""
1465+
},
1466+
"aiModelDeployments": {
1467+
"type": "array",
1468+
"defaultValue": []
14351469
}
14361470
},
14371471
"resources": [
1472+
{
1473+
"copy": {
1474+
"name": "aiServicesDeployments",
1475+
"count": "[length(parameters('aiModelDeployments'))]",
1476+
"mode": "serial",
1477+
"batchSize": 1
1478+
},
1479+
"condition": "[not(empty(parameters('aiModelDeployments')))]",
1480+
"type": "Microsoft.CognitiveServices/accounts/deployments",
1481+
"apiVersion": "2025-04-01-preview",
1482+
"name": "[format('{0}/{1}', parameters('aiFoundryName'), parameters('aiModelDeployments')[copyIndex()].name)]",
1483+
"properties": {
1484+
"model": {
1485+
"format": "OpenAI",
1486+
"name": "[parameters('aiModelDeployments')[copyIndex()].model]"
1487+
},
1488+
"raiPolicyName": "[parameters('aiModelDeployments')[copyIndex()].raiPolicyName]"
1489+
},
1490+
"sku": {
1491+
"name": "[parameters('aiModelDeployments')[copyIndex()].sku.name]",
1492+
"capacity": "[parameters('aiModelDeployments')[copyIndex()].sku.capacity]"
1493+
}
1494+
},
14381495
{
14391496
"type": "Microsoft.Authorization/roleAssignments",
14401497
"apiVersion": "2022-04-01",
@@ -1749,6 +1806,9 @@
17491806
"aiSearchName": {
17501807
"value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_ai_foundry'), '2022-09-01').outputs.aiSearchName.value]"
17511808
},
1809+
"azureAiAgentApiVersion": {
1810+
"value": "[parameters('azureAiAgentApiVersion')]"
1811+
},
17521812
"AzureOpenAIEndpoint": {
17531813
"value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_ai_foundry'), '2022-09-01').outputs.aoaiEndpoint.value]"
17541814
},
@@ -1808,7 +1868,7 @@
18081868
"_generator": {
18091869
"name": "bicep",
18101870
"version": "0.36.177.2456",
1811-
"templateHash": "4888491198659956603"
1871+
"templateHash": "7711665754275271950"
18121872
}
18131873
},
18141874
"parameters": {
@@ -1873,6 +1933,9 @@
18731933
"description": "Azure Open AI Endpoint"
18741934
}
18751935
},
1936+
"azureAiAgentApiVersion": {
1937+
"type": "string"
1938+
},
18761939
"azureOpenAIApiVersion": {
18771940
"type": "string"
18781941
},
@@ -2224,7 +2287,11 @@
22242287
},
22252288
{
22262289
"name": "AZURE_AI_AGENT_API_VERSION",
2227-
"value": "[parameters('azureOpenAIApiVersion')]"
2290+
"value": "[parameters('azureAiAgentApiVersion')]"
2291+
},
2292+
{
2293+
"name": "SOLUTION_NAME",
2294+
"value": "[parameters('solutionName')]"
22282295
},
22292296
{
22302297
"name": "USE_CHAT_HISTORY_ENABLED",
@@ -2261,6 +2328,10 @@
22612328
{
22622329
"name": "UWSGI_THREADS",
22632330
"value": "2"
2331+
},
2332+
{
2333+
"name": "APP_ENV",
2334+
"value": "Prod"
22642335
}
22652336
],
22662337
"linuxFxVersion": "[variables('imageName')]"
@@ -2327,7 +2398,7 @@
23272398
"_generator": {
23282399
"name": "bicep",
23292400
"version": "0.36.177.2456",
2330-
"templateHash": "11899270249637077405"
2401+
"templateHash": "9006594324715793103"
23312402
}
23322403
},
23332404
"parameters": {
@@ -2348,9 +2419,36 @@
23482419
"aiProjectName": {
23492420
"type": "string",
23502421
"defaultValue": ""
2422+
},
2423+
"aiModelDeployments": {
2424+
"type": "array",
2425+
"defaultValue": []
23512426
}
23522427
},
23532428
"resources": [
2429+
{
2430+
"copy": {
2431+
"name": "aiServicesDeployments",
2432+
"count": "[length(parameters('aiModelDeployments'))]",
2433+
"mode": "serial",
2434+
"batchSize": 1
2435+
},
2436+
"condition": "[not(empty(parameters('aiModelDeployments')))]",
2437+
"type": "Microsoft.CognitiveServices/accounts/deployments",
2438+
"apiVersion": "2025-04-01-preview",
2439+
"name": "[format('{0}/{1}', parameters('aiFoundryName'), parameters('aiModelDeployments')[copyIndex()].name)]",
2440+
"properties": {
2441+
"model": {
2442+
"format": "OpenAI",
2443+
"name": "[parameters('aiModelDeployments')[copyIndex()].model]"
2444+
},
2445+
"raiPolicyName": "[parameters('aiModelDeployments')[copyIndex()].raiPolicyName]"
2446+
},
2447+
"sku": {
2448+
"name": "[parameters('aiModelDeployments')[copyIndex()].sku.name]",
2449+
"capacity": "[parameters('aiModelDeployments')[copyIndex()].sku.capacity]"
2450+
}
2451+
},
23542452
{
23552453
"type": "Microsoft.Authorization/roleAssignments",
23562454
"apiVersion": "2022-04-01",

infra/scripts/index_scripts/01_create_search_index.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from azure.identity import DefaultAzureCredential
1+
from azure.identity import AzureCliCredential
22
from azure.keyvault.secrets import SecretClient
33
from azure.search.documents.indexes import SearchIndexClient
44
from azure.search.documents.indexes.models import (
@@ -27,11 +27,11 @@ def get_secrets_from_kv(secret_name: str) -> str:
2727
Retrieves a secret value from Azure Key Vault.
2828
Args:
2929
secret_name (str): Name of the secret.
30-
credential (DefaultAzureCredential): Credential with access to Key Vault.
30+
credential (AzureCliCredential): Credential with access to Key Vault.
3131
Returns:
3232
str: The secret value.
3333
"""
34-
kv_credential = DefaultAzureCredential(managed_identity_client_id=managed_identity_client_id)
34+
kv_credential = AzureCliCredential()
3535
secret_client = SecretClient(
3636
vault_url=f"https://{key_vault_name}.vault.azure.net/",
3737
credential=kv_credential
@@ -43,7 +43,7 @@ def create_search_index():
4343
"""Create an Azure Search index."""
4444

4545
# Shared credential
46-
credential = DefaultAzureCredential(managed_identity_client_id=managed_identity_client_id)
46+
credential = AzureCliCredential()
4747

4848
# Retrieve secrets from Key Vault
4949
search_endpoint = get_secrets_from_kv("AZURE-SEARCH-ENDPOINT")

infra/scripts/index_scripts/02_process_data.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from azure.search.documents import SearchClient
88
from azure.storage.filedatalake import DataLakeServiceClient
99
from azure.search.documents.indexes import SearchIndexClient
10-
from azure.identity import (DefaultAzureCredential, get_bearer_token_provider)
10+
from azure.identity import (AzureCliCredential, get_bearer_token_provider)
1111

1212

1313
key_vault_name = 'kv_to-be-replaced'
@@ -22,11 +22,11 @@ def get_secrets_from_kv(secret_name: str) -> str:
2222
Retrieves a secret value from Azure Key Vault.
2323
Args:
2424
secret_name (str): Name of the secret.
25-
credential (DefaultAzureCredential): Credential with access to Key Vault.
25+
credential (AzureCliCredential): Credential with access to Key Vault.
2626
Returns:
2727
str: The secret value.
2828
"""
29-
kv_credential = DefaultAzureCredential(managed_identity_client_id=managed_identity_client_id)
29+
kv_credential = AzureCliCredential()
3030
secret_client = SecretClient(
3131
vault_url=f"https://{key_vault_name}.vault.azure.net/",
3232
credential=kv_credential
@@ -44,7 +44,7 @@ def get_secrets_from_kv(secret_name: str) -> str:
4444

4545
# Azure Data Lake settings
4646
account_url = f"https://{account_name}.dfs.core.windows.net"
47-
credential = DefaultAzureCredential(managed_identity_client_id=managed_identity_client_id)
47+
credential = AzureCliCredential()
4848
service_client = DataLakeServiceClient(account_url, credential=credential, api_version='2023-01-03')
4949
file_system_client = service_client.get_file_system_client(file_system_client_name)
5050
directory_name = directory

0 commit comments

Comments
 (0)