Skip to content

Commit b592405

Browse files
Merge pull request #119 from microsoft/quota-auto-validation
feat: Added Quota Auto Validation Scripts
2 parents 0ff6ab4 + 56e058b commit b592405

10 files changed

Lines changed: 486 additions & 70 deletions

azure.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,19 @@ deployment:
2121
AzureAiServiceLocation: ${{ parameters.AzureAiServiceLocation }}
2222
Prefix: ${{ parameters.Prefix }}
2323
baseUrl: ${{ parameters.baseUrl }}
24+
hooks:
25+
preprovision:
26+
posix:
27+
shell: sh
28+
run: >
29+
chmod u+r+x ./scripts/validate_model_deployment_quota.sh; chmod u+r+x ./scripts/validate_model_quota.sh; ./scripts/validate_model_deployment_quota.sh --subscription "$AZURE_SUBSCRIPTION_ID" --location "${AZURE_AISERVICE_LOCATION:-japaneast}" --models-parameter "aiModelDeployments"
30+
interactive: false
31+
continueOnError: false
32+
33+
windows:
34+
shell: pwsh
35+
run: >
36+
$location = if ($env:AZURE_AISERVICE_LOCATION) { $env:AZURE_AISERVICE_LOCATION } else { "japaneast" };
37+
./scripts/validate_model_deployment_quota.ps1 -SubscriptionId $env:AZURE_SUBSCRIPTION_ID -Location $location -ModelsParameter "aiModelDeployments"
38+
interactive: false
39+
continueOnError: false

infra/main.bicep

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,19 @@ param Prefix string
44
var abbrs = loadJsonContent('./abbreviations.json')
55
var safePrefix = length(Prefix) > 20 ? substring(Prefix, 0, 20) : Prefix
66

7+
@description('Required. Location for all Resources except AI Foundry.')
8+
param solutionLocation string = resourceGroup().location
9+
710
@allowed([
811
'australiaeast'
9-
'brazilsouth'
10-
'canadacentral'
11-
'canadaeast'
1212
'eastus'
1313
'eastus2'
1414
'francecentral'
15-
'germanywestcentral'
1615
'japaneast'
17-
'koreacentral'
18-
'northcentralus'
1916
'norwayeast'
20-
'polandcentral'
21-
'southafricanorth'
22-
'southcentralus'
2317
'southindia'
2418
'swedencentral'
25-
'switzerlandnorth'
26-
'uaenorth'
2719
'uksouth'
28-
'westeurope'
2920
'westus'
3021
'westus3'
3122
])
@@ -57,8 +48,6 @@ param gptModelVersion string = '2024-08-06'
5748
var uniqueId = toLower(uniqueString(subscription().id, safePrefix, resourceGroup().location))
5849
var UniquePrefix = 'cm${padLeft(take(uniqueId, 12), 12, '0')}'
5950
var ResourcePrefix = take('cm${safePrefix}${UniquePrefix}', 15)
60-
var location = resourceGroup().location
61-
var dblocation = resourceGroup().location
6251
var cosmosdbDatabase = 'cmsadb'
6352
var cosmosdbBatchContainer = 'cmsabatch'
6453
var cosmosdbFileContainer = 'cmsafile'
@@ -85,7 +74,7 @@ var aiModelDeployments = [
8574

8675
resource azureAiServices 'Microsoft.CognitiveServices/accounts@2024-04-01-preview' = {
8776
name: azureAiServicesName
88-
location: location
77+
location: AzureAiServiceLocation
8978
sku: {
9079
name: 'S0'
9180
}
@@ -121,7 +110,7 @@ module managedIdentityModule 'deploy_managed_identity.bicep' = {
121110
params: {
122111
miName:'${abbrs.security.managedIdentity}${ResourcePrefix}'
123112
solutionName: ResourcePrefix
124-
solutionLocation: location
113+
solutionLocation: solutionLocation
125114
}
126115
scope: resourceGroup(resourceGroup().name)
127116
}
@@ -133,7 +122,7 @@ module kvault 'deploy_keyvault.bicep' = {
133122
params: {
134123
keyvaultName: '${abbrs.security.keyVault}${ResourcePrefix}'
135124
solutionName: ResourcePrefix
136-
solutionLocation: location
125+
solutionLocation: solutionLocation
137126
managedIdentityObjectId:managedIdentityModule.outputs.managedIdentityOutput.objectId
138127
}
139128
scope: resourceGroup(resourceGroup().name)
@@ -162,7 +151,7 @@ module containerAppsEnvironment 'br/public:avm/res/app/managed-environment:0.9.1
162151
params: {
163152
logAnalyticsWorkspaceResourceId: azureAifoundry.outputs.logAnalyticsId
164153
name: toLower('${ResourcePrefix}manenv')
165-
location: location
154+
location: solutionLocation
166155
zoneRedundant: false
167156
managedIdentities: managedIdentityModule
168157
}
@@ -175,7 +164,7 @@ module databaseAccount 'br/public:avm/res/document-db/database-account:0.9.0' =
175164
name: toLower('${abbrs.databases.cosmosDBDatabase}${ResourcePrefix}databaseAccount')
176165
// Non-required parameters
177166
enableAnalyticalStorage: true
178-
location: dblocation
167+
location: solutionLocation
179168
managedIdentities: {
180169
systemAssigned: true
181170
userAssignedResourceIds: [
@@ -193,7 +182,7 @@ module databaseAccount 'br/public:avm/res/document-db/database-account:0.9.0' =
193182
{
194183
failoverPriority: 0
195184
isZoneRedundant: false
196-
locationName: dblocation
185+
locationName: solutionLocation
197186
}
198187
]
199188
sqlDatabases: [
@@ -268,14 +257,14 @@ module containerAppFrontend 'br/public:avm/res/app/container-app:0.13.0' = {
268257
environmentResourceId: containerAppsEnvironment.outputs.resourceId
269258
name: toLower('${abbrs.containers.containerApp}${ResourcePrefix}Frontend')
270259
// Non-required parameters
271-
location: location
260+
location: solutionLocation
272261
}
273262
}
274263

275264

276265
resource containerAppBackend 'Microsoft.App/containerApps@2023-05-01' = {
277266
name: toLower('${abbrs.containers.containerApp}${ResourcePrefix}Backend')
278-
location: location
267+
location: solutionLocation
279268
identity: {
280269
type: 'SystemAssigned'
281270
}
@@ -393,7 +382,7 @@ resource containerAppBackend 'Microsoft.App/containerApps@2023-05-01' = {
393382
}
394383
resource storageContianerApp 'Microsoft.Storage/storageAccounts@2022-09-01' = {
395384
name: storageContainerName
396-
location: location
385+
location: solutionLocation
397386
sku: {
398387
name: storageSkuName
399388
}

infra/main.bicepparam

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
using './main.bicep'
22

33
param Prefix = readEnvironmentVariable('AZURE_ENV_NAME','azdtemp')
4-
param AzureAiServiceLocation = readEnvironmentVariable('AZURE_LOCATION','japaneast')
4+
param solutionLocation = readEnvironmentVariable('AZURE_LOCATION', 'eastus2')
5+
param AzureAiServiceLocation = readEnvironmentVariable('AZURE_AISERVICE_LOCATION','japaneast')
56
param capacity = int(readEnvironmentVariable('AZURE_ENV_MODEL_CAPACITY', '200'))
67
param deploymentType = readEnvironmentVariable('AZURE_ENV_MODEL_DEPLOYMENT_TYPE', 'GlobalStandard')
78
param llmModel = readEnvironmentVariable('AZURE_ENV_MODEL_NAME', 'gpt-4o')

0 commit comments

Comments
 (0)