Skip to content

feat: add AI model quota preflight validation check#7672

Merged
rajeshkamal5050 merged 11 commits intomainfrom
preflight-quota
Apr 14, 2026
Merged

feat: add AI model quota preflight validation check#7672
rajeshkamal5050 merged 11 commits intomainfrom
preflight-quota

Conversation

@vhvb1989
Copy link
Copy Markdown
Member

@vhvb1989 vhvb1989 commented Apr 13, 2026

Summary

Add a new local-preflight check (ai_model_quota) that detects Azure Cognitive Services model deployments in the Bicep snapshot and validates quota availability before provisioning — catching quota issues early instead of failing at deploy time.

What it does

  • Detects Microsoft.CognitiveServices/accounts/deployments resources in the Bicep snapshot
  • Resolves the usage name from the Azure AI model catalog (not constructed from template data)
  • Queries the GetAiUsages API to compare requested capacity vs remaining quota
  • Aggregates capacity by usage name so multiple deployments sharing the same quota pool are checked against combined demand
  • Warns when:
    • A deployment would exceed available quota (ai_model_quota_exceeded)
    • A model name/version/SKU is not found in the catalog (ai_model_not_found)
  • Resolves location via multiple fallbacks: snapshot → resource group lookup → AZURE_LOCATION

Framework improvements

  • PreflightCheckFn now returns []PreflightCheckResult (supports multiple findings per check)
  • Added ResourceService.GetResourceGroup() for looking up RG location when resource locations are not resolved in the snapshot
  • For RG-scoped deployments, the quota check resolves location from the actual resource group (via Azure API) rather than relying on AZURE_LOCATION, which may not match the selected resource group's region

Test coverage

  • Unit tests: Resource extraction, usage name resolution, edge cases
  • Functional tests (6 test cases with recordings):
    • RG + Subscription scoped deployments
    • Excessive capacity → quota warning
    • Invalid model name → not-found warning
    • Invalid version → not-found warning
    • Different deployment location override

Limitations / Follow-up

  • This PR focuses on detection and warnings only. Guiding users to alternative models/regions is follow-up work.
  • The check runs alongside the existing role assignment check in the preflight pipeline.

Fixes #5432

Add a new local-preflight check (ai_model_quota) that detects
Microsoft.CognitiveServices/accounts/deployments resources in the
Bicep snapshot and validates quota availability before provisioning.

The check:
- Extracts model name, SKU, capacity, and location from deployment
  resources in the Bicep snapshot
- Resolves usage names from the Azure AI model catalog (not constructed)
- Queries GetAiUsages API to compare requested capacity vs remaining quota
- Returns warnings for deployments exceeding quota or using invalid
  model names/versions not found in the catalog
- Falls back to AZURE_LOCATION or resource group location when the
  snapshot doesn't resolve resourceGroup().location

Framework improvements:
- PreflightCheckFn now returns []PreflightCheckResult (multiple findings)
- Snapshot for RG deployments now receives --location from AZURE_LOCATION
- Added ResourceService.GetResourceGroup() for RG location lookup

Fixes #5432

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an ai_model_quota local preflight check to detect Cognitive Services model deployments in the Bicep snapshot and warn when quota would be exceeded (or when the model/SKU/version cannot be resolved from the catalog), plus supporting framework changes and tests.

Changes:

  • Extend the local preflight framework to allow checks to return multiple findings and improve snapshot location resolution for RG-scoped deployments.
  • Add AI model deployment extraction from the snapshot and a quota/catalog validation check in the Bicep provider.
  • Add unit + functional tests and new Bicep samples to exercise RG/subscription scoped scenarios and edge cases.

Reviewed changes

Copilot reviewed 15 out of 21 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
cli/azd/pkg/infra/provisioning/bicep/local_preflight.go Updates preflight check contract to return multiple results; adds cognitive deployment extraction and passes env-based location into snapshot opts for RG scope.
cli/azd/pkg/infra/provisioning/bicep/bicep_provider.go Wires the new ai_model_quota check into preflight and implements quota/catalog validation + RG location fallback.
cli/azd/pkg/azapi/resource_service.go Adds ResourceService.GetResourceGroup() to support RG location lookup fallback.
cli/azd/pkg/infra/provisioning/bicep/ai_model_quota_check_test.go Adds unit tests for snapshot resource extraction and usage-name resolution logic.
cli/azd/pkg/infra/provisioning/bicep/local_preflight_test.go Updates existing tests to the new “multiple results” check signature.
cli/azd/pkg/infra/provisioning/bicep/role_assignment_check_test.go Updates role assignment preflight check tests to the new check signature and result shape.
cli/azd/test/functional/preflight_quota_test.go Adds functional tests (with recordings) to validate warnings and location handling across scopes.
cli/azd/test/functional/testdata/samples/ai-quota/README.md Documents the new functional test samples and their parameter/env-var mappings.
cli/azd/test/functional/testdata/samples/ai-quota/rg-deployment/azure.yaml Adds RG-scoped sample project definition for functional tests.
cli/azd/test/functional/testdata/samples/ai-quota/rg-deployment/infra/main.bicep Adds RG-scoped Bicep template that deploys an AI Services account + model deployments.
cli/azd/test/functional/testdata/samples/ai-quota/rg-deployment/infra/main.parameters.json Adds parameter file mapping env vars into the RG-scoped sample template.
cli/azd/test/functional/testdata/samples/ai-quota/sub-deployment/azure.yaml Adds subscription-scoped sample project definition for functional tests.
cli/azd/test/functional/testdata/samples/ai-quota/sub-deployment/infra/main.bicep Adds subscription-scoped template that creates an RG and deploys AI resources via a module.
cli/azd/test/functional/testdata/samples/ai-quota/sub-deployment/infra/ai-resources.bicep Adds module that defines the AI Services account and model deployments.
cli/azd/test/functional/testdata/samples/ai-quota/sub-deployment/infra/main.parameters.json Adds parameter file mapping env vars into the subscription-scoped sample template.

- Initialize results to non-nil empty slice to distinguish 'no findings'
  from 'checks skipped' in telemetry
- Aggregate capacity by usage name so multiple deployments sharing the
  same quota pool are checked against combined demand
- Use effective capacity (not raw dep.Capacity) in warning messages
- Use t.Context() instead of context.Background() in tests
- Use %q and include subscription ID in GetResourceGroup error message

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 21 changed files in this pull request and generated 3 comments.

- Treat missing usage API entries as 0 remaining quota instead of
  silently skipping validation
- Match on ModelFormat in resolveUsageName to avoid cross-format
  name collisions in the model catalog
- Fix test comment to accurately describe exit behavior

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 21 changed files in this pull request and generated 3 comments.

- Break long lines in bicep_provider.go and test file to satisfy
  the 125-char lll linter rule

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 21 changed files in this pull request and generated 4 comments.

- Remove snapshot --location override for RG deployments to avoid
  resolving resourceGroup().location incorrectly when the selected
  RG is in a different region than AZURE_LOCATION
- Prefer RG location lookup over AZURE_LOCATION in fallback order
- Sort locations for deterministic warning output order
- Handle missing SKU/version gracefully in ai_model_not_found warning

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 21 changed files in this pull request and generated 3 comments.

- Remove unused envLocation field from localArmPreflight struct
- Update README table to match actual functional test coverage

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 21 changed files in this pull request and generated 1 comment.

…ings

The Bicep snapshot for RG-scoped deployments needs --location to
resolve resourceGroup().location. Without it, the snapshot fails
or produces unresolved expressions, causing the preflight check
to be silently skipped.

The location is resolved from the actual resource group (if it
already exists) or AZURE_LOCATION (for new resource groups).

Also adds explicit 'azd env set AZURE_LOCATION' in RG functional
tests to ensure the location is in the azd environment.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vhvb1989 vhvb1989 marked this pull request as ready for review April 13, 2026 18:12
Copy link
Copy Markdown
Member

@spboyer spboyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid preflight check with good aggregation logic and thorough test coverage (unit + functional with recordings). All 20 prior copilot-bot threads are properly resolved. Two issues to address:

  • bicep_provider.go:2642 — doc comment on resolveResourceTenantPrincipalId truncated during rebase (3 lines lost)
  • bicep_provider.go:2449 — resolveResourceGroupLocation called twice per preflight run (redundant API call)

Copy link
Copy Markdown
Member

@jongio jongio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Four findings the automated reviewer missed:

  1. The doc comment on resolveResourceTenantPrincipalId got truncated - three middle lines were accidentally deleted, leaving a broken sentence.
  2. launch.json has personal dev config changes (hardcoded path, debug target swap) that shouldn't ship.
  3. resolveResourceGroupLocation is called twice (once in validatePreflight, once in checkAiModelQuota) - each hitting Azure API for the same RG metadata. The resolved location could be passed through validationContext.
  4. resolveResourceGroupLocation resolves ResourceService via serviceLocator even though it's already a direct field on BicepProvider.

Side note: several of the bot's existing comments are factually incorrect - the code already handles aggregation (requiredByUsage map), deterministic iteration (slices.Sorted), and ModelFormat matching (checked when non-empty).

- Restore truncated doc comment on resolveResourceTenantPrincipalId
- Remove duplicate resolveResourceGroupLocation call by passing
  the resolved location through validationContext.EnvLocation
- Use p.resourceService directly instead of p.serviceLocator.Resolve

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vhvb1989 vhvb1989 requested review from Copilot, jongio and spboyer April 13, 2026 19:04
Remove .vscode/.copilot-worktree-launch and revert personal
changes to cli/azd/.vscode/launch.json.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 21 changed files in this pull request and generated 9 comments.

- Use nil-safe convert.ToValueWithDefault for GetResourceGroup
  response fields to prevent potential panics
- Add early return guard in resolveResourceGroupLocation when
  subscriptionId is empty

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Member

@jongio jongio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid work - the author addressed all prior feedback. Implementation follows codebase conventions, quota aggregation logic is correct, and test coverage via functional recordings looks good. A couple non-blocking suggestions below.

- Add log line when deployment is skipped due to unresolved location
- Use case-insensitive comparison for version matching (consistency)
- Add TestResolveUsageName_FormatFiltering unit test for format
  filtering and version case-insensitivity

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@azure-sdk
Copy link
Copy Markdown
Collaborator

Azure Dev CLI Install Instructions

Install scripts

MacOS/Linux

May elevate using sudo on some platforms and configurations

bash:

curl -fsSL https://azuresdkartifacts.z5.web.core.windows.net/azd/standalone/pr/7672/uninstall-azd.sh | bash;
curl -fsSL https://azuresdkartifacts.z5.web.core.windows.net/azd/standalone/pr/7672/install-azd.sh | bash -s -- --base-url https://azuresdkartifacts.z5.web.core.windows.net/azd/standalone/pr/7672 --version '' --verbose --skip-verify

pwsh:

Invoke-RestMethod 'https://azuresdkartifacts.z5.web.core.windows.net/azd/standalone/pr/7672/uninstall-azd.ps1' -OutFile uninstall-azd.ps1; ./uninstall-azd.ps1
Invoke-RestMethod 'https://azuresdkartifacts.z5.web.core.windows.net/azd/standalone/pr/7672/install-azd.ps1' -OutFile install-azd.ps1; ./install-azd.ps1 -BaseUrl 'https://azuresdkartifacts.z5.web.core.windows.net/azd/standalone/pr/7672' -Version '' -SkipVerify -Verbose

Windows

PowerShell install

powershell -c "Set-ExecutionPolicy Bypass Process; irm 'https://azuresdkartifacts.z5.web.core.windows.net/azd/standalone/pr/7672/uninstall-azd.ps1' > uninstall-azd.ps1; ./uninstall-azd.ps1;"
powershell -c "Set-ExecutionPolicy Bypass Process; irm 'https://azuresdkartifacts.z5.web.core.windows.net/azd/standalone/pr/7672/install-azd.ps1' > install-azd.ps1; ./install-azd.ps1 -BaseUrl 'https://azuresdkartifacts.z5.web.core.windows.net/azd/standalone/pr/7672' -Version '' -SkipVerify -Verbose;"

MSI install

powershell -c "irm 'https://azuresdkartifacts.z5.web.core.windows.net/azd/standalone/pr/7672/azd-windows-amd64.msi' -OutFile azd-windows-amd64.msi; msiexec /i azd-windows-amd64.msi /qn"

Standalone Binary

MSI

Documentation

learn.microsoft.com documentation

title: Azure Developer CLI reference
description: This article explains the syntax and parameters for the various Azure Developer CLI commands.
author: alexwolfmsft
ms.author: alexwolf
ms.date: 04/13/2026
ms.service: azure-dev-cli
ms.topic: conceptual
ms.custom: devx-track-azdevcli

Azure Developer CLI reference

This article explains the syntax and parameters for the various Azure Developer CLI commands.

azd

The Azure Developer CLI (azd) is an open-source tool that helps onboard and manage your project on Azure

Options

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
      --docs                 Opens the documentation for azd in your web browser.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
  -h, --help                 Gets help for azd.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

  • azd add: Add a component to your project.
  • azd auth: Authenticate with Azure.
  • azd completion: Generate shell completion scripts.
  • azd config: Manage azd configurations (ex: default Azure subscription, location).
  • azd copilot: Manage GitHub Copilot agent settings. (Preview)
  • azd deploy: Deploy your project code to Azure.
  • azd down: Delete your project's Azure resources.
  • azd env: Manage environments (ex: default environment, environment variables).
  • azd extension: Manage azd extensions.
  • azd hooks: Develop, test and run hooks for a project.
  • azd infra: Manage your Infrastructure as Code (IaC).
  • azd init: Initialize a new application.
  • azd mcp: Manage Model Context Protocol (MCP) server. (Alpha)
  • azd monitor: Monitor a deployed project.
  • azd package: Packages the project's code to be deployed to Azure.
  • azd pipeline: Manage and configure your deployment pipelines.
  • azd provision: Provision Azure resources for your project.
  • azd publish: Publish a service to a container registry.
  • azd restore: Restores the project's dependencies.
  • azd show: Display information about your project and its resources.
  • azd template: Find and view template details.
  • azd up: Provision and deploy your project to Azure with a single command.
  • azd update: Updates azd to the latest version.
  • azd version: Print the version number of Azure Developer CLI.

azd add

Add a component to your project.

azd add [flags]

Options

      --docs   Opens the documentation for azd add in your web browser.
  -h, --help   Gets help for add.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd auth

Authenticate with Azure.

Options

      --docs   Opens the documentation for azd auth in your web browser.
  -h, --help   Gets help for auth.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd auth login

Log in to Azure.

Synopsis

Log in to Azure.

When run without any arguments, log in interactively using a browser. To log in using a device code, pass
--use-device-code.

To log in as a service principal, pass --client-id and --tenant-id as well as one of: --client-secret,
--client-certificate, or --federated-credential-provider.

To log in using a managed identity, pass --managed-identity, which will use the system assigned managed identity.
To use a user assigned managed identity, pass --client-id in addition to --managed-identity with the client id of
the user assigned managed identity you wish to use.

azd auth login [flags]

Options

      --check-status                           Checks the log-in status instead of logging in.
      --client-certificate string              The path to the client certificate for the service principal to authenticate with.
      --client-id string                       The client id for the service principal to authenticate with.
      --client-secret string                   The client secret for the service principal to authenticate with. Set to the empty string to read the value from the console.
      --docs                                   Opens the documentation for azd auth login in your web browser.
      --federated-credential-provider string   The provider to use to acquire a federated token to authenticate with. Supported values: github, azure-pipelines, oidc
  -h, --help                                   Gets help for login.
      --managed-identity                       Use a managed identity to authenticate.
      --redirect-port int                      Choose the port to be used as part of the redirect URI during interactive login.
      --tenant-id string                       The tenant id or domain name to authenticate with.
      --use-device-code[=true]                 When true, log in by using a device code instead of a browser.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd auth logout

Log out of Azure.

Synopsis

Log out of Azure

azd auth logout [flags]

Options

      --docs   Opens the documentation for azd auth logout in your web browser.
  -h, --help   Gets help for logout.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd auth status

Show the current authentication status.

Synopsis

Display whether you are logged in to Azure and the associated account information.

azd auth status [flags]

Options

      --docs   Opens the documentation for azd auth status in your web browser.
  -h, --help   Gets help for status.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd completion

Generate shell completion scripts.

Synopsis

Generate shell completion scripts for azd.

The completion command allows you to generate autocompletion scripts for your shell,
currently supports bash, zsh, fish and PowerShell.

See each sub-command's help for details on how to use the generated script.

Options

      --docs   Opens the documentation for azd completion in your web browser.
  -h, --help   Gets help for completion.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd completion bash

Generate bash completion script.

azd completion bash

Options

      --docs   Opens the documentation for azd completion bash in your web browser.
  -h, --help   Gets help for bash.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd completion fig

Generate Fig autocomplete spec.

azd completion fig

Options

      --docs   Opens the documentation for azd completion fig in your web browser.
  -h, --help   Gets help for fig.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd completion fish

Generate fish completion script.

azd completion fish

Options

      --docs   Opens the documentation for azd completion fish in your web browser.
  -h, --help   Gets help for fish.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd completion powershell

Generate PowerShell completion script.

azd completion powershell

Options

      --docs   Opens the documentation for azd completion powershell in your web browser.
  -h, --help   Gets help for powershell.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd completion zsh

Generate zsh completion script.

azd completion zsh

Options

      --docs   Opens the documentation for azd completion zsh in your web browser.
  -h, --help   Gets help for zsh.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd config

Manage azd configurations (ex: default Azure subscription, location).

Synopsis

Manage the Azure Developer CLI user configuration, which includes your default Azure subscription and location.

Available since azure-dev-cli_0.4.0-beta.1.

The easiest way to configure azd for the first time is to run azd init. The subscription and location you select will be stored in the config.json file located in the config directory. To configure azd anytime afterwards, you'll use azd config set.

The default value of the config directory is:

  • $HOME/.azd on Linux and macOS
  • %USERPROFILE%.azd on Windows

The configuration directory can be overridden by specifying a path in the AZD_CONFIG_DIR environment variable.

Options

      --docs   Opens the documentation for azd config in your web browser.
  -h, --help   Gets help for config.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd config get

Gets a configuration.

Synopsis

Gets a configuration in the configuration path.

The default value of the config directory is:

  • $HOME/.azd on Linux and macOS
  • %USERPROFILE%\.azd on Windows

The configuration directory can be overridden by specifying a path in the AZD_CONFIG_DIR environment variable.

azd config get <path> [flags]

Options

      --docs   Opens the documentation for azd config get in your web browser.
  -h, --help   Gets help for get.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd config list-alpha

Display the list of available features in alpha stage.

azd config list-alpha [flags]

Options

      --docs   Opens the documentation for azd config list-alpha in your web browser.
  -h, --help   Gets help for list-alpha.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd config options

List all available configuration settings.

Synopsis

List all possible configuration settings that can be set with azd, including descriptions and allowed values.

azd config options [flags]

Options

      --docs   Opens the documentation for azd config options in your web browser.
  -h, --help   Gets help for options.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd config reset

Resets configuration to default.

Synopsis

Resets all configuration in the configuration path.

The default value of the config directory is:

  • $HOME/.azd on Linux and macOS
  • %USERPROFILE%\.azd on Windows

The configuration directory can be overridden by specifying a path in the AZD_CONFIG_DIR environment variable to the default.

azd config reset [flags]

Options

      --docs    Opens the documentation for azd config reset in your web browser.
  -f, --force   Force reset without confirmation.
  -h, --help    Gets help for reset.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd config set

Sets a configuration.

Synopsis

Sets a configuration in the configuration path.

The default value of the config directory is:

  • $HOME/.azd on Linux and macOS
  • %USERPROFILE%\.azd on Windows

The configuration directory can be overridden by specifying a path in the AZD_CONFIG_DIR environment variable.

azd config set <path> <value> [flags]

Examples

azd config set defaults.subscription <yourSubscriptionID>
azd config set defaults.location eastus

Options

      --docs   Opens the documentation for azd config set in your web browser.
  -h, --help   Gets help for set.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd config show

Show all the configuration values.

Synopsis

Show all configuration values in the configuration path.

The default value of the config directory is:

  • $HOME/.azd on Linux and macOS
  • %USERPROFILE%\.azd on Windows

The configuration directory can be overridden by specifying a path in the AZD_CONFIG_DIR environment variable.

azd config show [flags]

Options

      --docs   Opens the documentation for azd config show in your web browser.
  -h, --help   Gets help for show.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd config unset

Unsets a configuration.

Synopsis

Removes a configuration in the configuration path.

The default value of the config directory is:

  • $HOME/.azd on Linux and macOS
  • %USERPROFILE%\.azd on Windows

The configuration directory can be overridden by specifying a path in the AZD_CONFIG_DIR environment variable.

azd config unset <path> [flags]

Examples

azd config unset defaults.location

Options

      --docs   Opens the documentation for azd config unset in your web browser.
  -h, --help   Gets help for unset.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd copilot

Manage GitHub Copilot agent settings. (Preview)

Options

      --docs   Opens the documentation for azd copilot in your web browser.
  -h, --help   Gets help for copilot.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd copilot consent

Manage tool consent.

Synopsis

Manage consent rules for tool execution.

Options

      --docs   Opens the documentation for azd copilot consent in your web browser.
  -h, --help   Gets help for consent.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd copilot consent grant

Grant consent trust rules.

Synopsis

Grant trust rules for tools and servers.

This command creates consent rules that allow tools to execute
without prompting for permission. You can specify different permission
levels and scopes for the rules.

Examples:

Grant always permission to all tools globally

azd copilot consent grant --global --permission always

Grant project permission to a specific tool with read-only scope

azd copilot consent grant --server my-server --tool my-tool --permission project --scope read-only

azd copilot consent grant [flags]

Options

      --action string       Action type: 'all' or 'readonly' (default "all")
      --docs                Opens the documentation for azd copilot consent grant in your web browser.
      --global              Apply globally to all servers
  -h, --help                Gets help for grant.
      --operation string    Operation type: 'tool' or 'sampling' (default "tool")
      --permission string   Permission: 'allow', 'deny', or 'prompt' (default "allow")
      --scope string        Rule scope: 'global', or 'project' (default "global")
      --server string       Server name
      --tool string         Specific tool name (requires --server)

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd copilot consent list

List consent rules.

Synopsis

List all consent rules for tools.

azd copilot consent list [flags]

Options

      --action string       Action type to filter by (all, readonly)
      --docs                Opens the documentation for azd copilot consent list in your web browser.
  -h, --help                Gets help for list.
      --operation string    Operation to filter by (tool, sampling)
      --permission string   Permission to filter by (allow, deny, prompt)
      --scope string        Consent scope to filter by (global, project). If not specified, lists rules from all scopes.
      --target string       Specific target to operate on (server/tool format)

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd copilot consent revoke

Revoke consent rules.

Synopsis

Revoke consent rules for tools.

azd copilot consent revoke [flags]

Options

      --action string       Action type to filter by (all, readonly)
      --docs                Opens the documentation for azd copilot consent revoke in your web browser.
  -h, --help                Gets help for revoke.
      --operation string    Operation to filter by (tool, sampling)
      --permission string   Permission to filter by (allow, deny, prompt)
      --scope string        Consent scope to filter by (global, project). If not specified, revokes rules from all scopes.
      --target string       Specific target to operate on (server/tool format)

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd deploy

Deploy your project code to Azure.

azd deploy <service> [flags]

Options

      --all                   Deploys all services that are listed in azure.yaml
      --docs                  Opens the documentation for azd deploy in your web browser.
  -e, --environment string    The name of the environment to use.
      --from-package string   Deploys the packaged service located at the provided path. Supports zipped file packages (file path) or container images (image tag).
  -h, --help                  Gets help for deploy.
      --timeout int           Maximum time in seconds for azd to wait for each service deployment. This stops azd from waiting but does not cancel the Azure-side deployment. (default: 1200) (default 1200)

Options inherited from parent commands

  -C, --cwd string       Sets the current working directory.
      --debug            Enables debugging and diagnostics logging.
      --fail-on-prompt   Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt        Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd down

Delete your project's Azure resources.

azd down [<layer>] [flags]

Options

      --docs                 Opens the documentation for azd down in your web browser.
  -e, --environment string   The name of the environment to use.
      --force                Does not require confirmation before it deletes resources.
  -h, --help                 Gets help for down.
      --purge                Does not require confirmation before it permanently deletes resources that are soft-deleted by default (for example, key vaults).

Options inherited from parent commands

  -C, --cwd string       Sets the current working directory.
      --debug            Enables debugging and diagnostics logging.
      --fail-on-prompt   Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt        Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd env

Manage environments (ex: default environment, environment variables).

Options

      --docs   Opens the documentation for azd env in your web browser.
  -h, --help   Gets help for env.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd env config

Manage environment configuration (ex: stored in .azure//config.json).

Options

      --docs   Opens the documentation for azd env config in your web browser.
  -h, --help   Gets help for config.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd env config get

Gets a configuration value from the environment.

Synopsis

Gets a configuration value from the environment's config.json file.

azd env config get <path> [flags]

Options

      --docs                 Opens the documentation for azd env config get in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for get.

Options inherited from parent commands

  -C, --cwd string       Sets the current working directory.
      --debug            Enables debugging and diagnostics logging.
      --fail-on-prompt   Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt        Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd env config set

Sets a configuration value in the environment.

Synopsis

Sets a configuration value in the environment's config.json file.

Values are automatically parsed as JSON types when possible. Booleans (true/false),
numbers (42, 3.14), arrays ([...]), and objects ({...}) are stored with their native
JSON types. Plain text values are stored as strings. To force a JSON-typed value to be
stored as a string, wrap it in JSON quotes (e.g. '"true"' or '"8080"').

azd env config set <path> <value> [flags]

Examples

azd env config set myapp.endpoint https://example.com
azd env config set myapp.debug true
azd env config set myapp.count 42
azd env config set infra.parameters.tags '{"env":"dev"}'
azd env config set myapp.port '"8080"'

Options

      --docs                 Opens the documentation for azd env config set in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for set.

Options inherited from parent commands

  -C, --cwd string       Sets the current working directory.
      --debug            Enables debugging and diagnostics logging.
      --fail-on-prompt   Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt        Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd env config unset

Unsets a configuration value in the environment.

Synopsis

Removes a configuration value from the environment's config.json file.

azd env config unset <path> [flags]

Examples

azd env config unset myapp.endpoint

Options

      --docs                 Opens the documentation for azd env config unset in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for unset.

Options inherited from parent commands

  -C, --cwd string       Sets the current working directory.
      --debug            Enables debugging and diagnostics logging.
      --fail-on-prompt   Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt        Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd env get-value

Get specific environment value.

azd env get-value <keyName> [flags]

Options

      --docs                 Opens the documentation for azd env get-value in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for get-value.

Options inherited from parent commands

  -C, --cwd string       Sets the current working directory.
      --debug            Enables debugging and diagnostics logging.
      --fail-on-prompt   Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt        Accepts the default value instead of prompting, or it fails if there is no default.

See also

  • azd env: Manage environments (ex: default environment, environment variables).
  • Back to top

azd env get-values

Get all environment values.

azd env get-values [flags]

Options

      --docs                 Opens the documentation for azd env get-values in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for get-values.

Options inherited from parent commands

  -C, --cwd string       Sets the current working directory.
      --debug            Enables debugging and diagnostics logging.
      --fail-on-prompt   Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt        Accepts the default value instead of prompting, or it fails if there is no default.

See also

  • azd env: Manage environments (ex: default environment, environment variables).
  • Back to top

azd env list

List environments.

azd env list [flags]

Options

      --docs   Opens the documentation for azd env list in your web browser.
  -h, --help   Gets help for list.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

  • azd env: Manage environments (ex: default environment, environment variables).
  • Back to top

azd env new

Create a new environment and set it as the default.

azd env new <environment> [flags]

Options

      --docs                  Opens the documentation for azd env new in your web browser.
  -h, --help                  Gets help for new.
  -l, --location string       Azure location for the new environment
      --subscription string   ID of an Azure subscription to use for the new environment

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

  • azd env: Manage environments (ex: default environment, environment variables).
  • Back to top

azd env refresh

Refresh environment values by using information from a previous infrastructure provision.

azd env refresh <environment> [flags]

Options

      --docs                 Opens the documentation for azd env refresh in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for refresh.
      --hint string          Hint to help identify the environment to refresh
      --layer string         Provisioning layer to refresh the environment from.

Options inherited from parent commands

  -C, --cwd string       Sets the current working directory.
      --debug            Enables debugging and diagnostics logging.
      --fail-on-prompt   Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt        Accepts the default value instead of prompting, or it fails if there is no default.

See also

  • azd env: Manage environments (ex: default environment, environment variables).
  • Back to top

azd env remove

Remove an environment.

azd env remove <environment> [flags]

Options

      --docs                 Opens the documentation for azd env remove in your web browser.
  -e, --environment string   The name of the environment to use.
      --force                Skips confirmation before performing removal.
  -h, --help                 Gets help for remove.

Options inherited from parent commands

  -C, --cwd string       Sets the current working directory.
      --debug            Enables debugging and diagnostics logging.
      --fail-on-prompt   Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt        Accepts the default value instead of prompting, or it fails if there is no default.

See also

  • azd env: Manage environments (ex: default environment, environment variables).
  • Back to top

azd env select

Set the default environment.

azd env select [<environment>] [flags]

Options

      --docs   Opens the documentation for azd env select in your web browser.
  -h, --help   Gets help for select.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

  • azd env: Manage environments (ex: default environment, environment variables).
  • Back to top

azd env set

Set one or more environment values.

Synopsis

Set one or more environment values using key-value pairs or by loading from a .env formatted file.

azd env set [<key> <value>] | [<key>=<value> ...] | [--file <filepath>] [flags]

Options

      --docs                 Opens the documentation for azd env set in your web browser.
  -e, --environment string   The name of the environment to use.
      --file string          Path to .env formatted file to load environment values from.
  -h, --help                 Gets help for set.

Options inherited from parent commands

  -C, --cwd string       Sets the current working directory.
      --debug            Enables debugging and diagnostics logging.
      --fail-on-prompt   Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt        Accepts the default value instead of prompting, or it fails if there is no default.

See also

  • azd env: Manage environments (ex: default environment, environment variables).
  • Back to top

azd env set-secret

Set a name as a reference to a Key Vault secret in the environment.

Synopsis

You can either create a new Key Vault secret or select an existing one.
The provided name is the key for the .env file which holds the secret reference to the Key Vault secret.

azd env set-secret <name> [flags]

Options

      --docs                 Opens the documentation for azd env set-secret in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for set-secret.

Options inherited from parent commands

  -C, --cwd string       Sets the current working directory.
      --debug            Enables debugging and diagnostics logging.
      --fail-on-prompt   Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt        Accepts the default value instead of prompting, or it fails if there is no default.

See also

  • azd env: Manage environments (ex: default environment, environment variables).
  • Back to top

azd extension

Manage azd extensions.

Options

      --docs   Opens the documentation for azd extension in your web browser.
  -h, --help   Gets help for extension.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd extension install

Installs specified extensions.

azd extension install <extension-id> [flags]

Options

      --docs             Opens the documentation for azd extension install in your web browser.
  -f, --force            Force installation, including downgrades and reinstalls
  -h, --help             Gets help for install.
  -s, --source string    The extension source to use for installs
  -v, --version string   The version of the extension to install

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd extension list

List available extensions.

azd extension list [--installed] [flags]

Options

      --docs            Opens the documentation for azd extension list in your web browser.
  -h, --help            Gets help for list.
      --installed       List installed extensions
      --source string   Filter extensions by source
      --tags strings    Filter extensions by tags

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd extension show

Show details for a specific extension.

azd extension show <extension-id> [flags]

Options

      --docs            Opens the documentation for azd extension show in your web browser.
  -h, --help            Gets help for show.
  -s, --source string   The extension source to use.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd extension source

View and manage extension sources

Options

      --docs   Opens the documentation for azd extension source in your web browser.
  -h, --help   Gets help for source.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd extension source add

Add an extension source with the specified name

azd extension source add [flags]

Options

      --docs              Opens the documentation for azd extension source add in your web browser.
  -h, --help              Gets help for add.
  -l, --location string   The location of the extension source
  -n, --name string       The name of the extension source
  -t, --type string       The type of the extension source. Supported types are 'file' and 'url'

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd extension source list

List extension sources

azd extension source list [flags]

Options

      --docs   Opens the documentation for azd extension source list in your web browser.
  -h, --help   Gets help for list.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd extension source remove

Remove an extension source with the specified name

azd extension source remove <name> [flags]

Options

      --docs   Opens the documentation for azd extension source remove in your web browser.
  -h, --help   Gets help for remove.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd extension source validate

Validate an extension source's registry.json file.

Synopsis

Validate an extension source's registry.json file.

Accepts a source name (from 'azd extension source list'), a local file path,
or a URL. Checks required fields, valid capabilities, semver version format,
platform artifact structure, and extension ID format.

azd extension source validate <name-or-path-or-url> [flags]

Options

      --docs     Opens the documentation for azd extension source validate in your web browser.
  -h, --help     Gets help for validate.
      --strict   Enable strict validation (require checksums)

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd extension uninstall

Uninstall specified extensions.

azd extension uninstall [extension-id] [flags]

Options

      --all    Uninstall all installed extensions
      --docs   Opens the documentation for azd extension uninstall in your web browser.
  -h, --help   Gets help for uninstall.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd extension upgrade

Upgrade specified extensions.

azd extension upgrade [extension-id] [flags]

Options

      --all              Upgrade all installed extensions
      --docs             Opens the documentation for azd extension upgrade in your web browser.
  -h, --help             Gets help for upgrade.
  -s, --source string    The extension source to use for upgrades
  -v, --version string   The version of the extension to upgrade to

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd hooks

Develop, test and run hooks for a project.

Options

      --docs   Opens the documentation for azd hooks in your web browser.
  -h, --help   Gets help for hooks.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd hooks run

Runs the specified hook for the project, provisioning layers, and services

azd hooks run <name> [flags]

Options

      --docs                 Opens the documentation for azd hooks run in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for run.
      --layer string         Only runs hooks for the specified provisioning layer.
      --platform string      Forces hooks to run for the specified platform.
      --service string       Only runs hooks for the specified service.

Options inherited from parent commands

  -C, --cwd string       Sets the current working directory.
      --debug            Enables debugging and diagnostics logging.
      --fail-on-prompt   Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt        Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd infra

Manage your Infrastructure as Code (IaC).

Options

      --docs   Opens the documentation for azd infra in your web browser.
  -h, --help   Gets help for infra.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd infra generate

Write IaC for your project to disk, allowing you to manually manage it.

azd infra generate [flags]

Options

      --docs                 Opens the documentation for azd infra generate in your web browser.
  -e, --environment string   The name of the environment to use.
      --force                Overwrite any existing files without prompting
  -h, --help                 Gets help for generate.

Options inherited from parent commands

  -C, --cwd string       Sets the current working directory.
      --debug            Enables debugging and diagnostics logging.
      --fail-on-prompt   Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt        Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd init

Initialize a new application.

azd init [flags]

Options

  -b, --branch string         The template branch to initialize from. Must be used with a template argument (--template or -t).
      --docs                  Opens the documentation for azd init in your web browser.
  -e, --environment string    The name of the environment to use.
  -f, --filter strings        The tag(s) used to filter template results. Supports comma-separated values.
      --from-code             Initializes a new application from your existing code.
  -h, --help                  Gets help for init.
  -l, --location string       Azure location for the new environment
  -m, --minimal               Initializes a minimal project.
  -s, --subscription string   ID of an Azure subscription to use for the new environment
  -t, --template string       Initializes a new application from a template. You can use a Full URI, <owner>/<repository>, <repository> if it's part of the azure-samples organization, or a local directory path (./dir, ../dir, or absolute path).
      --up                    Provision and deploy to Azure after initializing the project from a template.

Options inherited from parent commands

  -C, --cwd string       Sets the current working directory.
      --debug            Enables debugging and diagnostics logging.
      --fail-on-prompt   Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt        Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd mcp

Manage Model Context Protocol (MCP) server. (Alpha)

Options

      --docs   Opens the documentation for azd mcp in your web browser.
  -h, --help   Gets help for mcp.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd mcp start

Starts the MCP server.

Synopsis

Starts the Model Context Protocol (MCP) server.

This command starts an MCP server that can be used by MCP clients to access
azd functionality through the Model Context Protocol interface.

azd mcp start [flags]

Options

      --docs   Opens the documentation for azd mcp start in your web browser.
  -h, --help   Gets help for start.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd monitor

Monitor a deployed project.

azd monitor [flags]

Options

      --docs                 Opens the documentation for azd monitor in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for monitor.
      --live                 Open a browser to Application Insights Live Metrics. Live Metrics is currently not supported for Python apps.
      --logs                 Open a browser to Application Insights Logs.
      --overview             Open a browser to Application Insights Overview Dashboard.

Options inherited from parent commands

  -C, --cwd string       Sets the current working directory.
      --debug            Enables debugging and diagnostics logging.
      --fail-on-prompt   Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt        Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd package

Packages the project's code to be deployed to Azure.

azd package <service> [flags]

Options

      --all                  Packages all services that are listed in azure.yaml
      --docs                 Opens the documentation for azd package in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for package.
      --output-path string   File or folder path where the generated packages will be saved.

Options inherited from parent commands

  -C, --cwd string       Sets the current working directory.
      --debug            Enables debugging and diagnostics logging.
      --fail-on-prompt   Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt        Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd pipeline

Manage and configure your deployment pipelines.

Options

      --docs   Opens the documentation for azd pipeline in your web browser.
  -h, --help   Gets help for pipeline.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd pipeline config

Configure your deployment pipeline to connect securely to Azure. (Beta)

azd pipeline config [flags]

Options

  -m, --applicationServiceManagementReference string   Service Management Reference. References application or service contact information from a Service or Asset Management database. This value must be a Universally Unique Identifier (UUID). You can set this value globally by running azd config set pipeline.config.applicationServiceManagementReference <UUID>.
      --auth-type string                               The authentication type used between the pipeline provider and Azure for deployment (Only valid for GitHub provider). Valid values: federated, client-credentials.
      --docs                                           Opens the documentation for azd pipeline config in your web browser.
  -e, --environment string                             The name of the environment to use.
  -h, --help                                           Gets help for config.
      --principal-id string                            The client id of the service principal to use to grant access to Azure resources as part of the pipeline.
      --principal-name string                          The name of the service principal to use to grant access to Azure resources as part of the pipeline.
      --principal-role stringArray                     The roles to assign to the service principal. By default the service principal will be granted the Contributor and User Access Administrator roles. (default [Contributor,User Access Administrator])
      --provider string                                The pipeline provider to use (github for Github Actions and azdo for Azure Pipelines).
      --remote-name string                             The name of the git remote to configure the pipeline to run on. (default "origin")

Options inherited from parent commands

  -C, --cwd string       Sets the current working directory.
      --debug            Enables debugging and diagnostics logging.
      --fail-on-prompt   Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt        Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd provision

Provision Azure resources for your project.

azd provision [<layer>] [flags]

Options

      --docs                  Opens the documentation for azd provision in your web browser.
  -e, --environment string    The name of the environment to use.
  -h, --help                  Gets help for provision.
  -l, --location string       Azure location for the new environment
      --no-state              (Bicep only) Forces a fresh deployment based on current Bicep template files, ignoring any stored deployment state.
      --preview               Preview changes to Azure resources.
      --subscription string   ID of an Azure subscription to use for the new environment

Options inherited from parent commands

  -C, --cwd string       Sets the current working directory.
      --debug            Enables debugging and diagnostics logging.
      --fail-on-prompt   Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt        Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd publish

Publish a service to a container registry.

azd publish <service> [flags]

Options

      --all                   Publishes all services that are listed in azure.yaml
      --docs                  Opens the documentation for azd publish in your web browser.
  -e, --environment string    The name of the environment to use.
      --from-package string   Publishes the service from a container image (image tag).
  -h, --help                  Gets help for publish.
      --to string             The target container image in the form '[registry/]repository[:tag]' to publish to.

Options inherited from parent commands

  -C, --cwd string       Sets the current working directory.
      --debug            Enables debugging and diagnostics logging.
      --fail-on-prompt   Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt        Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd restore

Restores the project's dependencies.

azd restore <service> [flags]

Options

      --all                  Restores all services that are listed in azure.yaml
      --docs                 Opens the documentation for azd restore in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for restore.

Options inherited from parent commands

  -C, --cwd string       Sets the current working directory.
      --debug            Enables debugging and diagnostics logging.
      --fail-on-prompt   Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt        Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd show

Display information about your project and its resources.

azd show [resource-name|resource-id] [flags]

Options

      --docs                 Opens the documentation for azd show in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for show.
      --show-secrets         Unmask secrets in output.

Options inherited from parent commands

  -C, --cwd string       Sets the current working directory.
      --debug            Enables debugging and diagnostics logging.
      --fail-on-prompt   Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt        Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd template

Find and view template details.

Options

      --docs   Opens the documentation for azd template in your web browser.
  -h, --help   Gets help for template.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd template list

Show list of sample azd templates. (Beta)

azd template list [flags]

Options

      --docs             Opens the documentation for azd template list in your web browser.
  -f, --filter strings   The tag(s) used to filter template results. Supports comma-separated values.
  -h, --help             Gets help for list.
  -s, --source string    Filters templates by source.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd template show

Show details for a given template. (Beta)

azd template show <template> [flags]

Options

      --docs   Opens the documentation for azd template show in your web browser.
  -h, --help   Gets help for show.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd template source

View and manage template sources. (Beta)

Options

      --docs   Opens the documentation for azd template source in your web browser.
  -h, --help   Gets help for source.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd template source add

Adds an azd template source with the specified key. (Beta)

Synopsis

The key can be any value that uniquely identifies the template source, with well-known values being:
・default: Default templates
・awesome-azd: Templates from https://aka.ms/awesome-azd

azd template source add <key> [flags]

Options

      --docs              Opens the documentation for azd template source add in your web browser.
  -h, --help              Gets help for add.
  -l, --location string   Location of the template source. Required when using type flag.
  -n, --name string       Display name of the template source.
  -t, --type string       Kind of the template source. Supported types are 'file', 'url' and 'gh'.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd template source list

Lists the configured azd template sources. (Beta)

azd template source list [flags]

Options

      --docs   Opens the documentation for azd template source list in your web browser.
  -h, --help   Gets help for list.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd template source remove

Removes the specified azd template source (Beta)

azd template source remove <key> [flags]

Options

      --docs   Opens the documentation for azd template source remove in your web browser.
  -h, --help   Gets help for remove.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd up

Provision and deploy your project to Azure with a single command.

azd up [flags]

Options

      --docs                  Opens the documentation for azd up in your web browser.
  -e, --environment string    The name of the environment to use.
  -h, --help                  Gets help for up.
  -l, --location string       Azure location for the new environment
      --subscription string   ID of an Azure subscription to use for the new environment

Options inherited from parent commands

  -C, --cwd string       Sets the current working directory.
      --debug            Enables debugging and diagnostics logging.
      --fail-on-prompt   Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt        Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd update

Updates azd to the latest version.

azd update [flags]

Options

      --channel string             Update channel: stable or daily.
      --check-interval-hours int   Override the update check interval in hours.
      --docs                       Opens the documentation for azd update in your web browser.
  -h, --help                       Gets help for update.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

azd version

Print the version number of Azure Developer CLI.

azd version [flags]

Options

      --docs   Opens the documentation for azd version in your web browser.
  -h, --help   Gets help for version.

Options inherited from parent commands

  -C, --cwd string           Sets the current working directory.
      --debug                Enables debugging and diagnostics logging.
  -e, --environment string   The name of the environment to use.
      --fail-on-prompt       Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

Copy link
Copy Markdown
Member

@jongio jongio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-approving after ef075a7 addressed my feedback (empty-location log + case-insensitive version match + format filtering test). Looks good.

Copy link
Copy Markdown
Contributor

@wbreza wbreza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review — PR #7672: AI Model Quota Preflight Validation

Verdict: 💬 Comments — Feature concept is solid. Several items to discuss, particularly around test recording size and quota aggregation logic.

Findings

🟠 1. Test recordings are very large (~5.5MB) — can we reduce?

The 6 recording YAML files total ~5.5MB / 16,689 lines. Each RG-scoped recording is ~5,206 lines (~1.56MB), while subscription-scoped ones are ~357 lines (~100KB).

The bulk comes from the CognitiveServices model catalog response (~607KB per recording) which includes costs, SKU variants, capabilities, deprecation timelines, and rate limits — none of which the preflight logic actually inspects. The preflight check only needs model name, existence, and quota/usage numbers.

The 3 RG-scoped recordings appear to contain nearly identical responses — are these different test scenarios that happen to hit the same API responses? If so, could we:

  • Strip the recordings to only include fields the preflight logic reads?
  • Or share a common base recording and parameterize the differences?

This would significantly reduce the PR footprint. Not blocking, but worth investigating.

🟠 2. Quota not aggregated across deployments sharing the same model

Each deployment is validated independently against remaining quota. If deployment A requests 60 units and deployment B requests 60 units, both pass individually against 100 remaining — but the combined 120 exceeds quota. Consider aggregating required capacity per usageName before checking against remaining quota.

🟠 3. Zero/negative capacity handling is inconsistent

When dep.Capacity <= 0, it's coerced to 1 for the quota comparison but reported as the original value in the warning message. This could produce confusing diagnostics like "Requested capacity: 0, but deployment requires 1 unit." Consider either warning about invalid capacity separately, or using consistent values in both comparison and message.

�� 4. Missing quota entry defaults to zero remaining

If a usage name isn't in the quota API response (API incompleteness, regional restrictions), usageMap[usageName] defaults to float64 zero. This could trigger a false warning. Consider checking existence explicitly and emitting a distinct "quota data unavailable" warning instead.

🟡 5. Nil vs empty slice semantics in validate()

nil return from the check function could mean "skipped" or "ran with no findings." If telemetry distinguishes these, initialize the results slice to empty ([]PreflightCheckResult{}) rather than nil when checks actually execute.

🟡 6. RG-scoped deployments don't resolve actual RG location

Falls back to AZURE_LOCATION env var, which may differ from the resource group's actual region. Consider using GetResourceGroup() to look up the actual RG location for more accurate quota validation.

🔵 7. Minor: GetResourceGroup() needs nil checks on SDK response pointers

Azure SDK responses may have nil pointer fields. Add guards before dereferencing resp.ID, resp.Name, resp.Location.

What's Good

  • ✅ Feature concept is solid — catching quota issues before provisioning saves real user time
  • ✅ PreflightCheckFn returning []PreflightCheckResult enables multi-warning checks cleanly
  • ✅ Nil aiModelService check is good defensive programming
  • ✅ Good test scenario coverage (default capacity, invalid model, invalid version, different location)
  • ✅ Both RG-scoped and subscription-scoped deployments tested

Nice work on the preflight framework evolution — the multi-result pattern is a good design choice. The quota validation will save users a lot of wasted provisioning time. 👍

@vhvb1989
Copy link
Copy Markdown
Member Author

Response to @wbreza's review

Thanks for the thorough review Wallace! Here's the status on each finding:

🟠 1. Large test recordings — Good point. This isn't specific to this PR — it's a general issue with how the recorder captures full API responses. Created #7699 to investigate recording size reduction across all functional tests.

🟠 2. Quota not aggregated — Already addressed in iteration 2. The check now aggregates required capacity per usageName before comparing against remaining quota, using a requiredByUsage map.

🟠 3. Zero/negative capacity — Already addressed in iteration 1. The check now uses effectiveCapacity (coerced to 1 if ≤ 0) consistently in both the comparison and the warning message.

🟡 4. Missing quota entry defaults to 0 — Already addressed in iteration 2. This is intentional conservative behavior — if the quota API doesn't return an entry for a usage name, we treat it as 0 remaining and warn, rather than silently skipping.

🟡 5. Nil vs empty slice — Already addressed in iteration 1. results is initialized to []PreflightCheckResult{} (non-nil empty slice) so telemetry can distinguish 'ran with no findings' from 'skipped'.

🟡 6. RG location resolution — Already addressed. resolveResourceGroupLocation() uses p.resourceService.GetResourceGroup() to look up the actual RG location, falling back to AZURE_LOCATION only when the RG doesn't exist yet (new RG creation).

🔵 7. Nil checks on SDK response — Already addressed. GetResourceGroup now uses convert.ToValueWithDefault for nil-safe pointer dereferences.

All 7 items either already fixed in prior iterations or tracked as follow-up (#7699 for recordings).

Copy link
Copy Markdown
Contributor

@wbreza wbreza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-Review — PR #7672: AI Model Quota Preflight Validation

Verdict: ✅ Approve

All 7 findings from my previous review have been verified as addressed in the current code:

  1. Test recordings — Acknowledged as functional test fixtures
  2. Quota aggregation — Now uses
    equiredByUsage[usageName] += effectiveCapacity\ to sum across deployments before comparison
  3. Zero/negative capacity — Coerced effective value used consistently in both comparison and reporting
  4. Missing quota entry — Uses
    emaining, found := usageMap[...]\ with explicit existence check
  5. Nil vs empty slice — Results initialized to []PreflightCheckResult{}\ with semantic comment
  6. RG location resolution — New
    esolveResourceGroupLocation()\ calls \GetResourceGroup(), falls back to \AZURE_LOCATION\
  7. GetResourceGroup nil safety — Uses \convert.ToValueWithDefault()\ for safe pointer dereferencing

Fresh scan of all core Go files found no additional issues. Quota aggregation loop, deduplication logic, and error handling are all correct.

Nice work on the iterative improvements, Victor — the preflight framework evolution and quota validation will save real user time. 👍

@rajeshkamal5050 rajeshkamal5050 merged commit fe57152 into main Apr 14, 2026
28 checks passed
Copilot AI added a commit that referenced this pull request Apr 14, 2026
Agent-Logs-Url: https://github.com/Azure/azure-dev/sessions/35135691-9b5c-4458-8cc1-3ec8534b0753

Co-authored-by: rajeshkamal5050 <11532743+rajeshkamal5050@users.noreply.github.com>
rajeshkamal5050 added a commit that referenced this pull request Apr 14, 2026
* Initial plan

* Create changelog for azd 1.23.16 (#7694)

Agent-Logs-Url: https://github.com/Azure/azure-dev/sessions/644ac742-2540-4fbe-bd0d-093c1a90b997

Co-authored-by: rajeshkamal5050 <11532743+rajeshkamal5050@users.noreply.github.com>

* Fix changelog: remove hard-coded tool names from --fail-on-prompt entry

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Add PR #7672 (AI model quota preflight check) to changelog

Agent-Logs-Url: https://github.com/Azure/azure-dev/sessions/35135691-9b5c-4458-8cc1-3ec8534b0753

Co-authored-by: rajeshkamal5050 <11532743+rajeshkamal5050@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rajeshkamal5050 <11532743+rajeshkamal5050@users.noreply.github.com>
Co-authored-by: Rajesh Kamal <rajeshkamal@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dynamic Region Filtering Based on User-Specified Model and Capacity on azd Quota check

7 participants