Skip to content

Commit ffdff2b

Browse files
feat: Upadated to latest Azure foundary project
1 parent d0ecf04 commit ffdff2b

4 files changed

Lines changed: 150 additions & 379 deletions

File tree

infra/abbreviations.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"ai": {
33
"aiSearch": "srch-",
44
"aiServices": "aisa-",
5+
"aiFoundry": "aif-",
6+
"aiFoundryProject": "aifp-",
57
"aiVideoIndexer": "avi-",
68
"machineLearningWorkspace": "mlw-",
79
"openAIService": "oai-",

infra/deploy_ai_foundry.bicep

Lines changed: 31 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,22 @@
11
// Creates Azure dependent resources for Azure AI studio
22
param solutionName string
33
param solutionLocation string
4-
param keyVaultName string
54
param cuLocation string
65
param deploymentType string
76
param gptModelName string
87
param gptModelVersion string
98
param gptDeploymentCapacity int
10-
// param embeddingModel string
11-
// param embeddingDeploymentCapacity int
12-
param managedIdentityObjectId string
13-
param applicationInsightsId string
14-
param containerRegistryId string
159

1610
// Load the abbrevations file required to name the azure resources.
1711
var abbrs = loadJsonContent('./abbreviations.json')
1812

19-
var storageName = '${abbrs.storage.storageAccount}${solutionName}hubs'
20-
var storageSkuName = 'Standard_LRS'
21-
var aiServicesName = '${abbrs.ai.aiServices}${solutionName}'
13+
var aiFoundaryName = '${abbrs.ai.aiFoundry}${solutionName}'
2214
var aiServicesName_cu = '${abbrs.ai.aiServices}${solutionName}-cu'
2315
var location_cu = cuLocation
24-
// var aiServicesName_m = '${solutionName}-aiservices_m'
25-
// var location_m = solutionLocation
26-
var location = solutionLocation //'eastus2'
27-
var aiHubName = '${abbrs.ai.aiHub}${solutionName}'
28-
var aiHubFriendlyName = aiHubName
29-
var aiHubDescription = 'AI Hub for CPS template'
30-
var aiProjectName = '${abbrs.ai.aiHubProject}${solutionName}'
31-
var aiProjectFriendlyName = aiProjectName
16+
17+
var location = solutionLocation
18+
var aiProjectDescription = 'AI foundary project for CPS template'
19+
var aiProjectName = '${abbrs.ai.aiFoundryProject}${solutionName}'
3220
var aiModelDeployments = [
3321
{
3422
name: gptModelName
@@ -51,14 +39,8 @@ var aiModelDeployments = [
5139
// }
5240
]
5341

54-
resource keyVault 'Microsoft.KeyVault/vaults@2022-07-01' existing = {
55-
name: keyVaultName
56-
}
57-
58-
var storageNameCleaned = replace(storageName, '-', '')
59-
60-
resource aiServices 'Microsoft.CognitiveServices/accounts@2021-10-01' = {
61-
name: aiServicesName
42+
resource aiFoundry 'Microsoft.CognitiveServices/accounts@2025-04-01-preview' = {
43+
name: aiFoundaryName
6244
location: location
6345
identity: {
6446
type: 'SystemAssigned'
@@ -68,15 +50,26 @@ resource aiServices 'Microsoft.CognitiveServices/accounts@2021-10-01' = {
6850
}
6951
kind: 'AIServices'
7052
properties: {
71-
customSubDomainName: aiServicesName
72-
apiProperties: {
73-
// statisticsEnabled: false
74-
}
53+
allowProjectManagement: true
54+
customSubDomainName: aiFoundaryName
7555
publicNetworkAccess: 'Enabled'
7656
disableLocalAuth: true
7757
}
7858
}
7959

60+
resource aiFoundryProject 'Microsoft.CognitiveServices/accounts/projects@2025-04-01-preview' = {
61+
parent: aiFoundry
62+
name: aiProjectName
63+
location: location
64+
identity: {
65+
type: 'SystemAssigned'
66+
}
67+
properties: {
68+
description: aiProjectDescription
69+
displayName: aiProjectName
70+
}
71+
}
72+
8073
resource aiServices_CU 'Microsoft.CognitiveServices/accounts@2021-10-01' = {
8174
name: aiServicesName_cu
8275
location: location_cu
@@ -89,17 +82,14 @@ resource aiServices_CU 'Microsoft.CognitiveServices/accounts@2021-10-01' = {
8982
kind: 'AIServices'
9083
properties: {
9184
customSubDomainName: aiServicesName_cu
92-
apiProperties: {
93-
// statisticsEnabled: false
94-
}
9585
publicNetworkAccess: 'Enabled'
9686
disableLocalAuth: true
9787
}
9888
}
9989

10090
@batchSize(1)
10191
resource aiServicesDeployments 'Microsoft.CognitiveServices/accounts/deployments@2023-05-01' = [for aiModeldeployment in aiModelDeployments: {
102-
parent: aiServices //aiServices_m
92+
parent: aiFoundry //aiServices_m
10393
name: aiModeldeployment.name
10494
properties: {
10595
model: {
@@ -115,129 +105,16 @@ resource aiServicesDeployments 'Microsoft.CognitiveServices/accounts/deployments
115105
}
116106
}]
117107

118-
resource storage 'Microsoft.Storage/storageAccounts@2022-09-01' = {
119-
name: storageNameCleaned
120-
location: location
121-
sku: {
122-
name: storageSkuName
123-
}
124-
kind: 'StorageV2'
125-
properties: {
126-
accessTier: 'Hot'
127-
allowBlobPublicAccess: false
128-
allowCrossTenantReplication: false
129-
allowSharedKeyAccess: true
130-
encryption: {
131-
keySource: 'Microsoft.Storage'
132-
requireInfrastructureEncryption: false
133-
services: {
134-
blob: {
135-
enabled: true
136-
keyType: 'Account'
137-
}
138-
file: {
139-
enabled: true
140-
keyType: 'Account'
141-
}
142-
queue: {
143-
enabled: true
144-
keyType: 'Service'
145-
}
146-
table: {
147-
enabled: true
148-
keyType: 'Service'
149-
}
150-
}
151-
}
152-
isHnsEnabled: false
153-
isNfsV3Enabled: false
154-
keyPolicy: {
155-
keyExpirationPeriodInDays: 7
156-
}
157-
largeFileSharesState: 'Disabled'
158-
minimumTlsVersion: 'TLS1_2'
159-
networkAcls: {
160-
bypass: 'AzureServices'
161-
defaultAction: 'Allow'
162-
}
163-
supportsHttpsTrafficOnly: true
164-
}
165-
}
166-
167-
@description('This is the built-in Storage Blob Data Contributor.')
168-
resource blobDataContributor 'Microsoft.Authorization/roleDefinitions@2018-01-01-preview' existing = {
169-
scope: resourceGroup()
170-
name: 'ba92f5b4-2d11-453d-a403-e96b0029c9fe'
171-
}
172-
173-
resource storageroleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
174-
name: guid(resourceGroup().id, managedIdentityObjectId, blobDataContributor.id)
175-
properties: {
176-
principalId: managedIdentityObjectId
177-
roleDefinitionId: blobDataContributor.id
178-
principalType: 'ServicePrincipal'
179-
}
180-
}
181-
182-
resource aiHub 'Microsoft.MachineLearningServices/workspaces@2023-08-01-preview' = {
183-
name: aiHubName
184-
location: location
185-
identity: {
186-
type: 'SystemAssigned'
187-
}
188-
properties: {
189-
// organization
190-
friendlyName: aiHubFriendlyName
191-
description: aiHubDescription
192-
193-
// dependent resources
194-
keyVault: keyVault.id
195-
storageAccount: storage.id
196-
applicationInsights: applicationInsightsId
197-
containerRegistry: containerRegistryId
198-
}
199-
kind: 'hub'
200-
resource aiServicesConnection 'connections@2024-07-01-preview' = {
201-
name: '${aiHubName}-connection-AzureOpenAI'
202-
properties: {
203-
category: 'AIServices'
204-
target: aiServices.properties.endpoint
205-
authType: 'AAD'
206-
isSharedToAll: true
207-
metadata: {
208-
ApiType: 'Azure'
209-
ResourceId: aiServices.id
210-
}
211-
}
212-
dependsOn: [
213-
aiServicesDeployments
214-
]
215-
}
216-
}
217-
218-
resource aiHubProject 'Microsoft.MachineLearningServices/workspaces@2024-01-01-preview' = {
219-
name: aiProjectName
220-
location: location
221-
kind: 'Project'
222-
identity: {
223-
type: 'SystemAssigned'
224-
}
225-
properties: {
226-
friendlyName: aiProjectFriendlyName
227-
hubResourceId: aiHub.id
228-
}
229-
}
230-
231-
output aiServicesTarget string = aiServices.properties.endpoint //aiServices_m.properties.endpoint
108+
output aiServicesTarget string = aiFoundry.properties.endpoint //aiServices_m.properties.endpoint
232109
output aiServicesCUEndpoint string = aiServices_CU.properties.endpoint //aiServices_m.properties.endpoint
233-
output aiServicesName string = aiServicesName //aiServicesName_m
234-
output aiServicesId string = aiServices.id //aiServices_m.id
110+
output aiFoundaryName string = aiFoundaryName //aiFoundaryName
111+
output aiServicesId string = aiFoundry.id //aiServices_m.id
235112
output aiServicesCuId string = aiServices_CU.id //aiServices_cu.id
236-
output aiServicePrincipalId string = aiServices.identity.principalId
113+
output aiServicePrincipalId string = aiFoundry.identity.principalId
237114
output aiServiceCuPrincipalId string = aiServices_CU.identity.principalId
238115

239116
// output aiInfereceEndpoint string = phiserverless.properties.inferenceEndpoint.uri
240-
output aiProjectPrincipalId string = aiHubProject.identity.principalId
241-
output aiProjectConnectionString string = '${location}.api.azureml.ms;${subscription().subscriptionId};${resourceGroup().name};${aiHubProject.name}'
242-
output aiProjectName string = aiHubProject.name
243-
output aiProjectId string = aiHubProject.id
117+
output aiProjectPrincipalId string = aiFoundry.identity.principalId
118+
output aiProjectConnectionString string = aiFoundryProject.properties.endpoints['AI Foundry API']
119+
output aiProjectName string = aiFoundryProject.name
120+
output aiProjectId string = aiFoundryProject.id

infra/main.bicep

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,11 @@ module aifoundry 'deploy_ai_foundry.bicep' = {
135135
params: {
136136
solutionName: solutionPrefix
137137
solutionLocation: resourceGroupLocation
138-
keyVaultName: kvault.outputs.keyvaultName
139138
cuLocation: contentUnderstandingLocation
140139
deploymentType: deploymentType
141140
gptModelName: gptModelName
142141
gptModelVersion: gptModelVersion
143142
gptDeploymentCapacity: gptDeploymentCapacity
144-
managedIdentityObjectId: managedIdentityModule.outputs.managedIdentityOutput.objectId
145-
containerRegistryId: containerRegistry.outputs.createdAcrId
146-
applicationInsightsId: applicationInsights.outputs.id
147143
}
148144
scope: resourceGroup(resourceGroup().name)
149145
}

0 commit comments

Comments
 (0)