Skip to content

Fix environment variable leak and flag propagation for extensions#7314

Open
jongio wants to merge 124 commits intomainfrom
fix/env-leak-extensions
Open

Fix environment variable leak and flag propagation for extensions#7314
jongio wants to merge 124 commits intomainfrom
fix/env-leak-extensions

Conversation

@jongio
Copy link
Copy Markdown
Member

@jongio jongio commented Mar 25, 2026

Summary

This is a redo of #7035 (which was reverted by #7274) with the prerequisite work done first. It fixes two problems:

  1. Environment variable leak (azd <extension> -e <env> leaks default environment variables into extension process #7034): Extensions never received the correct -e/--environment value because extension commands use DisableFlagParsing: true, so cobra never parsed the flag. The DI resolver always fell back to the default environment.

  2. Flag propagation broken by revert (Revert: Fix env var leak when running extension commands with -e flag (#7035) #7274): The revert also broke --debug and --cwd propagation to extensions, since it changed extensions.go back to using cmd.Flags() which returns defaults for extension commands.

What changed

  • global_command_options.go: Added EnvironmentName field
  • auto_install.go: Added -e/--environment to CreateGlobalFlagSet() with strict validation in ParseGlobalFlags() (rejects invalid env names with clear error)
  • container.go: Updated EnvFlag DI resolver to fall back to globalOptions.EnvironmentName
  • extensions.go: Uses globalOptions (populated before cobra) for ALL InvokeOptions fields (debug, cwd, environment, no-prompt)
  • environment.go: Added exported InvalidEnvironmentNameError() for shared validation across all call sites
  • manager.go: Replaced 3 inconsistent error message formats with the shared InvalidEnvironmentNameError()
  • 64 snapshot files: Updated to reflect the new -e, --environment flag in help text
  • auto_install_test.go: 11 new subtests (6 valid env name + 5 invalid env name)

Key difference from #7035

PR #7035 added strict -e validation which broke extensions that reused -e for URLs. This PR is safe because PR #7313 migrates extensions off -e first.

How globalOptions solves it

ParseGlobalFlags() runs before cobra, manually parsing the raw os.Args. For extension commands (DisableFlagParsing: true), cobra skips all flag parsing, but globalOptions already has the correct values. Both the DI resolver and extension invocation now read from globalOptions instead of cmd.Flags().

Closes #7034
Closes #7271

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

This PR fixes global flag propagation (notably -e/--environment, --debug, --cwd) to extension commands that run with DisableFlagParsing: true, and standardizes invalid environment-name errors.

Changes:

  • Introduces GlobalCommandOptions.EnvironmentName and parses -e/--environment early via ParseGlobalFlags().
  • Updates extension invocation and DI env resolver to read from pre-parsed globalOptions rather than cmd.Flags().
  • Centralizes invalid environment-name error formatting and updates help/usage snapshots to include the new global flag.

Reviewed changes

Copilot reviewed 71 out of 71 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
cli/azd/pkg/environment/manager.go Replaces ad-hoc invalid env name messaging with shared InvalidEnvironmentNameError()
cli/azd/pkg/environment/environment.go Adds shared exported invalid env name error helper
cli/azd/internal/global_command_options.go Adds EnvironmentName to carry pre-parsed -e/--environment value
cli/azd/cmd/extensions.go Propagates debug/cwd/env/no-prompt to extensions via globalOptions
cli/azd/cmd/container.go DI resolver for EnvFlag falls back to globalOptions.EnvironmentName
cli/azd/cmd/auto_install.go Adds global -e/--environment and validates it in ParseGlobalFlags()
cli/azd/cmd/auto_install_test.go Adds tests for parsing/validating -e/--environment
cli/azd/cmd/testdata/TestFigSpec.ts Moves --environment/-e to persistent options; removes per-command env options in a few places
cli/azd/cmd/testdata/TestUsage-azd.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-x.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-version.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-template.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-template-source.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-template-source-remove.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-template-source-list.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-template-source-add.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-template-show.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-template-list.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-pipeline.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-mcp.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-mcp-start.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-infra.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-hooks.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-extension.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-extension-upgrade.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-extension-uninstall.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-extension-source.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-extension-source-validate.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-extension-source-remove.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-extension-source-list.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-extension-source-add.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-extension-show.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-extension-list.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-extension-install.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-env.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-env-select.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-env-new.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-env-list.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-env-config.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-demo.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-copilot.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-copilot-consent.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-copilot-consent-revoke.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-copilot-consent-list.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-copilot-consent-grant.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-config.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-config-unset.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-config-show.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-config-set.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-config-reset.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-config-options.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-config-list-alpha.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-config-get.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-concurx.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-completion.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-completion-zsh.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-completion-powershell.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-completion-fish.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-completion-fig.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-completion-bash.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-coding-agent.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-auth.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-auth-status.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-auth-logout.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-auth-login.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-appservice.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-ai.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-ai-models.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-ai-finetuning.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-ai-agent.snap Updates help snapshot to include -e, --environment
cli/azd/cmd/testdata/TestUsage-azd-add.snap Updates help snapshot to include -e, --environment
Comments suppressed due to low confidence (2)

cli/azd/internal/global_command_options.go:1

  • This comment says EnvironmentName is empty when the passed -e value is not a valid environment name (e.g., extensions reuse -e for URLs), but ParseGlobalFlags() now returns an error for invalid values. Update the comment to match the new strict-validation behavior (or relax validation if the intent is still to allow extensions to reuse -e).
    cli/azd/pkg/environment/environment.go:1
  • The standardized error message hard-codes the allowed character set as 'only alphanumeric characters and hyphens'. In this PR, TestParseGlobalFlags_EnvironmentName treats a name containing a dot (my-env.v2) as valid. Either adjust the test expectations/validation to disallow dots, or update the error message to accurately describe what IsValidEnvironmentName permits so users get correct guidance.

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.

Reviewed the core fix (switching extensionAction from cmd.Flags() to globalOptions for DisableFlagParsing extensions), IoC plumbing, AZD_DISABLE_AGENT_DETECT kill switch, InvalidEnvironmentNameError refactor, and require.Fail -> require.Failf fix. No issues found.

@jongio jongio force-pushed the fix/env-leak-extensions branch 2 times, most recently from c753524 to 14fb280 Compare March 27, 2026 02:31
@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/7314/uninstall-azd.sh | bash;
curl -fsSL https://azuresdkartifacts.z5.web.core.windows.net/azd/standalone/pr/7314/install-azd.sh | bash -s -- --base-url https://azuresdkartifacts.z5.web.core.windows.net/azd/standalone/pr/7314 --version '' --verbose --skip-verify

pwsh:

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

Windows

PowerShell install

powershell -c "Set-ExecutionPolicy Bypass Process; irm 'https://azuresdkartifacts.z5.web.core.windows.net/azd/standalone/pr/7314/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/7314/install-azd.ps1' > install-azd.ps1; ./install-azd.ps1 -BaseUrl 'https://azuresdkartifacts.z5.web.core.windows.net/azd/standalone/pr/7314' -Version '' -SkipVerify -Verbose;"

MSI install

powershell -c "irm 'https://azuresdkartifacts.z5.web.core.windows.net/azd/standalone/pr/7314/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: 03/27/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.
  -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 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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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 (readonly, any)
      --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.
      --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 (readonly, any)
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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 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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --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.
      --no-prompt            Accepts the default value instead of prompting, or it fails if there is no default.

See also

richardpark-msft and others added 14 commits March 27, 2026 12:05
…nt (#7076)

Just a little unprotected access to a variable. This should just happen if you run `go test -race`

This is the test I used to repro it, but I'm unsure if you already have `-race` turned on in testing, etc... Let me know, I'll move this into the right spot.

```go
package bug_test

import (
	"testing"

	"github.com/azure/azure-dev/cli/azd/pkg/ux"
	"github.com/stretchr/testify/require"
)

func TestUseUXTaskList_RaceCondition(t *testing.T) {
	taskList := ux.NewTaskList(&ux.TaskListOptions{})

	taskList.AddTask(ux.TaskOptions{
		Title: "hello",
		Action: func(spf ux.SetProgressFunc) (ux.TaskState, error) {
			return ux.Success, nil
		},
	})

	taskList.AddTask(ux.TaskOptions{
		Title: "hello2",
		Action: func(spf ux.SetProgressFunc) (ux.TaskState, error) {
			return ux.Success, nil
		},
	})

	err := taskList.Run()
	require.NoError(t, err)
}
```
…llback (#7072)

When `state.remote.config.subscriptionId` isn't set, the blob client constructed for remote state now falls back to the default subscription from user config (`defaults.subscription`). Previously, it used the home tenant which is unexpected.

Fixes #7067
The extension was using Subscription.TenantId (the resource tenant) to
create the AzureDeveloperCLICredential after subscription selection. For
multi-tenant/guest users, this differs from Subscription.UserTenantId
(the user access tenant), causing 'refresh token expired' errors.

This aligns the extension with how azd core resolves credentials via
SubscriptionsManager.LookupTenant(), which returns UserAccessTenantId.

Fixes #7077

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

The test used a single 100ms context for both phases: confirming Ready()
blocks (50ms) and then waiting for it to unblock after Run() starts
(remaining ~50ms). On slow CI machines, goroutine scheduling could
consume the remaining budget.

Split into two independent phases: a 50ms context expected to timeout
(proving Ready() blocks), then a fresh 5s context for the second
Ready() call that completes after Run() starts.
…7018)

* update UI and add version check for failed ext

* Update cli/azd/cmd/middleware/extensions.go

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

* address feedback

* address feedback

* address feedback

* clean error message

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…l extensions (#7080)

* fix(extensions): apply same UserTenantId fix to all affected extensions

Audit of all extensions found the same bug in 5 more extensions:
- azure.ai.models (custom.go, init.go)
- azure.ai.agents (init.go, init_from_code.go)
- azure.ai.finetune (init.go)
- microsoft.azd.ai.builder (start.go)
- microsoft.azd.demo (prompt.go)

Extensions using LookupTenant() (azure.appservice, azure.ai.agents
parser.go/service_target_agent.go) are already correct since the server
resolves to UserAccessTenantId.

Fixes #7077

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

* chore: add Copilot review instruction for extension tenant usage

Adds a path-scoped Copilot instruction for cli/azd/extensions/** that
flags use of Subscription.TenantId (resource tenant) instead of
Subscription.UserTenantId (user access tenant) for credential creation.

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

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…rounds (#7063)

* add cases for provision errors and make sure infra fix over az command

* Update cli/azd/internal/mcp/tools/prompts/azd_provision_common_error.md

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

* Update cli/azd/internal/mcp/tools/prompts/azd_provision_common_error.md

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

* address feedback

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* add error suggestion yml rule and actions in error message

* address feedback
* feat: add localFallback option for Docker remote build

When remoteBuild is true and localFallback is true in azure.yaml,
azd automatically falls back to a local Docker build if the remote
ACR build fails. Displays a WARNING message when fallback triggers.

This helps users on subscriptions that don't support ACR Tasks
(e.g., free trial) by gracefully degrading to local Docker builds
instead of failing outright.

Changes:
- Add localFallback field to DockerProjectOptions struct
- Add fallback logic in ContainerHelper.Publish()
- Update proto definition and generated code
- Update azure.yaml JSON schema (service-level and docker-level)
- Add mapper registry mappings
- Add unit test for fallback behavior

Fixes #4618

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

* address PR review feedback

- Include original error in fallback warning message
- Fix proto field ordering (local_fallback after build_args)
- Align struct tag spacing for LocalFallback
- Remove service-level localFallback from schema (only docker-level)
- Fix lint: break long test line under 125 chars

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

* ci: retrigger pipeline checks

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

* ci: retrigger Windows build check

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

* refactor: make local fallback the default when remoteBuild fails

Remove the localFallback field from DockerProjectOptions and make
fallback-to-local the default behavior when remoteBuild is true and
the remote build fails. Before attempting the local build, azd now
checks if Docker or Podman is installed and running via
CheckInstalled, providing a clear error if neither is available.

Changes:
- Remove LocalFallback from DockerProjectOptions struct, proto, schema
- Always fall back to local build on remote build failure
- Validate Docker/Podman availability before local fallback
- Reserve proto field number 10 to prevent reuse
- Update remoteBuild schema description to document fallback behavior

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

* fix: resolve lint errors (errorlint, gofmt)

- Use %w instead of %s for dockerErr in container_helper.go (errorlint)
- Fix struct field alignment in DockerProjectOptions (gofmt)
- Fix struct literal alignment in mapper_registry.go (gofmt)

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

* fix: correct gofmt struct field alignment after rebase

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

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* chore: apply go fix modernizers for Go 1.26

Run `go fix ./...` and `gofmt -s -w .` to apply automated
Go 1.26 modernizations across the cli/azd codebase.

Fixes #7082

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

* chore: add Qwen to cspell dictionary

Add "Qwen" (AI model family name) to the cspell word list to fix
the pre-existing spell check failure in azure.ai.models extension.

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

* ci: retrigger build

---------

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

* Fix: preserve Dapr configuration during container app deployment

Co-authored-by: spboyer <7681382+spboyer@users.noreply.github.com>

* fix: improve Dapr preservation error handling and add 404 test

- Handle 404 (first deploy) explicitly in persistSettings instead of
  swallowing all errors — proceed without persisting when app does not
  exist yet
- Fail on non-404 errors when Dapr preservation is needed to prevent
  silent config wipe (correctness-critical path)
- Add test for first-deploy scenario (GET 404) verifying no Dapr
  config is injected
- Fix pre-existing cspell issues (projectpkg, agentserver)
- Apply go fix modernizations (to.Ptr -> new)

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

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: spboyer <7681382+spboyer@users.noreply.github.com>
Co-authored-by: Shayne Boyer <spboyer@live.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Update brew install/upgrade instructions

* Include update module
spboyer and others added 19 commits March 27, 2026 12:05
* docs: add PR review patterns to AGENTS.md

Add lessons learned from team and Copilot reviews across PRs #7290,
#7251, #7250, #7247, #7236, #7235, #7202, #7039 as agent instructions
to prevent recurring review findings.

New/expanded sections:
- Error handling: ErrorWithSuggestion field completeness, telemetry
  service attribution, scope-agnostic messages, link/suggestion parity,
  stale data in polling loops
- Architecture boundaries: pkg/project target-agnostic, extension docs
  separation, env var verification against source code
- Output formatting: shell-safe quoted paths, consistent JSON types
- Path safety: traversal validation, quoted paths in messages
- Code organization: extract shared logic across scopes
- Documentation standards: help text consistency, no dead references,
  PR description accuracy
- Testing best practices: test YAML rules e2e, extract shared helpers,
  correct env vars (AZD_FORCE_TTY, NO_COLOR), TypeScript patterns,
  reasonable timeouts, cross-platform paths, test new JSON fields
- CI / GitHub Actions: permissions blocks, PATH handling, cross-workflow
  artifacts, prefer ADO for secrets, no placeholder steps

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

* Fix Copilot instructions for code review and strengthen guidance on Go patterns (#7320)

* Fix Copilot instructions for code review and strengthen guidance on Go patterns

* Update wording

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: JeffreyCA <jeffreychen@microsoft.com>
Bumps  and [picomatch](https://github.com/micromatch/picomatch). These dependencies needed to be updated together.

Updates `picomatch` from 2.3.1 to 2.3.2
- [Release notes](https://github.com/micromatch/picomatch/releases)
- [Changelog](https://github.com/micromatch/picomatch/blob/master/CHANGELOG.md)
- [Commits](micromatch/picomatch@2.3.1...2.3.2)

Updates `picomatch` from 4.0.3 to 4.0.4
- [Release notes](https://github.com/micromatch/picomatch/releases)
- [Changelog](https://github.com/micromatch/picomatch/blob/master/CHANGELOG.md)
- [Commits](micromatch/picomatch@2.3.1...2.3.2)

---
updated-dependencies:
- dependency-name: picomatch
  dependency-version: 2.3.2
  dependency-type: indirect
- dependency-name: picomatch
  dependency-version: 4.0.4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
When the user selects 'N' to preflight validation warnings, azd now
stops immediately with exit code 0 instead of continuing (which caused
a nil panic with custom service targets or proceeded to deploy without
provisioned resources).

Changes:
- Add ErrAbortedByUser sentinel error for user-initiated aborts
- ProvisionAction detects PreflightAbortedSkipped and returns the error
- UX middleware swallows ErrAbortedByUser to produce exit code 0
- Workflow runner returns ErrAbortedByUser unwrapped to stop workflows
- Error middleware skips AI error analysis for user aborts
- Telemetry maps abort to internal.operation_aborted

Fixes #7305

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Bumps [yaml](https://github.com/eemeli/yaml) from 2.8.2 to 2.8.3.
- [Release notes](https://github.com/eemeli/yaml/releases)
- [Commits](eemeli/yaml@v2.8.2...v2.8.3)

---
updated-dependencies:
- dependency-name: yaml
  dependency-version: 2.8.3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…eout (#7346)

* fix: use 127.0.0.1 for gRPC server address and increase extension timeout

The gRPC server binds to 127.0.0.1 (IPv4) but reported its address as
"localhost", which on Windows can resolve to ::1 (IPv6). This mismatch
causes the extension gRPC client to connect to the wrong address,
hanging indefinitely until the timeout fires.

Fix: report 127.0.0.1:PORT to match the actual bind address.

Also increase the default extension startup timeout from 5s to 15s to
accommodate Windows cold-start overhead (Defender scanning, process
creation, gRPC handshake).

Fixes #7304

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

* address review: return shared serverInfo, fix stale comment

- Return &serverInfo instead of constructing a duplicate ServerInfo,
  preventing address drift between auth interceptors and token generation.
- Update inline comment from "5 seconds" to "15 seconds" to match the
  new default.

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

---------

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

* Create changelog for azd 1.23.13

Agent-Logs-Url: https://github.com/Azure/azure-dev/sessions/ec18918d-8b3a-40c9-b15a-4d9b273c0270

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

* Remove PR #7293 from 1.23.13 changelog

Agent-Logs-Url: https://github.com/Azure/azure-dev/sessions/c248a61d-9e5c-4091-b002-953c5c7ea4e7

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>
…ibutes (#7299)

* feat: comprehensive telemetry audit - add command-specific usage attributes

- Add telemetry to auth, config, env, hooks, templates, pipeline, monitor, show, infra commands
- Add 16 new telemetry field constants for command-specific attributes
- Fix user identity tracking with Anonymous account type fallback
- Fix flaky TestStateCacheManager_TTL timing issue
- Add audit documentation: feature matrix, schema, privacy checklist, audit process
- Add telemetry field contract tests and CI coverage check

Resolves #1772

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

* fix: address PR review feedback (threads 1-8)

- Rename test: TestTelemetryFieldConstants with clarified allowlist approach
- pipeline.go: skip SetUsageAttributes for empty provider/auth values
- docs: fix internal/telemetry/ -> cli/azd/internal/tracing/ paths
- docs: add Anonymous to ad.account.type allowed values
- docs: add missing legend symbol in feature-telemetry-matrix.md
- docs: pick CODEOWNERS over GitHub Actions for telemetry PR labeling
- docs: add opt-out rate estimation section with @AngelosP question
- cspell: add metrics-audit word list for docs

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

* fix: hash hook names since extensions can define arbitrary names

Extensions register custom hooks via WithProjectEventHandler/WithServiceEventHandler
with arbitrary string names that are not validated against a fixed set. Hash the
hook name to prevent potential PII leakage in telemetry.

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

* fix: emit default values for pipeline/infra telemetry, revert hook hashing

- pipeline.provider: emit 'auto' when user doesn't specify --provider
- pipeline.auth.type: emit 'auto' when user doesn't specify --auth-type
- infra.provider: emit 'auto' when provider not set in project config
- hooks.name: revert to raw string (not hashed) for telemetry readability
- audit-process.md: add telemetry validation pipeline section
- telemetry-schema.md: document 'auto' as valid value for provider fields

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

* fix: add CODEOWNERS to cspell word list

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

* refactor: remove redundant telemetry attributes per review feedback

Remove attributes that duplicate data already captured by command span
names (config.operation, env.operation, template.operation), OTel span
status (auth.result), or cmd.flags flag names (monitor.type). Remove
show.output.format (should be global, tracked as follow-up). Remove
dead code Anonymous fallback in manager.go.

8 unique attributes remain: auth.method, auth.tenant.id.hashed,
env.count, hooks.name, hooks.type, infra.provider, pipeline.provider,
pipeline.auth.type.

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

* fix: gofmt formatting in telemetry coverage test

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

* fix: add weikanglim to cspell word list

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

* fix: log resolved pipeline provider instead of 'auto' sentinel

Use CiProviderName() to log the actual resolved provider name after
auto-detection instead of the 'auto' placeholder. For auth type, only
log when explicitly specified — cmd.flags absence indicates auto-detection.

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

* fix: address Wei pass-2 review feedback

- Remove 'logout' as auth.method value (not an auth method)
- Unhash tenant ID (infrastructure GUID, not PII)
- Revert unrelated cosmetic change in auth_status.go
- Revert unrelated if/else logic change in manager.go
- Remove redundant TestFieldKeyValues test
- Rename tenant key from ad.tenant.id to auth.tenant.id

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

* ci: re-trigger pipeline (Mac build flake)

* fix: address spboyer review - schema doc mismatch, missing infra generate, undocumented check-status

- Update telemetry-schema.md: ad.tenant.id -> auth.tenant.id to match code
- Add check-status to auth.method allowed values, remove stale logout
- Add missing 'infra generate' to commandsWithSpecificTelemetry manifest

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

* fix: validate hook names before logging to telemetry

Known built-in hook names (pre/post build, deploy, etc.) are logged raw.
Unknown/extension-defined hook names are hashed via SHA-256 to avoid
logging arbitrary user input as customer content.

Addresses review feedback from @weikanglim on hook name telemetry.
Tracks extension hook telemetry gap in issue #7326.

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

* fix: remove audit test and revert TenantIdKey to ad.tenant.id

- Remove fields_audit_test.go per Wei's feedback — test duplicated field
  constants without clear value; snapshot testing would be preferred.
- Revert TenantIdKey from auth.tenant.id back to ad.tenant.id to avoid
  data contract change on existing context-level field.
- Update telemetry-schema.md to match.

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

---------

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

Add post-unmarshal validation that catches nil service, resource, and hook
definitions before they can cause nil-pointer panics. All problems are
collected into a single ConfigValidationError with actionable messages
so users can fix everything in one pass.

Validation covers:
- Services with empty definitions (nil *ServiceConfig)
- Resources with empty definitions (nil *ResourceConfig)
- Hooks with nil slices or nil entries at project and service levels
- Hooks merged from *.hooks.yaml infra module files in Load()

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* update design docs and hide auto update from help

* update message

* address copilot feedback

* golangci-lint

* golangci

* remove auto update part instead of comment out

* gofmt
* Initial plan

* fix: reuse existing env during ai agent init reruns

Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Azure/azure-dev/sessions/83ae2408-eb24-4ff5-b22a-67ad44375e09

* test: tighten env reuse helper coverage

Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Azure/azure-dev/sessions/83ae2408-eb24-4ff5-b22a-67ad44375e09

* chore: revert unrelated concurx module changes

Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Azure/azure-dev/sessions/83ae2408-eb24-4ff5-b22a-67ad44375e09

* Address feedback

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

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The Copilot PR reviewer flagged 5 false positives on PR #7223 because it
didn't know about Go 1.26 features (e.g. new(expr) for pointer literals)
and incorrectly flagged missing imports that existed outside the diff context.

These patterns are documented in cli/azd/AGENTS.md but the PR reviewer
reads .github/instructions/*.instructions.md files, not AGENTS.md.

This adds a focused Go-specific instruction file that covers:
- new(expr) pointer literal syntax (Go 1.26)
- Other modern Go patterns that should not be flagged
- Guidance to check full file context, not just diff hunks

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Bumps [github.com/buger/jsonparser](https://github.com/buger/jsonparser) from 1.1.1 to 1.1.2.
- [Release notes](https://github.com/buger/jsonparser/releases)
- [Commits](buger/jsonparser@v1.1.1...v1.1.2)

---
updated-dependencies:
- dependency-name: github.com/buger/jsonparser
  dependency-version: 1.1.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [github.com/buger/jsonparser](https://github.com/buger/jsonparser) from 1.1.1 to 1.1.2.
- [Release notes](https://github.com/buger/jsonparser/releases)
- [Commits](buger/jsonparser@v1.1.1...v1.1.2)

---
updated-dependencies:
- dependency-name: github.com/buger/jsonparser
  dependency-version: 1.1.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Extension commands use DisableFlagParsing, so cobra never parses global
flags like -e/--environment, --debug, or --cwd. This caused two problems:

1. The DI-resolved environment always loaded the default instead of the
   one specified with -e, leaking wrong env vars into extension processes
   and never setting AZD_ENVIRONMENT (#7034).

2. --debug and --cwd were also not propagated to extensions because
   extensions.go read them from cmd.Flags() which returns defaults.

Fix by:
- Adding -e/--environment to ParseGlobalFlags() with lenient validation:
  valid env names are accepted, non-env values (like URLs that extensions
  pass via -e) are silently skipped so extensions still work.
- Adding EnvironmentName to GlobalCommandOptions so the pre-parsed value
  is available to the DI container and extension runner.
- Updating container.go EnvFlag resolver to fall back to globalOptions
  when cmd.Flags() returns empty (extension commands).
- Updating extensions.go to use globalOptions for all InvokeOptions
  fields (debug, cwd, environment, no-prompt) instead of cmd.Flags().

Closes #7034

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Agent detection (agentdetect package) walks the parent process tree and
auto-enables --no-prompt when it finds an AI coding agent. In CI and
local dev under Copilot CLI, this causes functional tests to fail
because piped stdin is ignored when no-prompt is active.

Changes:
- detect.go: Early return from detectAgent() when AZD_DISABLE_AGENT_DETECT
  is set, suppressing both env var and parent process detection
- cli.go: Set AZD_DISABLE_AGENT_DETECT=1 on all child azd processes in
  RunCommandWithStdIn(), with nil-Env safety (nil means inherit-all in Go)
- detect_test.go: Test that AZD_DISABLE_AGENT_DETECT suppresses detection
- env_test.go: Fix require.Fail -> require.Failf format string bug

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The gosec linter flags os.LookupEnv values as tainted input for log
injection (G706). Remove the env var value from the log message since
only the presence of the env var matters, not its value.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Workflow steps that specify their own -e/--environment flag (e.g.
'azd: env set KEY VALUE -e env1') were getting the parent command's
--environment appended via extractGlobalArgs(), causing the parent's
value to override the step's explicit value.

The environment flag is now excluded from extractGlobalArgs() since
environment propagation to workflow steps is already handled by the
globalOptions DI fallback in the EnvFlag resolver.

Fixes Test_CLI_Up_EnvironmentFlags.

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.

azd <extension> -e <env> leaks default environment variables into extension process azd model custom create failing with latest Azd Version