fix: Deployment Failure in pipeline for Bicep issue#618
Closed
Ashwal-Microsoft wants to merge 14 commits into
Closed
fix: Deployment Failure in pipeline for Bicep issue#618Ashwal-Microsoft wants to merge 14 commits into
Ashwal-Microsoft wants to merge 14 commits into
Conversation
… dependsOn to cognitive service private endpoint
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the deployment workflows and infrastructure templates to use the actual available GPT model quota capacity from checkquota.sh (instead of a fixed value), while tightening allowed region selection and improving provisioning order for AI Services private endpoints.
Changes:
- Enhanced
checkquota.shto filter regions to an allowed list and export bothVALID_REGIONandAVAILABLE_CAPACITYfor downstream workflow steps. - Propagated
AZURE_ENV_GPT_MODEL_CAPACITYthrough the main deploy job and into the Linux/Windows reusable workflows, with a default/fallback of100. - Updated Bicep defaults and configuration: added
swedencentralto allowed AI Services regions, reduced default GPT capacity to100, and introduced an explicitdependsOnfor the AI Services private endpoint module.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| infra/scripts/checkquota.sh | Filters candidate regions to an allowed set and exports selected region + available capacity for workflows. |
| infra/main.bicep | Updates allowed AI Services region list, lowers default GPT capacity, and adjusts module dependency ordering for private endpoints. |
| .github/workflows/job-deploy.yml | Passes discovered capacity through job outputs/env to downstream reusable workflows. |
| .github/workflows/job-deploy-windows.yml | Accepts/persists capacity into azd environment for Windows deployments with fallback. |
| .github/workflows/job-deploy-linux.yml | Accepts/persists capacity into azd environment for Linux deployments with fallback. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Coverage Report •
|
||||||||||||||||||||||||||||||
53a8d0c to
7f225de
Compare
| echo " Checking account: $CU_ACCOUNT_NAME in resource group: $RESOURCE_GROUP" | ||
|
|
||
| # Check if the resource group exists first | ||
| if ! az group exists -n "$RESOURCE_GROUP" --output none 2>/dev/null; then |
Comment on lines
+255
to
+256
| # Use available quota capacity discovered by checkquota.sh; fall back to 100 if not set | ||
| azd env set AZURE_ENV_GPT_MODEL_CAPACITY="${AZURE_ENV_GPT_MODEL_CAPACITY:-100}" |
Comment on lines
+252
to
+254
| # Use available quota capacity discovered by checkquota.sh; fall back to 100 if not set | ||
| $gptCapacity = if ($env:AZURE_ENV_GPT_MODEL_CAPACITY) { $env:AZURE_ENV_GPT_MODEL_CAPACITY } else { "100" } | ||
| azd env set AZURE_ENV_GPT_MODEL_CAPACITY="$gptCapacity" |
Comment on lines
44
to
46
| 'southeastasia' | ||
| 'swedencentral' | ||
| 'uksouth' |
…ll configuration files
Comment on lines
+255
to
+256
| # Check if the resource group exists first | ||
| if ! az group exists -n "$RESOURCE_GROUP" --output none 2>/dev/null; then |
Comment on lines
364
to
+368
| 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 |
| env: | ||
| AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
| GPT_MIN_CAPACITY: "100" | ||
| GPT_MIN_CAPACITY: "300" |
Comment on lines
42
to
47
| 'japaneast' | ||
| 'northeurope' | ||
| 'southeastasia' | ||
| 'swedencentral' | ||
| 'uksouth' | ||
| ]) |
Comment on lines
+37
to
+40
| AZURE_ENV_GPT_MODEL_CAPACITY: | ||
| required: false | ||
| type: string | ||
| default: "300" |
| 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
+255
to
+256
| # 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
+37
to
+40
| AZURE_ENV_GPT_MODEL_CAPACITY: | ||
| required: false | ||
| type: string | ||
| default: "300" |
| 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
+252
to
+254
| # 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
111
to
115
| if [ -z "$VALID_REGION" ]; then | ||
| echo "❌ No region with sufficient quota found. Blocking deployment." | ||
| echo "QUOTA_FAILED=true" >> "$GITHUB_ENV" | ||
| exit 0 | ||
| exit 1 | ||
| else |
Comment on lines
47
to
50
| env: | ||
| AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
| GPT_MIN_CAPACITY: "100" | ||
| GPT_MIN_CAPACITY: "300" | ||
| AZURE_REGIONS: ${{ vars.AZURE_REGIONS }} |
Comment on lines
362
to
+368
| 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
+255
to
+256
| # 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
+252
to
+254
| # 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
+175
to
+195
| UPLOAD_FILE="$SCHEMA_FILE" | ||
| UPLOAD_FILENAME="$FILE_NAME" | ||
| UPLOAD_CONTENT_TYPE="application/json" | ||
| IS_GENERATED_JSON=false | ||
|
|
||
| if [[ "${SCHEMA_FILE,,}" == *.py ]]; then | ||
| if [ -z "$PYTHON_BIN" ]; then | ||
| echo " Error: Python is required to convert '$FILE_NAME' to JSON schema. Skipping..." | ||
| continue | ||
| fi | ||
|
|
||
| GENERATED_JSON_FILE="$DATA_SCRIPT_PATH/${CLASS_NAME}.json" | ||
| if generate_json_schema_from_python "$SCHEMA_FILE" "$CLASS_NAME" "$GENERATED_JSON_FILE"; then | ||
| UPLOAD_FILE="$GENERATED_JSON_FILE" | ||
| UPLOAD_FILENAME="${FILE_NAME%.py}.json" | ||
| IS_GENERATED_JSON=true | ||
| else | ||
| echo " Error: Failed to generate JSON schema from '$FILE_NAME'. Skipping..." | ||
| continue | ||
| fi | ||
| fi |
Comment on lines
+169
to
+190
| $UploadFile = $SchemaFile | ||
| $UploadFileName = [System.IO.Path]::GetFileName($SchemaFile) | ||
| $UploadContentType = "application/json" | ||
| $IsGeneratedJson = $false | ||
|
|
||
| if ([System.IO.Path]::GetExtension($SchemaFile).ToLowerInvariant() -eq ".py") { | ||
| if (-not $PythonBin) { | ||
| Write-Host " Error: Python is required to convert '$UploadFileName' to JSON schema. Skipping..." | ||
| continue | ||
| } | ||
|
|
||
| $GeneratedJsonPath = Join-Path $FullPath ("{0}.json" -f $ClassName) | ||
| try { | ||
| Convert-PythonSchemaToJson -PythonFile $SchemaFile -ClassName $ClassName -OutputFile $GeneratedJsonPath -PythonCmd $PythonBin | ||
| $UploadFile = $GeneratedJsonPath | ||
| $UploadFileName = [System.IO.Path]::GetFileNameWithoutExtension($SchemaFile) + ".json" | ||
| $IsGeneratedJson = $true | ||
| } catch { | ||
| Write-Host " Error: $_" | ||
| continue | ||
| } | ||
| } |
Comment on lines
+831
to
+835
| dependsOn: [ | ||
| avmAiServices | ||
| virtualNetwork | ||
| avmPrivateDnsZones | ||
| ] |
Comment on lines
+45
to
47
| 'swedencentral' | ||
| 'uksouth' | ||
| ]) |
Comment on lines
+149
to
153
| if [ "$SCHEMA_COUNT" -eq 0 ]; then | ||
| echo "No schemas found in manifest. Skipping schema registration." | ||
| fi | ||
|
|
||
| for idx in $(seq 0 $((SCHEMA_COUNT - 1))); do |
Comment on lines
+191
to
+206
| if [[ "${SCHEMA_FILE,,}" == *.py ]]; then | ||
| if [ -z "$PYTHON_BIN" ]; then | ||
| echo " Error: Python is required to convert '$FILE_NAME' to JSON schema. Skipping..." | ||
| continue | ||
| fi | ||
|
|
||
| GENERATED_JSON_FILE="$DATA_SCRIPT_PATH/${CLASS_NAME}.json" | ||
| if generate_json_schema_from_python "$SCHEMA_FILE" "$CLASS_NAME" "$GENERATED_JSON_FILE"; then | ||
| UPLOAD_FILE="$GENERATED_JSON_FILE" | ||
| UPLOAD_FILENAME="${FILE_NAME%.py}.json" | ||
| IS_GENERATED_JSON=true | ||
| else | ||
| echo " Error: Failed to generate JSON schema from '$FILE_NAME'. Skipping..." | ||
| continue | ||
| fi | ||
| fi |
Comment on lines
+185
to
+201
| if ([System.IO.Path]::GetExtension($SchemaFile).ToLowerInvariant() -eq ".py") { | ||
| if (-not $PythonBin) { | ||
| Write-Host " Error: Python is required to convert '$UploadFileName' to JSON schema. Skipping..." | ||
| continue | ||
| } | ||
|
|
||
| $GeneratedJsonPath = Join-Path $FullPath ("{0}.json" -f $ClassName) | ||
| try { | ||
| Convert-PythonSchemaToJson -PythonFile $SchemaFile -ClassName $ClassName -OutputFile $GeneratedJsonPath -PythonCmd $PythonBin | ||
| $UploadFile = $GeneratedJsonPath | ||
| $UploadFileName = [System.IO.Path]::GetFileNameWithoutExtension($SchemaFile) + ".json" | ||
| $IsGeneratedJson = $true | ||
| } catch { | ||
| Write-Host " Error: $_" | ||
| continue | ||
| } | ||
| } |
| echo "❌ No region with sufficient quota found. Blocking deployment." | ||
| echo "QUOTA_FAILED=true" >> "$GITHUB_ENV" | ||
| exit 0 | ||
| exit 1 |
Comment on lines
42
to
46
| 'japaneast' | ||
| 'northeurope' | ||
| 'southeastasia' | ||
| 'swedencentral' | ||
| 'uksouth' |
| 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
+255
to
+256
| # 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
+37
to
+40
| AZURE_ENV_GPT_MODEL_CAPACITY: | ||
| required: false | ||
| type: string | ||
| default: "300" |
| 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
+252
to
+254
| # 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" |
| echo "❌ No region with sufficient quota found. Blocking deployment." | ||
| echo "QUOTA_FAILED=true" >> "$GITHUB_ENV" | ||
| exit 0 | ||
| exit 1 |
Comment on lines
+97
to
+103
| # Install pydantic before using it | ||
| if [ ${#PYTHON_CMD[@]} -gt 0 ]; then | ||
| echo " ⏳ Installing pydantic..." | ||
| "${PYTHON_CMD[@]}" -m pip install pydantic --quiet 2>/dev/null | ||
| else | ||
| echo " ⚠️ No usable Python runtime found. Skipping .py schema conversion." | ||
| fi |
Comment on lines
+119
to
+125
| # Install pydantic before using it | ||
| if ($PythonBin) { | ||
| Write-Host " [Info] Installing pydantic..." | ||
| & $PythonBin @PythonArgs -m pip install pydantic --quiet 2>$null | ||
| } else { | ||
| Write-Host " [Warning] No usable Python runtime found. Skipping .py schema conversion." | ||
| } |
Comment on lines
+255
to
+256
| # 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
+252
to
+254
| # 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" |
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
infra/scripts/post_deployment.sh:258
az group existsreturns a boolean string ("true"/"false") and typically exits with status 0 even when the resource group does not exist. Using it inif ! az group exists ...; thenwill not reliably detect a missing resource group, so the script may attempt account operations against a non-existent RG on fresh deployments.
echo "Step 2: Create schema set"
echo "============================================================"
# Parse schemaset config from manifest
Comment on lines
+255
to
+256
| # 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
+252
to
+254
| # 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
111
to
+114
| 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
+3
to
+5
| # 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
364
to
+368
| 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
45
to
+49
| - name: Run Quota Check | ||
| id: quota-check | ||
| env: | ||
| AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
| GPT_MIN_CAPACITY: "100" | ||
| GPT_MIN_CAPACITY: "300" |
Comment on lines
50
to
+52
| 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
| 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
+95
to
+99
| # Install pydantic before using it | ||
| if [ -n "$PYTHON_BIN" ]; then | ||
| echo " ⏳ Installing pydantic..." | ||
| $PYTHON_BIN -m pip install pydantic --quiet 2>/dev/null | ||
| fi |
Comment on lines
+94
to
+98
| # Install pydantic before using it | ||
| if ($PythonBin) { | ||
| Write-Host " [Info] Installing pydantic..." | ||
| & $PythonBin -m pip install pydantic --quiet 2>$null | ||
| } |
Comment on lines
+833
to
+837
| dependsOn: [ | ||
| avmAiServices | ||
| virtualNetwork | ||
| avmPrivateDnsZones | ||
| ] |
Author
|
Worked on changes with Ash17-Bicep17-check17 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request improves the Azure deployment workflow by ensuring that the GPT model capacity used for deployments accurately reflects the available quota in the selected region, rather than using a fixed default. It also tightens region validation for AI Services deployments, updates default capacity values, and ensures proper dependency ordering in infrastructure provisioning.
Deployment workflow improvements:
The actual available GPT model capacity (as determined by
checkquota.sh) is now passed through all deployment jobs and set as an environment variable (AZURE_ENV_GPT_MODEL_CAPACITY), ensuring Bicep deployments only request what is available. Fallback to a default of 100 is used if not set. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]The region selection logic in
checkquota.shnow only considers regions explicitly allowed for GPT-5.1 GlobalStandard, and filters the requested regions accordingly, improving reliability and preventing invalid region selection.Infrastructure configuration updates:
The default GPT deployment capacity in
infra/main.bicepis reduced from 300 to 100, and the usage name metadata is updated to match. [1] [2]swedencentralis added as a valid region for AI Services deployments in Bicep.Infrastructure provisioning reliability:
dependsOnto thecognitiveServicePrivateEndpointmodule in Bicep to ensure resources are provisioned in the correct order.Quota checking enhancements:
checkquota.shnow outputs both the selected region and its available capacity, and exports both as environment variables for downstream workflow steps. [1] [2]## PurposeDoes this introduce a breaking change?
Golden Path Validation
Deployment Validation
What to Check
Verify that the following are valid
Other Information