Skip to content

Commit 51e9ed4

Browse files
updated foundry changes
1 parent b46d44f commit 51e9ed4

2 files changed

Lines changed: 48 additions & 77 deletions

File tree

infra/deploy_ai_foundry.bicep

Lines changed: 5 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ param aiServicesEndpoint string
1212
param aiServicesKey string
1313
param aiServicesId string
1414

15+
param aiFoundryName string
1516
param existingLogAnalyticsWorkspaceId string = ''
1617

1718
var useExisting = !empty(existingLogAnalyticsWorkspaceId)
@@ -24,20 +25,13 @@ var abbrs = loadJsonContent('./abbreviations.json')
2425
var storageName = '${abbrs.storage.storageAccount}${solutionName}'
2526

2627
var storageSkuName = 'Standard_LRS'
27-
// var aiServicesName = '${abbrs.ai.aiServices}${solutionName}'
28-
var aiFoundryName = '${abbrs.ai.aiFoundry}${solutionName}'
2928
var workspaceName = '${abbrs.managementGovernance.logAnalyticsWorkspace}${solutionName}'
3029
var keyvaultName = '${abbrs.security.keyVault}${solutionName}'
3130
var location = solutionLocation
32-
// var azureAiHubName = '${abbrs.ai.aiHub}${solutionName}'
33-
// var aiHubFriendlyName = azureAiHubName
34-
// var aiHubDescription = 'AI Hub for KM template'
35-
// var aiProjectName = '${abbrs.ai.aiHubProject}${solutionName}'
31+
3632
var aiSearchName = '${solutionName}-search'
3733
var applicationInsightsName = '${solutionName}-appi'
38-
var aiProjectDescription = 'AI foundary project for CPS template'
39-
var aiProjectName = '${abbrs.ai.aiFoundryProject}${solutionName}'
40-
var aiProjectFriendlyName = aiProjectName
34+
4135

4236

4337
resource keyVault 'Microsoft.KeyVault/vaults@2022-07-01' existing = {
@@ -250,44 +244,6 @@ resource azureOpenAIEndpointEntry 'Microsoft.KeyVault/vaults/secrets@2021-11-01-
250244
}
251245
}
252246

253-
254-
resource aiFoundry 'Microsoft.CognitiveServices/accounts@2025-04-01-preview' = {
255-
name: aiFoundryName
256-
location: location
257-
sku: {
258-
name: 'S0'
259-
}
260-
kind: 'AIServices'
261-
identity: {
262-
type: 'SystemAssigned'
263-
}
264-
properties: {
265-
allowProjectManagement: true
266-
customSubDomainName: aiFoundryName
267-
networkAcls: {
268-
defaultAction: 'Allow'
269-
virtualNetworkRules: []
270-
ipRules: []
271-
}
272-
publicNetworkAccess: 'Enabled'
273-
disableLocalAuth: false
274-
}
275-
}
276-
277-
resource aiFoundryProject 'Microsoft.CognitiveServices/accounts/projects@2025-04-01-preview' = {
278-
parent: aiFoundry
279-
name: aiProjectName
280-
location: location
281-
identity: {
282-
type: 'SystemAssigned'
283-
}
284-
properties: {
285-
description: aiProjectDescription
286-
displayName: aiProjectFriendlyName
287-
}
288-
}
289-
290-
291247
// resource azureAIProjectConnectionStringEntry 'Microsoft.KeyVault/vaults/secrets@2021-11-01-preview' = {
292248
// parent: keyVault
293249
// name: 'AZURE-AI-PROJECT-CONN-STRING'
@@ -328,11 +284,11 @@ resource cogServiceKeyEntry 'Microsoft.KeyVault/vaults/secrets@2021-11-01-previe
328284
}
329285
}
330286

331-
resource cogServiceNameEntry 'Microsoft.KeyVault/vaults/secrets@2021-11-01-preview' = { // need to discuss with roopan
287+
resource cogServiceNameEntry 'Microsoft.KeyVault/vaults/secrets@2021-11-01-preview' = {
332288
parent: keyVault
333289
name: 'COG-SERVICES-NAME'
334290
properties: {
335-
value: aiFoundryName
291+
value: aiFoundryName
336292
}
337293
}
338294

@@ -363,14 +319,10 @@ resource azureLocatioEntry 'Microsoft.KeyVault/vaults/secrets@2021-11-01-preview
363319
output keyvaultName string = keyvaultName
364320
output keyvaultId string = keyVault.id
365321

366-
output aiFoundryName string = aiFoundryName
367322
output aiSearchName string = aiSearchName
368-
output aiProjectName string = aiFoundryProject.name
369323

370324
output storageAccountName string = storageNameCleaned
371325

372326
output logAnalyticsId string = useExisting ? existingLogAnalyticsWorkspace.id : logAnalytics.id
373327
// output storageAccountId string = storage.id
374328
output applicationInsightsConnectionString string = applicationInsights.properties.ConnectionString
375-
376-
output projectConnectionString string = aiFoundryProject.properties.endpoints['AI Foundry API']

infra/main.bicep

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,12 @@ var cosmosdbLogContainer = 'cmsalog'
5757
var containerName = 'appstorage'
5858
var storageSkuName = 'Standard_LRS'
5959
var storageContainerName = replace(replace(replace(replace('${ResourcePrefix}cast', '-', ''), '_', ''), '.', ''),'/', '')
60-
var azureAiServicesName = '${abbrs.ai.aiServices}${ResourcePrefix}'
6160

62-
// param aiProjectName string
61+
var aiFoundryName = '${abbrs.ai.aiFoundry}${ResourcePrefix}'
62+
var aiProjectDescription = 'AI foundary project for CPS template'
63+
var aiProjectName = '${abbrs.ai.aiFoundryProject}${ResourcePrefix}'
64+
var aiProjectFriendlyName = aiProjectName
65+
var projectEndpointString =''
6366

6467

6568
var aiModelDeployments = [
@@ -75,15 +78,39 @@ var aiModelDeployments = [
7578
}
7679
]
7780

78-
resource azureAiServices 'Microsoft.CognitiveServices/accounts@2024-04-01-preview' = {
79-
name: azureAiServicesName
81+
resource azureAiServices 'Microsoft.CognitiveServices/accounts@2025-04-01-preview' = {
82+
name: aiFoundryName
8083
location: AzureAiServiceLocation
8184
sku: {
8285
name: 'S0'
8386
}
8487
kind: 'AIServices'
88+
identity: {
89+
type: 'SystemAssigned'
90+
}
91+
properties: {
92+
allowProjectManagement: true
93+
customSubDomainName: aiFoundryName
94+
networkAcls: {
95+
defaultAction: 'Allow'
96+
virtualNetworkRules: []
97+
ipRules: []
98+
}
99+
publicNetworkAccess: 'Enabled'
100+
disableLocalAuth: false
101+
}
102+
}
103+
104+
resource aiFoundryProject 'Microsoft.CognitiveServices/accounts/projects@2025-04-01-preview' = {
105+
parent: azureAiServices
106+
name: aiProjectName
107+
location: AzureAiServiceLocation
108+
identity: {
109+
type: 'SystemAssigned'
110+
}
85111
properties: {
86-
customSubDomainName: azureAiServicesName
112+
description: aiProjectDescription
113+
displayName: aiProjectFriendlyName
87114
}
88115
}
89116

@@ -138,6 +165,7 @@ module azureAifoundry 'deploy_ai_foundry.bicep' = {
138165
params: {
139166
solutionName: ResourcePrefix
140167
solutionLocation: AzureAiServiceLocation
168+
aiFoundryName: aiFoundryName
141169
keyVaultName: kvault.outputs.keyvaultName
142170
gptModelName: llmModel
143171
gptModelVersion: gptModelVersion
@@ -324,7 +352,7 @@ resource containerAppBackend 'Microsoft.App/containerApps@2023-05-01' = {
324352
}
325353
{
326354
name: 'AZURE_OPENAI_ENDPOINT'
327-
value: 'https://${azureAifoundry.outputs.aiFoundryName}.openai.azure.com/'
355+
value: 'https://${aiFoundryName}.openai.azure.com/'
328356
}
329357
{
330358
name: 'MIGRATOR_AGENT_MODEL_DEPLOY'
@@ -360,7 +388,7 @@ resource containerAppBackend 'Microsoft.App/containerApps@2023-05-01' = {
360388
}
361389
{
362390
name: 'AZURE_AI_AGENT_PROJECT_NAME'
363-
value: azureAifoundry.outputs.aiProjectName
391+
value: aiProjectName
364392
}
365393
{
366394
name: 'AZURE_AI_AGENT_RESOURCE_GROUP_NAME'
@@ -371,8 +399,8 @@ resource containerAppBackend 'Microsoft.App/containerApps@2023-05-01' = {
371399
value: subscription().subscriptionId
372400
}
373401
{
374-
name: 'AZURE_AI_AGENT_PROJECT_CONNECTION_STRING'
375-
value: azureAifoundry.outputs.projectConnectionString
402+
name: 'AI_PROJECT_ENDPOINT'
403+
value: projectEndpointString
376404
}
377405
]
378406
resources: {
@@ -475,19 +503,6 @@ resource aiDeveloper 'Microsoft.Authorization/roleDefinitions@2022-04-01' existi
475503
name: '64702f94-c441-49e6-a78b-ef80e0188fee'
476504
}
477505

478-
// var aiServicesName string=azureAifoundry.outputs.aiFoundryName
479-
// var aiProjectName string=azureAifoundry.outputs.aiProjectName
480-
481-
482-
// resource aiServices 'Microsoft.CognitiveServices/accounts@2025-04-01-preview' existing= {
483-
// name: azureAifoundry.outputs.aiFoundryName
484-
// }
485-
486-
resource aiProject 'Microsoft.CognitiveServices/accounts/projects@2025-04-01-preview' existing= {
487-
name: azureAifoundry.outputs.aiProjectName
488-
}
489-
490-
491506
resource aiDeveloperAccessProj 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
492507
name: guid(containerAppBackend.name, aiDeveloper.id)
493508
scope: resourceGroup()
@@ -512,7 +527,7 @@ resource aiUserAccessProj 'Microsoft.Authorization/roleAssignments@2022-04-01' =
512527
}
513528

514529
resource aiUserAccessFoundry 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
515-
name: guid(containerAppBackend.name, aiProject.id)
530+
name: guid(containerAppBackend.name, aiFoundryProject.id)
516531
scope: resourceGroup()
517532
properties: {
518533
roleDefinitionId: aiUser.id
@@ -544,4 +559,8 @@ module deploymentScriptCLI 'br/public:avm/res/resources/deployment-script:0.5.1'
544559
}
545560
}
546561

547-
output AZURE_AIFOUNDRY_NAME string = azureAiServices.name
562+
output AZURE_AIFOUNDRY_NAME string = azureAiServices.name
563+
564+
output aiFoundryName string = aiFoundryName
565+
output aiProjectName string = aiFoundryProject.name
566+
output projectEndpointString string = aiFoundryProject.properties.endpoints['AI Foundry API']

0 commit comments

Comments
 (0)