Skip to content

Commit 02cd8f1

Browse files
feat: Update AI service location parameters and metadata for deployment
1 parent eaa9caf commit 02cd8f1

2 files changed

Lines changed: 162 additions & 24 deletions

File tree

content-gen/infra/main.bicep

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,19 @@ param location string
3636
@description('Optional. Secondary location for databases creation.')
3737
param secondaryLocation string = 'uksouth'
3838

39+
// NOTE: Metadata must be compile-time constants. Update usageName manually if you change model parameters.
40+
// Format: 'OpenAI.<DeploymentType>.<ModelName>,<Capacity>'
41+
@metadata({
42+
azd: {
43+
type: 'location'
44+
usageName: [
45+
'OpenAI.GlobalStandard.gpt-5.1,150'
46+
'OpenAI.GlobalStandard.gpt-image-1,1'
47+
]
48+
}
49+
})
3950
@description('Optional. Location for AI deployments. If not specified, uses the main location.')
40-
param azureAiServiceLocation string = ''
51+
param azureAiServiceLocation string
4152

4253
@minLength(1)
4354
@allowed([
@@ -463,7 +474,7 @@ module aiFoundryAiServices 'br/public:avm/res/cognitive-services/account:0.14.0'
463474
name: take('avm.res.cognitive-services.account.${aiFoundryAiServicesResourceName}', 64)
464475
params: {
465476
name: aiFoundryAiServicesResourceName
466-
location: aiServiceLocation
477+
location: azureAiServiceLocation
467478
tags: tags
468479
sku: 'S0'
469480
kind: 'AIServices'
@@ -557,7 +568,7 @@ module aiFoundryAiServicesProject 'modules/ai-project.bicep' = if (!useExistingA
557568
name: take('module.ai-project.${aiFoundryAiProjectResourceName}', 64)
558569
params: {
559570
name: aiFoundryAiProjectResourceName
560-
location: aiServiceLocation
571+
location: azureAiServiceLocation
561572
tags: tags
562573
desc: aiFoundryAiProjectDescription
563574
aiServicesName: aiFoundryAiServicesResourceName
@@ -1003,7 +1014,7 @@ output AZURE_AI_AGENT_API_VERSION string = azureAiAgentApiVersion
10031014
output AZURE_APPLICATION_INSIGHTS_CONNECTION_STRING string = (enableMonitoring && !useExistingLogAnalytics) ? applicationInsights!.outputs.connectionString : ''
10041015

10051016
@description('Contains the location used for AI Services deployment')
1006-
output AI_SERVICE_LOCATION string = aiServiceLocation
1017+
output AI_SERVICE_LOCATION string = azureAiServiceLocation
10071018

10081019
@description('Contains Container Instance Name')
10091020
output CONTAINER_INSTANCE_NAME string = containerInstance.outputs.name

content-gen/infra/main.json

Lines changed: 147 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"metadata": {
66
"_generator": {
77
"name": "bicep",
8-
"version": "0.39.26.7824",
9-
"templateHash": "12629934330443935294"
8+
"version": "0.40.2.10011",
9+
"templateHash": "16442623120600133305"
1010
},
1111
"name": "Intelligent Content Generation Accelerator",
1212
"description": "Solution Accelerator for multimodal marketing content generation using Microsoft Agent Framework.\n"
@@ -62,8 +62,14 @@
6262
},
6363
"azureAiServiceLocation": {
6464
"type": "string",
65-
"defaultValue": "",
6665
"metadata": {
66+
"azd": {
67+
"type": "location",
68+
"usageName": [
69+
"OpenAI.GlobalStandard.gpt-5.1,150",
70+
"OpenAI.GlobalStandard.gpt-image-1,1"
71+
]
72+
},
6773
"description": "Optional. Location for AI deployments. If not specified, uses the main location."
6874
}
6975
},
@@ -321,6 +327,7 @@
321327
"useExistingLogAnalytics": "[not(empty(parameters('existingLogAnalyticsWorkspaceId')))]",
322328
"useExistingAiFoundryAiProject": "[not(empty(parameters('azureExistingAIProjectResourceId')))]",
323329
"aiFoundryAiServicesResourceGroupName": "[if(variables('useExistingAiFoundryAiProject'), split(parameters('azureExistingAIProjectResourceId'), '/')[4], format('rg-{0}', variables('solutionSuffix')))]",
330+
"aiFoundryAiServicesSubscriptionId": "[if(variables('useExistingAiFoundryAiProject'), split(parameters('azureExistingAIProjectResourceId'), '/')[2], subscription().subscriptionId)]",
324331
"aiFoundryAiServicesResourceName": "[if(variables('useExistingAiFoundryAiProject'), split(parameters('azureExistingAIProjectResourceId'), '/')[8], format('aif-{0}', variables('solutionSuffix')))]",
325332
"aiFoundryAiProjectResourceName": "[if(variables('useExistingAiFoundryAiProject'), split(parameters('azureExistingAIProjectResourceId'), '/')[10], format('proj-{0}', variables('solutionSuffix')))]",
326333
"baseModelDeployments": [
@@ -4868,8 +4875,8 @@
48684875
"metadata": {
48694876
"_generator": {
48704877
"name": "bicep",
4871-
"version": "0.39.26.7824",
4872-
"templateHash": "16294706585455769047"
4878+
"version": "0.40.2.10011",
4879+
"templateHash": "18254349806162838802"
48734880
}
48744881
},
48754882
"parameters": {
@@ -10809,7 +10816,7 @@
1080910816
"value": "[variables('aiFoundryAiServicesResourceName')]"
1081010817
},
1081110818
"location": {
10812-
"value": "[variables('aiServiceLocation')]"
10819+
"value": "[parameters('azureAiServiceLocation')]"
1081310820
},
1081410821
"tags": {
1081510822
"value": "[parameters('tags')]"
@@ -10874,8 +10881,7 @@
1087410881
},
1087510882
{
1087610883
"roleDefinitionIdOrName": "53ca6127-db72-4b80-b1b0-d745d6d5456d",
10877-
"principalId": "[deployer().objectId]",
10878-
"principalType": "User"
10884+
"principalId": "[deployer().objectId]"
1087910885
}
1088010886
]
1088110887
},
@@ -14073,8 +14079,8 @@
1407314079
},
1407414080
"dependsOn": [
1407514081
"aiFoundryAiServices",
14076-
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').cognitiveServices)]",
1407714082
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').openAI)]",
14083+
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').cognitiveServices)]",
1407814084
"virtualNetwork"
1407914085
]
1408014086
},
@@ -14093,7 +14099,7 @@
1409314099
"value": "[variables('aiFoundryAiProjectResourceName')]"
1409414100
},
1409514101
"location": {
14096-
"value": "[variables('aiServiceLocation')]"
14102+
"value": "[parameters('azureAiServiceLocation')]"
1409714103
},
1409814104
"tags": {
1409914105
"value": "[parameters('tags')]"
@@ -14114,8 +14120,8 @@
1411414120
"metadata": {
1411514121
"_generator": {
1411614122
"name": "bicep",
14117-
"version": "0.39.26.7824",
14118-
"templateHash": "12336056765515184474"
14123+
"version": "0.40.2.10011",
14124+
"templateHash": "12454422624133946770"
1411914125
}
1412014126
},
1412114127
"parameters": {
@@ -14223,6 +14229,127 @@
1422314229
"aiFoundryAiServices"
1422414230
]
1422514231
},
14232+
"existingAiServicesRoleAssignments": {
14233+
"condition": "[variables('useExistingAiFoundryAiProject')]",
14234+
"type": "Microsoft.Resources/deployments",
14235+
"apiVersion": "2025-04-01",
14236+
"name": "[take(format('module.foundry-role-assignment.{0}', variables('aiFoundryAiServicesResourceName')), 64)]",
14237+
"subscriptionId": "[variables('aiFoundryAiServicesSubscriptionId')]",
14238+
"resourceGroup": "[variables('aiFoundryAiServicesResourceGroupName')]",
14239+
"properties": {
14240+
"expressionEvaluationOptions": {
14241+
"scope": "inner"
14242+
},
14243+
"mode": "Incremental",
14244+
"parameters": {
14245+
"aiServicesName": {
14246+
"value": "[variables('aiFoundryAiServicesResourceName')]"
14247+
},
14248+
"principalId": {
14249+
"value": "[reference('userAssignedIdentity').outputs.principalId.value]"
14250+
},
14251+
"principalType": {
14252+
"value": "ServicePrincipal"
14253+
}
14254+
},
14255+
"template": {
14256+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
14257+
"contentVersion": "1.0.0.0",
14258+
"metadata": {
14259+
"_generator": {
14260+
"name": "bicep",
14261+
"version": "0.40.2.10011",
14262+
"templateHash": "5825952797275206162"
14263+
}
14264+
},
14265+
"parameters": {
14266+
"principalId": {
14267+
"type": "string",
14268+
"metadata": {
14269+
"description": "Required. The principal ID of the managed identity to grant access."
14270+
}
14271+
},
14272+
"aiServicesName": {
14273+
"type": "string",
14274+
"metadata": {
14275+
"description": "Required. The name of the existing AI Services account."
14276+
}
14277+
},
14278+
"aiProjectName": {
14279+
"type": "string",
14280+
"defaultValue": "",
14281+
"metadata": {
14282+
"description": "Optional. The name of the existing AI Project."
14283+
}
14284+
},
14285+
"principalType": {
14286+
"type": "string",
14287+
"defaultValue": "ServicePrincipal",
14288+
"allowedValues": [
14289+
"Device",
14290+
"ForeignGroup",
14291+
"Group",
14292+
"ServicePrincipal",
14293+
"User"
14294+
],
14295+
"metadata": {
14296+
"description": "Optional. The principal type of the identity."
14297+
}
14298+
}
14299+
},
14300+
"resources": [
14301+
{
14302+
"type": "Microsoft.Authorization/roleAssignments",
14303+
"apiVersion": "2022-04-01",
14304+
"scope": "[resourceId('Microsoft.CognitiveServices/accounts', parameters('aiServicesName'))]",
14305+
"name": "[guid(resourceId('Microsoft.CognitiveServices/accounts', parameters('aiServicesName')), parameters('principalId'), resourceId('Microsoft.Authorization/roleDefinitions', '53ca6127-db72-4b80-b1b0-d745d6d5456d'))]",
14306+
"properties": {
14307+
"roleDefinitionId": "[resourceId('Microsoft.Authorization/roleDefinitions', '53ca6127-db72-4b80-b1b0-d745d6d5456d')]",
14308+
"principalId": "[parameters('principalId')]",
14309+
"principalType": "[parameters('principalType')]"
14310+
}
14311+
},
14312+
{
14313+
"type": "Microsoft.Authorization/roleAssignments",
14314+
"apiVersion": "2022-04-01",
14315+
"scope": "[resourceId('Microsoft.CognitiveServices/accounts', parameters('aiServicesName'))]",
14316+
"name": "[guid(resourceId('Microsoft.CognitiveServices/accounts', parameters('aiServicesName')), parameters('principalId'), resourceId('Microsoft.Authorization/roleDefinitions', '5e0bd9bd-7b93-4f28-af87-19fc36ad61bd'))]",
14317+
"properties": {
14318+
"roleDefinitionId": "[resourceId('Microsoft.Authorization/roleDefinitions', '5e0bd9bd-7b93-4f28-af87-19fc36ad61bd')]",
14319+
"principalId": "[parameters('principalId')]",
14320+
"principalType": "[parameters('principalType')]"
14321+
}
14322+
}
14323+
],
14324+
"outputs": {
14325+
"aiServicesResourceId": {
14326+
"type": "string",
14327+
"metadata": {
14328+
"description": "The resource ID of the existing AI Services account."
14329+
},
14330+
"value": "[resourceId('Microsoft.CognitiveServices/accounts', parameters('aiServicesName'))]"
14331+
},
14332+
"aiServicesEndpoint": {
14333+
"type": "string",
14334+
"metadata": {
14335+
"description": "The endpoint of the existing AI Services account."
14336+
},
14337+
"value": "[reference(resourceId('Microsoft.CognitiveServices/accounts', parameters('aiServicesName')), '2025-04-01-preview').endpoint]"
14338+
},
14339+
"aiProjectPrincipalId": {
14340+
"type": "string",
14341+
"metadata": {
14342+
"description": "The principal ID of the existing AI Project (if provided)."
14343+
},
14344+
"value": "[if(not(empty(parameters('aiProjectName'))), reference(resourceId('Microsoft.CognitiveServices/accounts/projects', parameters('aiServicesName'), parameters('aiProjectName')), '2025-04-01-preview', 'full').identity.principalId, '')]"
14345+
}
14346+
}
14347+
}
14348+
},
14349+
"dependsOn": [
14350+
"userAssignedIdentity"
14351+
]
14352+
},
1422614353
"aiSearch": {
1422714354
"type": "Microsoft.Resources/deployments",
1422814355
"apiVersion": "2025-04-01",
@@ -31148,8 +31275,8 @@
3114831275
"metadata": {
3114931276
"_generator": {
3115031277
"name": "bicep",
31151-
"version": "0.39.26.7824",
31152-
"templateHash": "11911473200605315360"
31278+
"version": "0.40.2.10011",
31279+
"templateHash": "4220244191786935721"
3115331280
}
3115431281
},
3115531282
"definitions": {
@@ -32094,7 +32221,7 @@
3209432221
},
3209532222
"type": "Microsoft.Insights/diagnosticSettings",
3209632223
"apiVersion": "2021-05-01-preview",
32097-
"scope": "[format('Microsoft.Web/sites/{0}', parameters('name'))]",
32224+
"scope": "[resourceId('Microsoft.Web/sites', parameters('name'))]",
3209832225
"name": "[coalesce(tryGet(coalesce(parameters('diagnosticSettings'), createArray())[copyIndex()], 'name'), format('{0}-diagnosticSettings', parameters('name')))]",
3209932226
"properties": {
3210032227
"copy": [
@@ -32172,8 +32299,8 @@
3217232299
"metadata": {
3217332300
"_generator": {
3217432301
"name": "bicep",
32175-
"version": "0.39.26.7824",
32176-
"templateHash": "13592577410661714505"
32302+
"version": "0.40.2.10011",
32303+
"templateHash": "11071988482502090044"
3217732304
},
3217832305
"name": "Site App Settings",
3217932306
"description": "This module deploys a Site App Setting."
@@ -33293,8 +33420,8 @@
3329333420
"metadata": {
3329433421
"_generator": {
3329533422
"name": "bicep",
33296-
"version": "0.39.26.7824",
33297-
"templateHash": "11247487291315089538"
33423+
"version": "0.40.2.10011",
33424+
"templateHash": "5126970369332146090"
3329833425
}
3329933426
},
3330033427
"parameters": {
@@ -33687,7 +33814,7 @@
3368733814
"metadata": {
3368833815
"description": "Contains the location used for AI Services deployment"
3368933816
},
33690-
"value": "[variables('aiServiceLocation')]"
33817+
"value": "[parameters('azureAiServiceLocation')]"
3369133818
},
3369233819
"CONTAINER_INSTANCE_NAME": {
3369333820
"type": "string",

0 commit comments

Comments
 (0)