Skip to content

Commit ea7e2bb

Browse files
2 parents ed5e62c + b5c58af commit ea7e2bb

File tree

4 files changed

+1540
-27
lines changed

4 files changed

+1540
-27
lines changed

code/backend/batch/utilities/integrated_vectorization/azure_search_index.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
SemanticPrioritizedFields,
2020
SemanticField,
2121
SearchIndex,
22+
SearchIndexerDataUserAssignedIdentity,
2223
)
2324
from ..helpers.env_helper import EnvHelper
2425
from ..helpers.azure_credential_utils import get_azure_credential
@@ -144,6 +145,9 @@ def get_vector_search_config(self):
144145
azure_open_ai_parameters = AzureOpenAIParameters(
145146
resource_uri=self.env_helper.AZURE_OPENAI_ENDPOINT,
146147
deployment_id=self.env_helper.AZURE_OPENAI_EMBEDDING_MODEL,
148+
auth_identity=SearchIndexerDataUserAssignedIdentity(
149+
user_assigned_identity=self.env_helper.MANAGED_IDENTITY_RESOURCE_ID
150+
),
147151
)
148152

149153
return VectorSearch(

infra/main.bicep

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ var openAiDeployments = concat(
675675
version: azureOpenAIVisionModelVersion
676676
}
677677
sku: {
678-
name: 'Standard'
678+
name: 'GlobalStandard'
679679
capacity: azureOpenAIVisionModelCapacity
680680
}
681681
}
@@ -694,6 +694,11 @@ module openai 'modules/core/ai/cognitiveservices.bicep' = {
694694
sku: azureOpenAISkuName
695695
deployments: openAiDeployments
696696
userAssignedResourceId: managedIdentityModule.outputs.managedIdentityOutput.id
697+
restrictOutboundNetworkAccess: true
698+
allowedFqdnList: [
699+
'${storageAccountName}.blob.${environment().suffixes.storage}'
700+
'${storageAccountName}.queue.${environment().suffixes.storage}'
701+
]
697702
enablePrivateNetworking: enablePrivateNetworking
698703
subnetResourceId: enablePrivateNetworking ? network!.outputs.subnetPrivateEndpointsResourceId : null
699704

@@ -735,7 +740,7 @@ module computerVision 'modules/core/ai/cognitiveservices.bicep' = if (useAdvance
735740
params: {
736741
name: computerVisionName
737742
kind: 'ComputerVision'
738-
location: computerVisionLocation != '' ? computerVisionLocation : location
743+
location: computerVisionLocation != '' ? computerVisionLocation : 'eastus' // Default to eastus if no location provided
739744
tags: allTags
740745
sku: computerVisionSkuName
741746

@@ -1236,11 +1241,17 @@ module formrecognizer 'modules/core/ai/cognitiveservices.bicep' = {
12361241
privateDnsZoneResourceId: enablePrivateNetworking
12371242
? avmPrivateDnsZones[dnsZoneIndex.cognitiveServices]!.outputs.resourceId
12381243
: ''
1244+
enableSystemAssigned: true
12391245
roleAssignments: concat([
12401246
{
12411247
roleDefinitionIdOrName: 'a97b65f3-24c7-4388-baec-2e87135dc908' //Cognitive Services User
12421248
principalId: managedIdentityModule.outputs.managedIdentityOutput.objectId
12431249
principalType: 'ServicePrincipal'
1250+
}
1251+
{
1252+
roleDefinitionIdOrName: 'ba92f5b4-2d11-453d-a403-e96b0029c9fe'
1253+
principalId: managedIdentityModule.outputs.managedIdentityOutput.objectId
1254+
principalType: 'ServicePrincipal'
12441255
}],
12451256
!empty(principalId) ? [
12461257
{
@@ -1249,6 +1260,14 @@ module formrecognizer 'modules/core/ai/cognitiveservices.bicep' = {
12491260
principalType: 'User'
12501261
}
12511262
] : [])
1263+
systemAssignedRoleAssignments: [
1264+
{
1265+
resourceId: storage.outputs.id
1266+
roleName: 'Storage Blob Data Contributor'
1267+
roleDefinitionId: 'ba92f5b4-2d11-453d-a403-e96b0029c9fe'
1268+
principalType: 'ServicePrincipal'
1269+
}
1270+
]
12521271
}
12531272
dependsOn: enablePrivateNetworking ? avmPrivateDnsZones : []
12541273
}

0 commit comments

Comments
 (0)