Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
id: quota-check
env:
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
GPT_MIN_CAPACITY: "100"
GPT_MIN_CAPACITY: "300"
AZURE_REGIONS: ${{ vars.AZURE_REGIONS }}
Comment on lines 47 to 50
run: |
chmod +x infra/scripts/checkquota.sh
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/job-deploy-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ on:
AZURE_EXISTING_AI_PROJECT_RESOURCE_ID:
required: false
type: string
AZURE_ENV_GPT_MODEL_CAPACITY:
required: false
type: string
default: "300"
Comment on lines +37 to +40
Comment on lines +37 to +40
outputs:
CONTAINER_WEB_APPURL:
description: "Container Web App URL"
Expand All @@ -45,6 +49,7 @@ jobs:
environment: production
env:
AZURE_DEV_COLLECT_TELEMETRY: ${{ vars.AZURE_DEV_COLLECT_TELEMETRY }}
AZURE_ENV_GPT_MODEL_CAPACITY: ${{ inputs.AZURE_ENV_GPT_MODEL_CAPACITY || '300' }}
Comment on lines 50 to +52
outputs:
CONTAINER_WEB_APPURL: ${{ steps.get_output_linux.outputs.CONTAINER_WEB_APPURL }}
steps:
Expand Down Expand Up @@ -247,6 +252,8 @@ jobs:
azd env set AZURE_LOCATION="$AZURE_LOCATION"
azd env set AZURE_RESOURCE_GROUP="$RESOURCE_GROUP_NAME"
azd env set AZURE_ENV_IMAGETAG="$IMAGE_TAG"
# Use available quota capacity discovered by checkquota.sh; fall back to 300 if not set
azd env set AZURE_ENV_GPT_MODEL_CAPACITY="${AZURE_ENV_GPT_MODEL_CAPACITY:-300}"
Comment on lines +255 to +256
Comment on lines +255 to +256
Comment on lines +255 to +256
Comment on lines +255 to +256
Comment on lines +255 to +256

if [[ "$BUILD_DOCKER_IMAGE" == "true" ]]; then
ACR_NAME=$(echo "${{ secrets.ACR_TEST_LOGIN_SERVER }}")
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/job-deploy-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ on:
AZURE_EXISTING_AI_PROJECT_RESOURCE_ID:
required: false
type: string
AZURE_ENV_GPT_MODEL_CAPACITY:
required: false
type: string
default: "300"
Comment on lines +37 to +40
Comment on lines +37 to +40
outputs:
CONTAINER_WEB_APPURL:
description: "Container Web App URL"
Expand All @@ -45,6 +49,7 @@ jobs:
environment: production
env:
AZURE_DEV_COLLECT_TELEMETRY: ${{ vars.AZURE_DEV_COLLECT_TELEMETRY }}
AZURE_ENV_GPT_MODEL_CAPACITY: ${{ inputs.AZURE_ENV_GPT_MODEL_CAPACITY || '300' }}
Comment on lines 50 to +52
outputs:
CONTAINER_WEB_APPURL: ${{ steps.get_output_windows.outputs.CONTAINER_WEB_APPURL }}
steps:
Expand Down Expand Up @@ -244,6 +249,9 @@ jobs:
azd env set AZURE_LOCATION="$env:AZURE_LOCATION"
azd env set AZURE_RESOURCE_GROUP="$env:RESOURCE_GROUP_NAME"
azd env set AZURE_ENV_IMAGETAG="$env:IMAGE_TAG"
# Use available quota capacity discovered by checkquota.sh; fall back to 300 if not set
$gptCapacity = if ($env:AZURE_ENV_GPT_MODEL_CAPACITY) { $env:AZURE_ENV_GPT_MODEL_CAPACITY } else { "300" }
azd env set AZURE_ENV_GPT_MODEL_CAPACITY="$gptCapacity"
Comment on lines +252 to +254
Comment on lines +252 to +254
Comment on lines +252 to +254
Comment on lines +252 to +254
Comment on lines +252 to +254

# Set ACR name only when building Docker image
if ($env:BUILD_DOCKER_IMAGE -eq "true") {
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/job-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ jobs:
ENV_NAME: ${{ steps.generate_env_name.outputs.ENV_NAME }}
AZURE_LOCATION: ${{ steps.set_region.outputs.AZURE_LOCATION }}
AZURE_ENV_OPENAI_LOCATION: ${{ steps.set_region.outputs.AZURE_ENV_OPENAI_LOCATION }}
AZURE_ENV_GPT_MODEL_CAPACITY: ${{ steps.set_region.outputs.AZURE_ENV_GPT_MODEL_CAPACITY }}
IMAGE_TAG: ${{ steps.determine_image_tag.outputs.IMAGE_TAG }}
QUOTA_FAILED: ${{ steps.quota_failure_output.outputs.QUOTA_FAILED }}
EXP_ENABLED: ${{ steps.configure_exp.outputs.EXP_ENABLED }}
Expand Down Expand Up @@ -359,8 +360,12 @@ jobs:
INPUT_AZURE_LOCATION: ${{ inputs.azure_location }}
run: |
echo "Selected Region from Quota Check: $VALID_REGION"
echo "Available Capacity in $VALID_REGION: $AVAILABLE_CAPACITY"
echo "AZURE_ENV_OPENAI_LOCATION=$VALID_REGION" >> $GITHUB_ENV
echo "AZURE_ENV_OPENAI_LOCATION=$VALID_REGION" >> $GITHUB_OUTPUT
# Pass the actual available capacity so Bicep deploys only what is free
echo "AZURE_ENV_GPT_MODEL_CAPACITY=$AVAILABLE_CAPACITY" >> $GITHUB_ENV
echo "AZURE_ENV_GPT_MODEL_CAPACITY=$AVAILABLE_CAPACITY" >> $GITHUB_OUTPUT
Comment on lines 362 to +368
Comment on lines 364 to +368
Comment on lines 362 to +368
Comment on lines 364 to +368

if [[ "$INPUT_TRIGGER_TYPE" == "workflow_dispatch" && -n "$INPUT_AZURE_LOCATION" ]]; then
USER_SELECTED_LOCATION="$INPUT_AZURE_LOCATION"
Expand Down Expand Up @@ -533,6 +538,7 @@ jobs:
AZURE_LOCATION: ${{ needs.azure-setup.outputs.AZURE_LOCATION }}
RESOURCE_GROUP_NAME: ${{ needs.azure-setup.outputs.RESOURCE_GROUP_NAME }}
IMAGE_TAG: ${{ needs.azure-setup.outputs.IMAGE_TAG }}
AZURE_ENV_GPT_MODEL_CAPACITY: ${{ needs.azure-setup.outputs.AZURE_ENV_GPT_MODEL_CAPACITY }}
BUILD_DOCKER_IMAGE: ${{ inputs.build_docker_image || 'false' }}
EXP: ${{ needs.azure-setup.outputs.EXP_ENABLED }}
WAF_ENABLED: ${{ inputs.waf_enabled == true && 'true' || 'false' }}
Expand All @@ -551,6 +557,7 @@ jobs:
AZURE_LOCATION: ${{ needs.azure-setup.outputs.AZURE_LOCATION }}
RESOURCE_GROUP_NAME: ${{ needs.azure-setup.outputs.RESOURCE_GROUP_NAME }}
IMAGE_TAG: ${{ needs.azure-setup.outputs.IMAGE_TAG }}
AZURE_ENV_GPT_MODEL_CAPACITY: ${{ needs.azure-setup.outputs.AZURE_ENV_GPT_MODEL_CAPACITY }}
BUILD_DOCKER_IMAGE: ${{ inputs.build_docker_image || 'false' }}
EXP: ${{ needs.azure-setup.outputs.EXP_ENABLED }}
WAF_ENABLED: ${{ inputs.waf_enabled == true && 'true' || 'false' }}
Expand Down
6 changes: 6 additions & 0 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ param contentUnderstandingLocation string = 'WestUS'
'japaneast'
'northeurope'
'southeastasia'
'swedencentral'
'uksouth'
Comment on lines 44 to 46
Comment on lines 42 to 46
])
Comment on lines 42 to 47
Comment on lines +45 to 47
@description('Required. Location for the Azure AI Services deployment.')
Comment on lines 42 to 48
Expand Down Expand Up @@ -827,6 +828,11 @@ module cognitiveServicePrivateEndpoint 'br/public:avm/res/network/private-endpoi
}
subnetResourceId: virtualNetwork!.outputs.backendSubnetResourceId
}
dependsOn: [
avmAiServices
virtualNetwork
avmPrivateDnsZones
]
Comment thread
Copilot marked this conversation as resolved.
Comment on lines +831 to +835
}

module avmAiServices_cu 'br/public:avm/res/cognitive-services/account:0.14.1' = {
Expand Down
17 changes: 11 additions & 6 deletions infra/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"_generator": {
"name": "bicep",
"version": "0.41.2.15936",
"templateHash": "5358772599129171911"
"templateHash": "2597731928932727268"
},
"name": "Content Processing Solution Accelerator",
"description": "Bicep template to deploy the Content Processing Solution Accelerator with AVM compliance."
Expand Down Expand Up @@ -66,6 +66,7 @@
"japaneast",
"northeurope",
"southeastasia",
"swedencentral",
"uksouth"
],
"metadata": {
Expand Down Expand Up @@ -35187,8 +35188,8 @@
"avmContainerApp_API",
"avmContainerApp_Workflow",
"avmManagedIdentity",
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').storageQueue)]",
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').storageBlob)]",
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').storageQueue)]",
"virtualNetwork"
]
},
Expand Down Expand Up @@ -41721,10 +41722,7 @@
},
"dependsOn": [
"avmAiServices",
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').contentUnderstanding)]",
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').cognitiveServices)]",
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').aiServices)]",
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').openAI)]",
"avmPrivateDnsZones",
"virtualNetwork"
]
},
Expand Down Expand Up @@ -68558,6 +68556,13 @@
},
"value": "[reference('avmContainerRegistry').outputs.loginServer.value]"
},
"CONTENT_UNDERSTANDING_ACCOUNT_NAME": {
"type": "string",
"metadata": {
"description": "The name of the Content Understanding AI Services account."
},
"value": "[reference('avmAiServices_cu').outputs.name.value]"
},
"AZURE_RESOURCE_GROUP": {
"type": "string",
"metadata": {
Expand Down
5 changes: 5 additions & 0 deletions infra/main_custom.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,11 @@ module cognitiveServicePrivateEndpoint 'br/public:avm/res/network/private-endpoi
}
subnetResourceId: virtualNetwork!.outputs.backendSubnetResourceId
}
dependsOn: [
avmAiServices
virtualNetwork
avmPrivateDnsZones
]
Comment on lines +833 to +837
}

module avmAiServices_cu 'br/public:avm/res/cognitive-services/account:0.14.1' = {
Expand Down
34 changes: 31 additions & 3 deletions infra/scripts/checkquota.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,32 @@
#!/bin/bash

# List of Azure regions to check for quota (update as needed)
IFS=', ' read -ra REGIONS <<< "$AZURE_REGIONS"
# List of valid Azure regions for AI Services (must match Bicep @allowed values)
# These are the only regions where GPT-5.1 GlobalStandard is available
ALLOWED_REGIONS=("australiaeast" "centralus" "eastasia" "eastus2" "japaneast" "northeurope" "southeastasia" "swedencentral" "uksouth")
Comment on lines +3 to +5

# Get requested regions from environment variable, default to all allowed regions
# Supports comma-separated or space-separated (or mixed) AZURE_REGIONS values.
if [[ -n "$AZURE_REGIONS" ]]; then
IFS=', ' read -ra REQUESTED_REGIONS <<< "$AZURE_REGIONS"
# Filter requested regions to only include those in ALLOWED_REGIONS
REGIONS=()
for req_region in "${REQUESTED_REGIONS[@]}"; do
req_region=$(echo "$req_region" | xargs) # trim whitespace
[[ -z "$req_region" ]] && continue # skip empty tokens from double-delimiters
for allowed in "${ALLOWED_REGIONS[@]}"; do
if [[ "$req_region" == "$allowed" ]]; then
REGIONS+=("$req_region")
break
fi
done
done
if [[ ${#REGIONS[@]} -eq 0 ]]; then
echo "⚠️ WARNING: No valid regions found in AZURE_REGIONS. Using all allowed regions."
REGIONS=("${ALLOWED_REGIONS[@]}")
fi
else
REGIONS=("${ALLOWED_REGIONS[@]}")
fi

SUBSCRIPTION_ID="${AZURE_SUBSCRIPTION_ID}"
GPT_MIN_CAPACITY="${GPT_MIN_CAPACITY}"
Expand Down Expand Up @@ -77,6 +102,7 @@ for REGION in "${REGIONS[@]}"; do

if [ "$INSUFFICIENT_QUOTA" = false ]; then
VALID_REGION="$REGION"
VALID_REGION_AVAILABLE_CAPACITY=$AVAILABLE
break
fi

Expand All @@ -85,9 +111,11 @@ done
if [ -z "$VALID_REGION" ]; then
echo "❌ No region with sufficient quota found. Blocking deployment."
echo "QUOTA_FAILED=true" >> "$GITHUB_ENV"
exit 0
exit 1
Comment on lines 111 to +114
else
echo "✅ Suggested Region: $VALID_REGION"
echo "✅ Available Capacity: $VALID_REGION_AVAILABLE_CAPACITY"
echo "VALID_REGION=$VALID_REGION" >> "$GITHUB_ENV"
echo "AVAILABLE_CAPACITY=$VALID_REGION_AVAILABLE_CAPACITY" >> "$GITHUB_ENV"
exit 0
fi
Loading