Skip to content

Commit eae3ba0

Browse files
authored
Merge pull request #417 from microsoft/psl-hb-us-22543
feat: update bicep to provision new storage and search resources, script for uploading and indexing sample data
2 parents bf043a2 + ca28f7d commit eae3ba0

File tree

7 files changed

+756
-0
lines changed

7 files changed

+756
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ celerybeat.pid
125125
# Environments
126126
.env
127127
.venv
128+
scriptenv
128129
env/
129130
venv/
130131
ENV/

infra/main.bicep

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,22 @@ module containerApp 'br/public:avm/res/app/container-app:0.14.2' = if (container
10761076
name: 'APP_ENV'
10771077
value: 'Prod'
10781078
}
1079+
{
1080+
name: 'AZURE_STORAGE_BLOB_URL'
1081+
value: avmStorageAccount.outputs.serviceEndpoints.blob
1082+
}
1083+
{
1084+
name: 'AZURE_STORAGE_CONTAINER_NAME'
1085+
value: storageContainerName
1086+
}
1087+
{
1088+
name: 'AZURE_SEARCH_ENDPOINT'
1089+
value: searchService.outputs.endpoint
1090+
}
1091+
{
1092+
name: 'AZURE_SEARCH_CONNECTION_NAME'
1093+
value: aiSearchConnectionName
1094+
}
10791095
]
10801096
}
10811097
]
@@ -1134,6 +1150,187 @@ module webSite 'br/public:avm/res/web/site:0.15.1' = if (webSiteEnabled) {
11341150
}
11351151
}
11361152

1153+
1154+
// ========== Storage Account ========== //
1155+
1156+
module privateDnsZonesStorageAccount 'br/public:avm/res/network/private-dns-zone:0.7.0' = if (virtualNetworkEnabled) {
1157+
name: take('avm.res.network.private-dns-zone.storage-account.${solutionPrefix}', 64)
1158+
params: {
1159+
name: 'privatelink.blob.core.windows.net'
1160+
enableTelemetry: enableTelemetry
1161+
virtualNetworkLinks: [
1162+
{
1163+
name: 'vnetlink-storage-account'
1164+
virtualNetworkResourceId: virtualNetwork.outputs.resourceId
1165+
}
1166+
]
1167+
tags: tags
1168+
}
1169+
}
1170+
1171+
var storageAccountName = replace('st${solutionPrefix}', '-', '')
1172+
param storageContainerName string = 'sample-dataset'
1173+
module avmStorageAccount 'br/public:avm/res/storage/storage-account:0.20.0' = {
1174+
name: take('avm.res.storage.storage-account.${storageAccountName}', 64)
1175+
params: {
1176+
name: storageAccountName
1177+
location: solutionLocation
1178+
managedIdentities: { systemAssigned: true }
1179+
minimumTlsVersion: 'TLS1_2'
1180+
enableTelemetry: enableTelemetry
1181+
tags: tags
1182+
accessTier: 'Hot'
1183+
supportsHttpsTrafficOnly: true
1184+
1185+
roleAssignments: [
1186+
{
1187+
principalId: userAssignedIdentity.outputs.principalId
1188+
roleDefinitionIdOrName: 'Storage Blob Data Contributor'
1189+
principalType: 'ServicePrincipal'
1190+
}
1191+
{
1192+
principalId: deployingUserPrincipalId
1193+
roleDefinitionIdOrName: 'Storage Blob Data Contributor'
1194+
principalType: 'User'
1195+
}
1196+
]
1197+
1198+
// WAF aligned networking
1199+
networkAcls: {
1200+
bypass: 'AzureServices'
1201+
defaultAction: virtualNetworkEnabled ? 'Deny' : 'Allow'
1202+
}
1203+
allowBlobPublicAccess: false
1204+
publicNetworkAccess: virtualNetworkEnabled ? 'Disabled' : 'Enabled'
1205+
1206+
// Private endpoints for blob
1207+
privateEndpoints: virtualNetworkEnabled
1208+
? [
1209+
{
1210+
name: 'pep-blob-${solutionPrefix}'
1211+
privateDnsZoneGroup: {
1212+
privateDnsZoneGroupConfigs: [
1213+
{
1214+
name: 'storage-dns-zone-group-blob'
1215+
privateDnsZoneResourceId: privateDnsZonesStorageAccount.outputs.resourceId
1216+
}
1217+
]
1218+
}
1219+
subnetResourceId: virtualNetwork.outputs.subnetResourceIds[0]
1220+
service: 'blob'
1221+
}
1222+
]
1223+
: []
1224+
blobServices: {
1225+
automaticSnapshotPolicyEnabled: true
1226+
containerDeleteRetentionPolicyDays: 10
1227+
containerDeleteRetentionPolicyEnabled: true
1228+
containers: [
1229+
{
1230+
name: storageContainerName
1231+
publicAccess: 'None'
1232+
}
1233+
]
1234+
deleteRetentionPolicyDays: 9
1235+
deleteRetentionPolicyEnabled: true
1236+
lastAccessTimeTrackingPolicyEnabled: true
1237+
}
1238+
}
1239+
}
1240+
1241+
// ========== Search Service ========== //
1242+
1243+
module privateDnsZonesSearchService 'br/public:avm/res/network/private-dns-zone:0.7.0' = if (virtualNetworkEnabled) {
1244+
name: take('avm.res.network.private-dns-zone.search-service.${solutionPrefix}', 64)
1245+
params: {
1246+
name: 'privatelink.search.windows.net'
1247+
enableTelemetry: enableTelemetry
1248+
virtualNetworkLinks: [
1249+
{
1250+
name: 'vnetlink-search-service'
1251+
virtualNetworkResourceId: virtualNetwork.outputs.resourceId
1252+
}
1253+
]
1254+
tags: tags
1255+
}
1256+
}
1257+
1258+
var searchServiceName = 'srch-${solutionPrefix}'
1259+
module searchService 'br/public:avm/res/search/search-service:0.11.1' = {
1260+
name: take('avm.res.search.search-service.${solutionPrefix}', 64)
1261+
params: {
1262+
name: searchServiceName
1263+
authOptions: {
1264+
aadOrApiKey: {
1265+
aadAuthFailureMode: 'http401WithBearerChallenge'
1266+
}
1267+
}
1268+
disableLocalAuth: false
1269+
hostingMode: 'default'
1270+
managedIdentities: {
1271+
systemAssigned: true
1272+
}
1273+
publicNetworkAccess: virtualNetworkEnabled ? 'Disabled' : 'Enabled'
1274+
networkRuleSet: {
1275+
bypass: 'AzureServices'
1276+
}
1277+
partitionCount: 1
1278+
replicaCount: 1
1279+
sku: 'standard'
1280+
tags: tags
1281+
roleAssignments: [
1282+
{
1283+
principalId: userAssignedIdentity.outputs.principalId
1284+
roleDefinitionIdOrName: 'Search Index Data Contributor'
1285+
principalType: 'ServicePrincipal'
1286+
}
1287+
{
1288+
principalId: deployingUserPrincipalId
1289+
roleDefinitionIdOrName: 'Search Index Data Contributor'
1290+
principalType: 'User'
1291+
}
1292+
]
1293+
privateEndpoints: virtualNetworkEnabled
1294+
? [
1295+
{
1296+
name: 'pep-search-${solutionPrefix}'
1297+
privateDnsZoneGroup: {
1298+
privateDnsZoneGroupConfigs: [
1299+
{
1300+
privateDnsZoneResourceId: privateDnsZonesSearchService.outputs.resourceId
1301+
}
1302+
]
1303+
}
1304+
subnetResourceId: virtualNetwork.outputs.subnetResourceIds[0]
1305+
service: 'searchService'
1306+
}
1307+
]
1308+
: []
1309+
}
1310+
}
1311+
1312+
// ========== Search Service - AI Project Connection ========== //
1313+
1314+
var aiSearchConnectionName = 'aifp-srch-connection-${solutionPrefix}'
1315+
var aifSubscriptionId = useExistingFoundryProject ? split(existingFoundryProjectResourceId, '/')[2] : subscription().subscriptionId
1316+
var aifResourceGroup = useExistingFoundryProject ? split(existingFoundryProjectResourceId, '/')[4] : resourceGroup().name
1317+
module aiSearchFoundryConnection 'modules/aifp_search_connection.bicep' = if (aiFoundryAIservicesEnabled) {
1318+
name: take('aifp-srch-connection.${solutionPrefix}', 64)
1319+
scope: resourceGroup(aifSubscriptionId, aifResourceGroup)
1320+
params: {
1321+
aiFoundryProjectName: aiFoundryAiProjectName
1322+
aiFoundryName: aiFoundryAiServicesResourceName
1323+
aifSearchConnectionName: aiSearchConnectionName
1324+
searchServiceResourceId: searchService.outputs.resourceId
1325+
searchServiceLocation: searchService.outputs.location
1326+
searchServiceName: searchService.outputs.name
1327+
}
1328+
dependsOn: [
1329+
aiFoundryAiServices
1330+
]
1331+
}
1332+
1333+
11371334
// ============ //
11381335
// Outputs //
11391336
// ============ //
@@ -1143,6 +1340,12 @@ module webSite 'br/public:avm/res/web/site:0.15.1' = if (webSiteEnabled) {
11431340
@description('The default url of the website to connect to the Multi-Agent Custom Automation Engine solution.')
11441341
output webSiteDefaultHostname string = webSite.outputs.defaultHostname
11451342

1343+
output AZURE_STORAGE_BLOB_URL string = avmStorageAccount.outputs.serviceEndpoints.blob
1344+
output AZURE_STORAGE_ACCOUNT_NAME string = storageAccountName
1345+
output AZURE_STORAGE_CONTAINER_NAME string = storageContainerName
1346+
output AZURE_SEARCH_ENDPOINT string = searchService.outputs.endpoint
1347+
output AZURE_SEARCH_NAME string = searchService.outputs.name
1348+
11461349
@export()
11471350
@description('The type for the Multi-Agent Custom Automation Engine Log Analytics Workspace resource configuration.')
11481351
type logAnalyticsWorkspaceConfigurationType = {
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
param aifSearchConnectionName string
2+
param searchServiceName string
3+
param searchServiceResourceId string
4+
param searchServiceLocation string
5+
param aiFoundryName string
6+
param aiFoundryProjectName string
7+
8+
resource aiSearchFoundryConnection 'Microsoft.CognitiveServices/accounts/projects/connections@2025-04-01-preview' = {
9+
name: '${aiFoundryName}/${aiFoundryProjectName}/${aifSearchConnectionName}'
10+
properties: {
11+
category: 'CognitiveSearch'
12+
target: 'https://${searchServiceName}.search.windows.net'
13+
authType: 'AAD'
14+
isSharedToAll: true
15+
metadata: {
16+
ApiType: 'Azure'
17+
ResourceId: searchServiceResourceId
18+
location: searchServiceLocation
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)