Skip to content

Commit bffa22c

Browse files
committed
update quota check script
1 parent f146fab commit bffa22c

4 files changed

Lines changed: 43 additions & 50 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
"yzhang.markdown-all-in-one",
4343
"ms-azuretools.azure-dev",
4444
"ms-vscode.azurecli",
45-
"ms-azuretools.vscode-bicep"
45+
"ms-azuretools.vscode-bicep",
46+
"tonybaloney.vscode-pets"
4647
]
4748
}
4849
},

azure.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@ hooks:
1111
preprovision:
1212
posix:
1313
shell: sh
14-
run: sudo chmod u+r+x ./infra/scripts/validate_model_deployment_quotas.sh; sudo chmod u+r+x ./infra/scripts/validate_model_quota.sh; .infra/scripts/validate_model_deployment_quotas.sh --subscription $AZURE_SUBSCRIPTION_ID --location $AZURE_LOCATION --models-parameter "aiModelDeployments; timestamp=$(date +"%Y%m%d-%H%M%S"); logFile="azd_preprovision_$timestamp.log"; sed -i 's/\r$//' ./infra/scripts/docker-build.sh; ./infra/scripts/docker-build.sh "$AZURE_SUBSCRIPTION_ID" "$AZURE_ENV_NAME" "$AZURE_LOCATION" "$AZURE_RESOURCE_GROUP" "$USE_LOCAL_BUILD" 2>&1 | tee "$logFile"
14+
run: sudo chmod u+r+x ./infra/scripts/validate_model_deployment_quotas.sh; sudo chmod u+r+x ./infra/scripts/validate_model_quota.sh; ./infra/scripts/validate_model_deployment_quotas.sh --subscription $AZURE_SUBSCRIPTION_ID --location $AZURE_LOCATION --models-parameter "aiModelDeployments"; timestamp=$(date +"%Y%m%d-%H%M%S"); logFile="azd_preprovision_$timestamp.log"; sed -i 's/\r$//' ./infra/scripts/docker-build.sh; ./infra/scripts/docker-build.sh "$AZURE_SUBSCRIPTION_ID" "$AZURE_ENV_NAME" "$AZURE_LOCATION" "$AZURE_RESOURCE_GROUP" "$USE_LOCAL_BUILD" 2>&1 | tee "$logFile"
1515
windows:
1616
shell: pwsh
1717
run: ./infra/scripts/validate_model_deployment_quotas.ps1 -Subscription $env:AZURE_SUBSCRIPTION_ID -Location $env:AZURE_LOCATION -ModelsParameter "aiModelDeployments" ;$timestamp = Get-Date -Format "yyyyMMdd-HHmmss"; $logFile = "azd_preprovision_$timestamp.log"; Tee-Object -FilePath $logFile
1818
interactive: true
19-
continueOnError: false
2019
postprovision:
2120
posix:
2221
shell: sh

infra/main.bicep

Lines changed: 38 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ module avmRoleAssignment 'br/public:avm/ptn/authorization/resource-role-assignme
112112
resourceId: avmManagedIdentity.outputs.resourceId
113113
principalId: avmManagedIdentity.outputs.principalId
114114
roleDefinitionId: '8e3af657-a8ff-443c-a75c-2fe8c4bcb635'
115+
principalType: 'ServicePrincipal'
115116
}
116117
}
117118

@@ -141,9 +142,9 @@ module avmRoleAssignment 'br/public:avm/ptn/authorization/resource-role-assignme
141142
module avmKeyVault './modules/key-vault.bicep' = {
142143
name: format(deployment_param.resource_name_format_string, abbrs.security.keyVault)
143144
params: {
144-
deployment_param: deployment_param
145+
name: format(deployment_param.resource_name_format_string, abbrs.security.keyVault)
145146
keyVaultParams: {
146-
keyvaultName: '${abbrs.security.keyVault}${deployment_param.solution_prefix}'
147+
keyvault_name: '${abbrs.security.keyVault}${deployment_param.solution_prefix}'
147148
location: deployment_param.resource_group_location
148149
tags: {
149150
app: deployment_param.solution_prefix
@@ -182,37 +183,41 @@ module avmKeyVault './modules/key-vault.bicep' = {
182183
// scope: resourceGroup(resourceGroup().name)
183184
// }
184185

185-
// ========== Application insights and Log Analytics Workspace (AVM module) ========== //
186-
module avmAppInsightsAndLogAnalytics './modules/app-insights.bicep' = {
187-
name: format(deployment_param.resource_name_format_string, 'ai-law-avm')
186+
// ========== Application insights ========== //
187+
module avmLogAnalyticsWorkspace 'br/public:avm/res/operational-insights/workspace:0.11.2' = {
188+
name: format(deployment_param.resource_name_format_string, abbrs.managementGovernance.logAnalyticsWorkspace)
188189
params: {
189-
deployment_param: deployment_param
190-
appInsights_param: {
191-
appInsightsName: '${abbrs.managementGovernance.applicationInsights}${deployment_param.solution_prefix}'
192-
logAnalyticsWorkspaceName: '${abbrs.managementGovernance.logAnalyticsWorkspace}${deployment_param.solution_prefix}'
193-
location: deployment_param.resource_group_location
194-
kind: 'web'
195-
retentionInDays: 30
196-
features: {
197-
searchVersion: 1
198-
}
199-
skuName: 'PerGB2018'
200-
applicationType: 'web'
201-
disableIpMasking: false
202-
disableLocalAuth: false
203-
flowType: 'Bluefield'
204-
forceCustomerStorageForProfiler: false
205-
//ImmediatePurgeDataOn30Days: true
206-
//IngestionMode: 'LogAnalytics'
207-
publicNetworkAccessForIngestion: 'Enabled'
208-
publicNetworkAccessForQuery: 'Disabled'
209-
requestSource: 'rest'
210-
211-
}
190+
name: '${abbrs.managementGovernance.logAnalyticsWorkspace}${deployment_param.solution_prefix}'
191+
location: deployment_param.resource_group_location
192+
diagnosticSettings: [{ useThisWorkspace: true }]
193+
skuName: 'PerGB2018'
194+
dataRetention: 30
212195
}
213-
scope: resourceGroup(resourceGroup().name)
214196
}
215197

198+
module avmApplicationInsights 'br/public:avm/res/insights/component:0.6.0' = {
199+
name: format(deployment_param.resource_name_format_string, abbrs.managementGovernance.applicationInsights)
200+
params: {
201+
name: '${abbrs.managementGovernance.applicationInsights}${deployment_param.solution_prefix}'
202+
location: deployment_param.resource_group_location
203+
workspaceResourceId: avmLogAnalyticsWorkspace.outputs.resourceId
204+
retentionInDays: 30
205+
kind: 'web'
206+
disableIpMasking: false
207+
flowType: 'Bluefield'
208+
diagnosticSettings: [{ workspaceResourceId: avmLogAnalyticsWorkspace.outputs.resourceId }]
209+
}
210+
}
211+
212+
// module applicationInsights 'deploy_app_insights.bicep' = {
213+
// name: 'deploy_app_insights'
214+
// params: {
215+
// applicationInsightsName: '${abbrs.managementGovernance.applicationInsights}${solutionPrefix}'
216+
// logAnalyticsWorkspaceName: '${abbrs.managementGovernance.logAnalyticsWorkspace}${solutionPrefix}'
217+
// }
218+
// }
219+
220+
// // ========== Container Registry ========== //
216221
module avmContainerRegistry 'br/public:avm/res/container-registry/registry:0.9.1' = {
217222
name: format(deployment_param.resource_name_format_string, abbrs.containers.containerRegistry)
218223
params: {
@@ -371,7 +376,7 @@ module avmAiServices_storage_hub 'br/public:avm/res/storage/storage-account:0.20
371376
allowSharedKeyAccess: false
372377
diagnosticSettings: [
373378
{
374-
workspaceResourceId: avmAppInsightsAndLogAnalytics.outputs.logAnalyticsWorkspaceId
379+
workspaceResourceId: avmLogAnalyticsWorkspace.outputs.resourceId
375380
}
376381
]
377382
blobServices: {
@@ -380,7 +385,7 @@ module avmAiServices_storage_hub 'br/public:avm/res/storage/storage-account:0.20
380385
containerDeleteRetentionPoloicyEnabled: false
381386
diagnosticSettings: [
382387
{
383-
workspaceResourceId: avmAppInsightsAndLogAnalytics.outputs.logAnalyticsWorkspaceId
388+
workspaceResourceId: avmLogAnalyticsWorkspace.outputs.resourceId
384389
}
385390
]
386391
}
@@ -412,7 +417,7 @@ module avmAiHub 'br/public:avm/res/machine-learning-services/workspace:0.12.1' =
412417
associatedKeyVaultResourceId: avmKeyVault.outputs.resourceId
413418
associatedStorageAccountResourceId: avmAiServices_storage_hub.outputs.resourceId
414419
associatedContainerRegistryResourceId: avmContainerRegistry.outputs.resourceId
415-
associatedApplicationInsightsResourceId: avmAppInsightsAndLogAnalytics.outputs.applicationInsightsId
420+
associatedApplicationInsightsResourceId: avmApplicationInsights.outputs.resourceId
416421

417422
kind: 'Hub'
418423
connections: [
@@ -466,18 +471,6 @@ module avmAiProject 'br/public:avm/res/machine-learning-services/workspace:0.12.
466471
// scope: resourceGroup(resourceGroup().name)
467472
// }
468473

469-
//TODO: Remove
470-
471-
module avmLogAnalyticsWorkspace 'br/public:avm/res/operational-insights/workspace:0.11.2' = {
472-
name: 'workspaceDeployment'
473-
params: {
474-
// Required parameters
475-
name: avmAppInsightsAndLogAnalytics.outputs.logAnalyticsWorkspaceName
476-
}
477-
scope: resourceGroup(resourceGroup().name)
478-
}
479-
480-
481474
// ========== Container App Environment ========== //
482475
module avmContainerAppEnv 'br/public:avm/res/app/managed-environment:0.11.1' = {
483476
name: format(deployment_param.resource_name_format_string, abbrs.containers.containerAppsEnvironment)
@@ -492,7 +485,7 @@ module avmContainerAppEnv 'br/public:avm/res/app/managed-environment:0.11.1' = {
492485
appLogsConfiguration: {
493486
destination: 'log-analytics'
494487
logAnalyticsConfiguration: {
495-
customerId: avmAppInsightsAndLogAnalytics.outputs.logAnalyticsWorkspaceId
488+
customerId: avmLogAnalyticsWorkspace.outputs.logAnalyticsWorkspaceId
496489
sharedKey: avmLogAnalyticsWorkspace.outputs.primarySharedKey
497490
}
498491
}

infra/scripts/validate_model_deployment_quotas.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ if [[ ${#MISSING_PARAMS[@]} -ne 0 ]]; then
4646
exit 1
4747
fi
4848

49-
aiModelDeployments=$(jq -c ".aiModelDeployments.value[]" ./infra/ai-resources.json)
49+
aiModelDeployments=$(jq -c ".aiModelDeployments[]" ./infra/ai-resources.json)
5050

5151
if [ $? -ne 0 ]; then
5252
echo "Error: Failed to parse ai-resources.json. Ensure jq is installed and the JSON file is valid."
@@ -65,7 +65,7 @@ while IFS= read -r deployment; do
6565
capacity=$(echo "$deployment" | jq -r '.sku.capacity')
6666

6767
echo "🔍 Validating model deployment: $name ..."
68-
./scripts/validate_model_quota.sh --location "$LOCATION" --model "$model" --capacity $capacity --deployment-type $type
68+
./infra/scripts/validate_model_quota.sh --location "$LOCATION" --model "$model" --capacity $capacity --deployment-type $type
6969

7070
# Check if the script failed
7171
if [ $? -ne 0 ]; then

0 commit comments

Comments
 (0)