Skip to content

Commit 513526c

Browse files
Merge pull request #59 from microsoft/azd-quota-check
AZD Quota Check
2 parents 0a22b20 + c157ffb commit 513526c

17 files changed

Lines changed: 142 additions & 479 deletions

azure.yaml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,4 @@ hooks:
1414
shell: sh
1515
run: chmod u+r+x ./scripts/set_conns_env_vars.sh; ./scripts/set_conns_env_vars.sh
1616
interactive: true
17-
continueOnError: false
18-
preprovision:
19-
posix:
20-
shell: sh
21-
run: chmod u+r+x ./scripts/validate_model_deployment_quotas.sh; chmod u+r+x ./scripts/validate_model_quota.sh; ./scripts/validate_model_deployment_quotas.sh --subscription $AZURE_SUBSCRIPTION_ID --location $AZURE_LOCATION --models-parameter "aiModelDeployments"
22-
interactive: false
23-
continueOnError: false
24-
windows:
25-
shell: pwsh
26-
run: ./scripts/validate_model_deployment_quotas.ps1 -Subscription $env:AZURE_SUBSCRIPTION_ID -Location $env:AZURE_LOCATION -ModelsParameter "aiModelDeployments"
27-
interactive: false
2817
continueOnError: false

docs/modify_deployed_models.md

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,24 @@
11
## Update AI Model Deployments
2-
The AI Models that can be deployed and attached to the Foundry hub can be modified by changing the parameters within the [main.parameters.json](../infra/main.parameters.json) file.
32

4-
By modifying the parameters listed in the parameters.json 'aiModelDeployments' section, additional or different models can be deployed with the solution and ready for use after the deployment. Simply modify the values to your liking in each of the objects, or add additional objects to the array.
5-
```powershell
3+
The AI Models that can be deployed and attached to the Foundry hub can be modified by changing the parameters within the [main.parameters.json](../infra/main.parameters.json) file.
64

5+
By modifying the parameters `aiEmbeddingModelDeployment` and `aiGPTModelDeployment` listed in the parameters.json, different embedding and GPT models can be deployed with the solution and ready for use after the deployment. Simply modify the values to your liking in each of the objects.
76

8-
"aiModelDeployments": {
9-
"value": [
10-
{
11-
"name": "textembed",
12-
"model": {
13-
"name": modelName,
14-
"format": modelPublisherFormat,
15-
"version": modelVersion
16-
},
17-
"sku": {
18-
"name": skuName,
19-
"capacity": capacity
20-
}
21-
},
22-
{
23-
"name": "gpt",
24-
"model": {
25-
"name": "gpt-4o",
26-
"version": "2024-05-13",
27-
"format": "OpenAI"
28-
},
29-
"sku": {
30-
"name": "GlobalStandard",
31-
"capacity": 10
32-
}
33-
}
34-
]
7+
```powershell
8+
"aiEmbeddingModelDeployment": {
9+
"value": {
10+
"modelName": modelName,
11+
"version": modelVersion,
12+
"capacity": capacity
13+
}
14+
},
15+
"aiGPTModelDeployment": {
16+
"value": {
17+
"modelName": "gpt-4o",
18+
"version": "2024-05-13",
19+
"capacity": 150
20+
}
3521
}
3622
```
23+
3724
To find and validate additional model information, the [AI Foundry](https://ai.azure.com/explore/models) model page has the above parameters to refer to, as does the Microsoft Learn page for [Azure OpenAI Service Models](https://learn.microsoft.com/en-us/azure/ai-services/openai_) information.

infra/main.bicep

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,27 @@ targetScope = 'resourceGroup'
55
@description('The name of the environment/application. Use alphanumeric characters only.')
66
param name string
77

8-
@description('Specifies the location for all the Azure resources. Defaults to the location of the resource group.')
8+
@metadata({ azd: { type: 'location' } })
9+
@description('Specifies the location for all the Azure resources.')
910
param location string
1011

11-
@description('Optional. Specifies the OpenAI deployments to create.')
12-
param aiModelDeployments deploymentsType[] = []
12+
@description('Specifies the AI embedding model to use for the AI Foundry deployment. This is the model used for text embeddings in AI Foundry. NOTE: Any adjustments to this parameter\'s values must also be made on the aiDeploymentsLocation metadata in the main.bicep file.')
13+
param aiEmbeddingModelDeployment modelDeploymentType
14+
15+
@description('Specifies the AI chat model to use for the AI Foundry deployment. This is the model used for chat interactions in AI Foundry. NOTE: Any adjustments to this parameter\'s values must also be made on the aiDeploymentsLocation metadata in the main.bicep file.')
16+
param aiGPTModelDeployment modelDeploymentType
17+
18+
@metadata({
19+
azd: {
20+
type: 'location'
21+
usageName: [
22+
'OpenAI.GlobalStandard.gpt-4o,150'
23+
'OpenAI.GlobalStandard.text-embedding-3-small,100'
24+
]
25+
}
26+
})
27+
@description('Required. Location for AI Foundry deployment. This is the location where the AI Foundry resources will be deployed.')
28+
param aiDeploymentsLocation string
1329

1430
@description('Specifies whether creating an Azure Container Registry.')
1531
param acrEnabled bool = false
@@ -83,12 +99,6 @@ param documentIntelligenceEnabled bool = false
8399
param networkAcls object ={
84100
defaultAction: 'Deny'
85101
bypass: 'AzureServices' // ✅ Allows trusted Microsoft services
86-
// virtualNetworkRules: [
87-
// {
88-
// id: networkIsolation ? network.outputs.vmSubnetName : ''
89-
// ignoreMissingVnetServiceEndpoint: true
90-
// }
91-
// ]
92102
}
93103

94104
@description('Name of the first project')
@@ -216,13 +226,26 @@ module cognitiveServices 'modules/cognitive-services/main.bicep' = {
216226
params: {
217227
name: name
218228
resourceToken: resourceToken
219-
location: location
229+
location: aiDeploymentsLocation
220230
networkIsolation: networkIsolation
221231
networkAcls: networkAcls
222232
virtualNetworkResourceId: networkIsolation ? network.outputs.virtualNetworkId : ''
223233
virtualNetworkSubnetResourceId: networkIsolation ? network.outputs.vmSubnetId : ''
224234
logAnalyticsWorkspaceResourceId: logAnalyticsWorkspace.outputs.resourceId
225-
aiModelDeployments: aiModelDeployments
235+
aiModelDeployments: [
236+
for model in [aiEmbeddingModelDeployment, aiGPTModelDeployment]: {
237+
name: empty(model.?name) ? model.modelName : model.?name
238+
model: {
239+
name: model.modelName
240+
format: 'OpenAI'
241+
version: model.version
242+
}
243+
sku: {
244+
name: 'GlobalStandard'
245+
capacity: model.capacity
246+
}
247+
}
248+
]
226249
userObjectId: userObjectId
227250
contentSafetyEnabled: contentSafetyEnabled
228251
visionEnabled: visionEnabled
@@ -242,7 +265,7 @@ module project 'modules/ai-foundry-project/main.bicep' = {
242265
cosmosDbEnabled: cosmosDbEnabled
243266
searchEnabled: searchEnabled
244267
name: projectName
245-
location: location
268+
location: aiDeploymentsLocation
246269
storageName: storageAccount.outputs.storageName
247270
aiServicesName: cognitiveServices.outputs.aiServicesName
248271
nameFormatted: searchEnabled ? aiSearch.outputs.name : ''
@@ -357,7 +380,7 @@ module sqlServer 'modules/sqlServer.bicep' = if (sqlServerEnabled) {
357380
}
358381
}
359382

360-
import { sqlDatabaseType, databasePropertyType, deploymentsType } from 'modules/customTypes.bicep'
383+
import { sqlDatabaseType, databasePropertyType, modelDeploymentType } from 'modules/customTypes.bicep'
361384

362385

363386
output AZURE_KEY_VAULT_NAME string = keyvault.outputs.name

infra/main.json

Lines changed: 47 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"_generator": {
77
"name": "bicep",
88
"version": "0.36.1.42791",
9-
"templateHash": "14037525013444695971"
9+
"templateHash": "1266095135796943159"
1010
}
1111
},
1212
"definitions": {
@@ -591,101 +591,37 @@
591591
}
592592
}
593593
},
594-
"deploymentsType": {
594+
"modelDeploymentType": {
595595
"type": "object",
596596
"properties": {
597597
"name": {
598598
"type": "string",
599599
"nullable": true,
600600
"metadata": {
601-
"description": "Optional. Specify the name of cognitive service account deployment."
601+
"description": "Optional. The name of the Cognitive Services account deployment model. The modelName will be used by default if not specified."
602602
}
603603
},
604-
"model": {
605-
"type": "object",
606-
"properties": {
607-
"name": {
608-
"type": "string",
609-
"metadata": {
610-
"description": "Required. The name of Cognitive Services account deployment model."
611-
}
612-
},
613-
"format": {
614-
"type": "string",
615-
"metadata": {
616-
"description": "Required. The format of Cognitive Services account deployment model."
617-
}
618-
},
619-
"version": {
620-
"type": "string",
621-
"metadata": {
622-
"description": "Required. The version of Cognitive Services account deployment model."
623-
}
624-
}
625-
},
626-
"metadata": {
627-
"description": "Required. Properties of Cognitive Services account deployment model."
628-
}
629-
},
630-
"sku": {
631-
"type": "object",
632-
"properties": {
633-
"name": {
634-
"type": "string",
635-
"metadata": {
636-
"description": "Required. The name of the resource model definition representing SKU."
637-
}
638-
},
639-
"capacity": {
640-
"type": "int",
641-
"nullable": true,
642-
"metadata": {
643-
"description": "Optional. The capacity of the resource model definition representing SKU."
644-
}
645-
},
646-
"tier": {
647-
"type": "string",
648-
"nullable": true,
649-
"metadata": {
650-
"description": "Optional. The tier of the resource model definition representing SKU."
651-
}
652-
},
653-
"size": {
654-
"type": "string",
655-
"nullable": true,
656-
"metadata": {
657-
"description": "Optional. The size of the resource model definition representing SKU."
658-
}
659-
},
660-
"family": {
661-
"type": "string",
662-
"nullable": true,
663-
"metadata": {
664-
"description": "Optional. The family of the resource model definition representing SKU."
665-
}
666-
}
667-
},
668-
"nullable": true,
604+
"modelName": {
605+
"type": "string",
669606
"metadata": {
670-
"description": "Optional. The resource model definition representing SKU."
607+
"description": "Required. The format of the Cognitive Services account deployment model."
671608
}
672609
},
673-
"raiPolicyName": {
610+
"version": {
674611
"type": "string",
675-
"nullable": true,
676612
"metadata": {
677-
"description": "Optional. The name of RAI policy."
613+
"description": "Required. The version of the Cognitive Services account deployment model."
678614
}
679615
},
680-
"versionUpgradeOption": {
681-
"type": "string",
682-
"nullable": true,
616+
"capacity": {
617+
"type": "int",
683618
"metadata": {
684-
"description": "Optional. The version upgrade option."
619+
"description": "Required. The capacity of the resource model definition representing SKU."
685620
}
686621
}
687622
},
688623
"metadata": {
624+
"description": "The AI model deployment type for Cognitive Services account.",
689625
"__bicep_imported_from!": {
690626
"sourceTemplate": "modules/customTypes.bicep"
691627
}
@@ -877,17 +813,35 @@
877813
"location": {
878814
"type": "string",
879815
"metadata": {
880-
"description": "Specifies the location for all the Azure resources. Defaults to the location of the resource group."
816+
"azd": {
817+
"type": "location"
818+
},
819+
"description": "Specifies the location for all the Azure resources."
881820
}
882821
},
883-
"aiModelDeployments": {
884-
"type": "array",
885-
"items": {
886-
"$ref": "#/definitions/deploymentsType"
887-
},
888-
"defaultValue": [],
822+
"aiEmbeddingModelDeployment": {
823+
"$ref": "#/definitions/modelDeploymentType",
889824
"metadata": {
890-
"description": "Optional. Specifies the OpenAI deployments to create."
825+
"description": "Specifies the AI embedding model to use for the AI Foundry deployment. This is the model used for text embeddings in AI Foundry. NOTE: Any adjustments to this parameter's values must also be made on the aiDeploymentsLocation metadata in the main.bicep file."
826+
}
827+
},
828+
"aiGPTModelDeployment": {
829+
"$ref": "#/definitions/modelDeploymentType",
830+
"metadata": {
831+
"description": "Specifies the AI chat model to use for the AI Foundry deployment. This is the model used for chat interactions in AI Foundry. NOTE: Any adjustments to this parameter's values must also be made on the aiDeploymentsLocation metadata in the main.bicep file."
832+
}
833+
},
834+
"aiDeploymentsLocation": {
835+
"type": "string",
836+
"metadata": {
837+
"azd": {
838+
"type": "location",
839+
"usageName": [
840+
"OpenAI.GlobalStandard.gpt-4o,150",
841+
"OpenAI.GlobalStandard.text-embedding-3-small,100"
842+
]
843+
},
844+
"description": "Required. Location for AI Foundry deployment. This is the location where the AI Foundry resources will be deployed."
891845
}
892846
},
893847
"acrEnabled": {
@@ -30173,7 +30127,7 @@
3017330127
"value": "[variables('resourceToken')]"
3017430128
},
3017530129
"location": {
30176-
"value": "[parameters('location')]"
30130+
"value": "[parameters('aiDeploymentsLocation')]"
3017730131
},
3017830132
"networkIsolation": {
3017930133
"value": "[parameters('networkIsolation')]"
@@ -30187,7 +30141,13 @@
3018730141
"value": "[reference('logAnalyticsWorkspace').outputs.resourceId.value]"
3018830142
},
3018930143
"aiModelDeployments": {
30190-
"value": "[parameters('aiModelDeployments')]"
30144+
"copy": [
30145+
{
30146+
"name": "value",
30147+
"count": "[length(createArray(parameters('aiEmbeddingModelDeployment'), parameters('aiGPTModelDeployment')))]",
30148+
"input": "[createObject('name', if(empty(tryGet(createArray(parameters('aiEmbeddingModelDeployment'), parameters('aiGPTModelDeployment'))[copyIndex('value')], 'name')), createArray(parameters('aiEmbeddingModelDeployment'), parameters('aiGPTModelDeployment'))[copyIndex('value')].modelName, tryGet(createArray(parameters('aiEmbeddingModelDeployment'), parameters('aiGPTModelDeployment'))[copyIndex('value')], 'name')), 'model', createObject('name', createArray(parameters('aiEmbeddingModelDeployment'), parameters('aiGPTModelDeployment'))[copyIndex('value')].modelName, 'format', 'OpenAI', 'version', createArray(parameters('aiEmbeddingModelDeployment'), parameters('aiGPTModelDeployment'))[copyIndex('value')].version), 'sku', createObject('name', 'GlobalStandard', 'capacity', createArray(parameters('aiEmbeddingModelDeployment'), parameters('aiGPTModelDeployment'))[copyIndex('value')].capacity))]"
30149+
}
30150+
]
3019130151
},
3019230152
"userObjectId": {
3019330153
"value": "[parameters('userObjectId')]"
@@ -55772,7 +55732,7 @@
5577255732
"value": "[parameters('projectName')]"
5577355733
},
5577455734
"location": {
55775-
"value": "[parameters('location')]"
55735+
"value": "[parameters('aiDeploymentsLocation')]"
5577655736
},
5577755737
"storageName": {
5577855738
"value": "[reference('storageAccount').outputs.storageName.value]"

0 commit comments

Comments
 (0)