@@ -36,8 +36,19 @@ param location string
3636@description ('Optional. Secondary location for databases creation.' )
3737param secondaryLocation string = 'uksouth'
3838
39- @description ('Optional. Location for AI deployments. If not specified, uses the main location.' )
40- param azureAiServiceLocation string = ''
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+ })
50+ @description ('Required. Location for AI deployments.' )
51+ param azureAiServiceLocation string
4152
4253@minLength (1 )
4354@allowed ([
@@ -122,72 +133,6 @@ param createdBy string = contains(deployer(), 'userPrincipalName')? split(deploy
122133
123134var solutionLocation = empty (location ) ? resourceGroup ().location : location
124135
125- // Regions that support GPT-5.1, GPT-Image-1, and text-embedding models with GlobalStandard SKU
126- // Update this list as Azure expands model availability
127- var validAiServiceRegions = [
128- 'australiaeast'
129- 'eastus'
130- 'eastus2'
131- 'francecentral'
132- 'japaneast'
133- 'koreacentral'
134- 'swedencentral'
135- 'switzerlandnorth'
136- 'uaenorth'
137- 'uksouth'
138- 'westus'
139- 'westus3'
140- ]
141-
142- // Map regions to recommended AI service regions (for when main region lacks model support)
143- var aiServiceRegionFallback = {
144- australiaeast : 'australiaeast'
145- australiasoutheast : 'australiaeast'
146- brazilsouth : 'eastus2'
147- canadacentral : 'eastus2'
148- canadaeast : 'eastus2'
149- centralindia : 'uksouth'
150- centralus : 'eastus2'
151- eastasia : 'japaneast'
152- eastus : 'eastus'
153- eastus2 : 'eastus2'
154- francecentral : 'francecentral'
155- germanywestcentral : 'swedencentral'
156- japaneast : 'japaneast'
157- japanwest : 'japaneast'
158- koreacentral : 'koreacentral'
159- koreasouth : 'koreacentral'
160- northcentralus : 'eastus2'
161- northeurope : 'swedencentral'
162- norwayeast : 'swedencentral'
163- polandcentral : 'swedencentral'
164- qatarcentral : 'uaenorth'
165- southafricanorth : 'uksouth'
166- southcentralus : 'eastus2'
167- southeastasia : 'japaneast'
168- southindia : 'uksouth'
169- swedencentral : 'swedencentral'
170- switzerlandnorth : 'switzerlandnorth'
171- uaenorth : 'uaenorth'
172- uksouth : 'uksouth'
173- ukwest : 'uksouth'
174- westcentralus : 'westus'
175- westeurope : 'swedencentral'
176- westindia : 'uksouth'
177- westus : 'westus'
178- westus2 : 'westus'
179- westus3 : 'westus3'
180- }
181-
182- // Determine effective AI service location:
183- // 1. If explicitly set via parameter, use that (user override)
184- // 2. If main location is valid for AI services, use it
185- // 3. Otherwise, use the fallback mapping
186- var requestedAiLocation = empty (azureAiServiceLocation ) ? solutionLocation : azureAiServiceLocation
187- var aiServiceLocation = contains (validAiServiceRegions , requestedAiLocation )
188- ? requestedAiLocation
189- : (aiServiceRegionFallback [?solutionLocation ] ?? 'eastus2' )
190-
191136// acrName is required - points to existing ACR with pre-built images
192137var acrResourceName = acrName
193138var solutionSuffix = toLower (trim (replace (
@@ -463,7 +408,7 @@ module aiFoundryAiServices 'br/public:avm/res/cognitive-services/account:0.14.0'
463408 name : take ('avm.res.cognitive-services.account.${aiFoundryAiServicesResourceName }' , 64 )
464409 params : {
465410 name : aiFoundryAiServicesResourceName
466- location : aiServiceLocation
411+ location : azureAiServiceLocation
467412 tags : tags
468413 sku : 'S0'
469414 kind : 'AIServices'
@@ -557,7 +502,7 @@ module aiFoundryAiServicesProject 'modules/ai-project.bicep' = if (!useExistingA
557502 name : take ('module.ai-project.${aiFoundryAiProjectResourceName }' , 64 )
558503 params : {
559504 name : aiFoundryAiProjectResourceName
560- location : aiServiceLocation
505+ location : azureAiServiceLocation
561506 tags : tags
562507 desc : aiFoundryAiProjectDescription
563508 aiServicesName : aiFoundryAiServicesResourceName
@@ -1003,7 +948,7 @@ output AZURE_AI_AGENT_API_VERSION string = azureAiAgentApiVersion
1003948output AZURE_APPLICATION_INSIGHTS_CONNECTION_STRING string = (enableMonitoring && !useExistingLogAnalytics ) ? applicationInsights !.outputs .connectionString : ''
1004949
1005950@description ('Contains the location used for AI Services deployment' )
1006- output AI_SERVICE_LOCATION string = aiServiceLocation
951+ output AZURE_ENV_OPENAI_LOCATION string = azureAiServiceLocation
1007952
1008953@description ('Contains Container Instance Name' )
1009954output CONTAINER_INSTANCE_NAME string = containerInstance .outputs .name
0 commit comments