From d80ae579b2e5dab7ed6a999fedbdde6928f16375 Mon Sep 17 00:00:00 2001 From: Shayne Boyer Date: Mon, 30 Mar 2026 16:56:36 -0400 Subject: [PATCH 01/14] Add --fail-on-prompt flag and auto-enable for agent detection (#7390) - Add --fail-on-prompt global flag for strict non-interactive mode - When active, all prompts fail with actionable errors even if defaults exist - Auto-enable when LLM agent is detected (replaces silent default behavior) - --fail-on-prompt implies --no-prompt - --no-prompt alone retains backward-compatible default-using behavior Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- cli/azd/cmd/auto_install.go | 23 ++- cli/azd/cmd/auto_install_test.go | 106 ++++++++----- cli/azd/cmd/container.go | 2 +- cli/azd/cmd/external_prompt_test.go | 1 + cli/azd/cmd/testdata/TestFigSpec.ts | 5 + cli/azd/cmd/testdata/TestUsage-azd-add.snap | 1 + .../cmd/testdata/TestUsage-azd-ai-agent.snap | 1 + .../testdata/TestUsage-azd-ai-finetuning.snap | 1 + .../cmd/testdata/TestUsage-azd-ai-models.snap | 1 + cli/azd/cmd/testdata/TestUsage-azd-ai.snap | 1 + .../testdata/TestUsage-azd-appservice.snap | 1 + .../testdata/TestUsage-azd-auth-login.snap | 1 + .../testdata/TestUsage-azd-auth-logout.snap | 1 + .../testdata/TestUsage-azd-auth-status.snap | 1 + cli/azd/cmd/testdata/TestUsage-azd-auth.snap | 1 + .../testdata/TestUsage-azd-coding-agent.snap | 1 + .../TestUsage-azd-completion-bash.snap | 1 + .../TestUsage-azd-completion-fig.snap | 1 + .../TestUsage-azd-completion-fish.snap | 1 + .../TestUsage-azd-completion-powershell.snap | 1 + .../TestUsage-azd-completion-zsh.snap | 1 + .../testdata/TestUsage-azd-completion.snap | 1 + .../cmd/testdata/TestUsage-azd-concurx.snap | 1 + .../testdata/TestUsage-azd-config-get.snap | 1 + .../TestUsage-azd-config-list-alpha.snap | 1 + .../TestUsage-azd-config-options.snap | 1 + .../testdata/TestUsage-azd-config-reset.snap | 1 + .../testdata/TestUsage-azd-config-set.snap | 1 + .../testdata/TestUsage-azd-config-show.snap | 1 + .../testdata/TestUsage-azd-config-unset.snap | 1 + .../cmd/testdata/TestUsage-azd-config.snap | 1 + .../TestUsage-azd-copilot-consent-grant.snap | 1 + .../TestUsage-azd-copilot-consent-list.snap | 1 + .../TestUsage-azd-copilot-consent-revoke.snap | 1 + .../TestUsage-azd-copilot-consent.snap | 1 + .../cmd/testdata/TestUsage-azd-copilot.snap | 1 + cli/azd/cmd/testdata/TestUsage-azd-demo.snap | 1 + .../cmd/testdata/TestUsage-azd-deploy.snap | 11 +- cli/azd/cmd/testdata/TestUsage-azd-down.snap | 11 +- .../TestUsage-azd-env-config-get.snap | 11 +- .../TestUsage-azd-env-config-set.snap | 11 +- .../TestUsage-azd-env-config-unset.snap | 11 +- .../testdata/TestUsage-azd-env-config.snap | 1 + .../testdata/TestUsage-azd-env-get-value.snap | 11 +- .../TestUsage-azd-env-get-values.snap | 11 +- .../cmd/testdata/TestUsage-azd-env-list.snap | 1 + .../cmd/testdata/TestUsage-azd-env-new.snap | 1 + .../testdata/TestUsage-azd-env-refresh.snap | 11 +- .../testdata/TestUsage-azd-env-remove.snap | 11 +- .../testdata/TestUsage-azd-env-select.snap | 1 + .../TestUsage-azd-env-set-secret.snap | 11 +- .../cmd/testdata/TestUsage-azd-env-set.snap | 11 +- cli/azd/cmd/testdata/TestUsage-azd-env.snap | 1 + .../TestUsage-azd-extension-install.snap | 1 + .../TestUsage-azd-extension-list.snap | 1 + .../TestUsage-azd-extension-show.snap | 1 + .../TestUsage-azd-extension-source-add.snap | 1 + .../TestUsage-azd-extension-source-list.snap | 1 + ...TestUsage-azd-extension-source-remove.snap | 1 + ...stUsage-azd-extension-source-validate.snap | 1 + .../TestUsage-azd-extension-source.snap | 1 + .../TestUsage-azd-extension-uninstall.snap | 1 + .../TestUsage-azd-extension-upgrade.snap | 1 + .../cmd/testdata/TestUsage-azd-extension.snap | 1 + .../cmd/testdata/TestUsage-azd-hooks-run.snap | 11 +- cli/azd/cmd/testdata/TestUsage-azd-hooks.snap | 1 + .../TestUsage-azd-infra-generate.snap | 11 +- cli/azd/cmd/testdata/TestUsage-azd-infra.snap | 1 + cli/azd/cmd/testdata/TestUsage-azd-init.snap | 11 +- .../cmd/testdata/TestUsage-azd-mcp-start.snap | 1 + cli/azd/cmd/testdata/TestUsage-azd-mcp.snap | 1 + .../cmd/testdata/TestUsage-azd-monitor.snap | 11 +- .../cmd/testdata/TestUsage-azd-package.snap | 11 +- .../TestUsage-azd-pipeline-config.snap | 11 +- .../cmd/testdata/TestUsage-azd-pipeline.snap | 1 + .../cmd/testdata/TestUsage-azd-provision.snap | 11 +- .../cmd/testdata/TestUsage-azd-publish.snap | 11 +- .../cmd/testdata/TestUsage-azd-restore.snap | 11 +- cli/azd/cmd/testdata/TestUsage-azd-show.snap | 11 +- .../testdata/TestUsage-azd-template-list.snap | 1 + .../testdata/TestUsage-azd-template-show.snap | 1 + .../TestUsage-azd-template-source-add.snap | 1 + .../TestUsage-azd-template-source-list.snap | 1 + .../TestUsage-azd-template-source-remove.snap | 1 + .../TestUsage-azd-template-source.snap | 1 + .../cmd/testdata/TestUsage-azd-template.snap | 1 + cli/azd/cmd/testdata/TestUsage-azd-up.snap | 11 +- .../cmd/testdata/TestUsage-azd-version.snap | 1 + cli/azd/cmd/testdata/TestUsage-azd-x.snap | 1 + cli/azd/cmd/testdata/TestUsage-azd.snap | 1 + .../azure.ai.agents/internal/cmd/init.go | 2 + .../azure.ai.finetune/internal/cmd/init.go | 2 + .../internal/cmd/coding_agent_config.go | 2 +- cli/azd/internal/global_command_options.go | 5 + cli/azd/internal/repository/app_init_test.go | 1 + .../repository/detect_confirm_test.go | 1 + .../internal/repository/infra_confirm_test.go | 1 + cli/azd/internal/vsrpc/server_session.go | 2 +- cli/azd/pkg/input/asker.go | 50 +++++- cli/azd/pkg/input/asker_test.go | 148 +++++++++++++++++- cli/azd/pkg/input/console.go | 11 +- cli/azd/pkg/input/console_helpers_test.go | 2 + cli/azd/pkg/input/console_test.go | 4 + 103 files changed, 509 insertions(+), 164 deletions(-) diff --git a/cli/azd/cmd/auto_install.go b/cli/azd/cmd/auto_install.go index 73b0f698f3b..a0082383735 100644 --- a/cli/azd/cmd/auto_install.go +++ b/cli/azd/cmd/auto_install.go @@ -624,6 +624,11 @@ func CreateGlobalFlagSet() *pflag.FlagSet { false, "Alias for --no-prompt.") _ = globalFlags.MarkHidden("non-interactive") + globalFlags.Bool( + "fail-on-prompt", + false, + "Fails with an actionable error whenever a prompt is encountered, even if a default exists."+ + " Implies --no-prompt.") globalFlags.StringP(internal.EnvironmentNameFlagName, "e", "", "The name of the environment to use.") // The telemetry system is responsible for reading these flags value and using it to configure the telemetry @@ -725,10 +730,22 @@ func ParseGlobalFlags(args []string, opts *internal.GlobalCommandOptions) error } } - // Agent Detection: If no explicit flag or env var was set and we detect an AI coding - // agent as the caller, automatically enable no-prompt mode for non-interactive execution. - if !flagExplicitlySet && !envVarPresent && agentdetect.IsRunningInAgent() { + if boolVal, err := globalFlagSet.GetBool("fail-on-prompt"); err == nil { + opts.FailOnPrompt = boolVal + if boolVal { + // --fail-on-prompt implies --no-prompt + opts.NoPrompt = true + } + } + + // Agent Detection: If --no-prompt was not explicitly set and we detect an AI coding agent + // as the caller, automatically enable fail-on-prompt mode for strict non-interactive execution. + failOnPromptFlag := globalFlagSet.Lookup("fail-on-prompt") + failOnPromptExplicitlySet := failOnPromptFlag != nil && failOnPromptFlag.Changed + if !flagExplicitlySet && !failOnPromptExplicitlySet && + !envVarPresent && agentdetect.IsRunningInAgent() { opts.NoPrompt = true + opts.FailOnPrompt = true } return nil diff --git a/cli/azd/cmd/auto_install_test.go b/cli/azd/cmd/auto_install_test.go index 5875e005ada..847bd459f33 100644 --- a/cli/azd/cmd/auto_install_test.go +++ b/cli/azd/cmd/auto_install_test.go @@ -340,58 +340,90 @@ func TestCheckForMatchingExtension_Unit(t *testing.T) { func TestParseGlobalFlags_AgentDetection(t *testing.T) { tests := []struct { - name string - args []string - envVars map[string]string - expectedNoPrompt bool + name string + args []string + envVars map[string]string + expectedNoPrompt bool + expectedFailOnPrompt bool }{ { - name: "no agent detected, no flag", - args: []string{"up"}, - envVars: map[string]string{}, - expectedNoPrompt: false, + name: "no agent detected, no flag", + args: []string{"up"}, + envVars: map[string]string{}, + expectedNoPrompt: false, + expectedFailOnPrompt: false, }, { - name: "agent detected via env var, no flag", - args: []string{"up"}, - envVars: map[string]string{"CLAUDE_CODE": "1"}, - expectedNoPrompt: true, + name: "agent detected via env var, no flag", + args: []string{"up"}, + envVars: map[string]string{"CLAUDE_CODE": "1"}, + expectedNoPrompt: true, + expectedFailOnPrompt: true, }, { - name: "agent detected but --no-prompt=false explicitly set", - args: []string{"--no-prompt=false", "up"}, - envVars: map[string]string{"CLAUDE_CODE": "1"}, - expectedNoPrompt: false, + name: "agent detected but --no-prompt=false explicitly set", + args: []string{"--no-prompt=false", "up"}, + envVars: map[string]string{"CLAUDE_CODE": "1"}, + expectedNoPrompt: false, + expectedFailOnPrompt: false, }, { - name: "agent detected but --no-prompt explicitly set true", - args: []string{"--no-prompt", "up"}, - envVars: map[string]string{"GEMINI_CLI": "1"}, - expectedNoPrompt: true, + name: "agent detected but --no-prompt explicitly set true", + args: []string{"--no-prompt", "up"}, + envVars: map[string]string{"GEMINI_CLI": "1"}, + expectedNoPrompt: true, + expectedFailOnPrompt: false, }, { - name: "no agent, --no-prompt explicitly set", - args: []string{"--no-prompt", "deploy"}, - envVars: map[string]string{}, - expectedNoPrompt: true, + name: "no agent, --no-prompt explicitly set", + args: []string{"--no-prompt", "deploy"}, + envVars: map[string]string{}, + expectedNoPrompt: true, + expectedFailOnPrompt: false, }, { - name: "Gemini agent detected", - args: []string{"init"}, - envVars: map[string]string{"GEMINI_CLI": "1"}, - expectedNoPrompt: true, + name: "Gemini agent detected", + args: []string{"init"}, + envVars: map[string]string{"GEMINI_CLI": "1"}, + expectedNoPrompt: true, + expectedFailOnPrompt: true, }, { - name: "GitHub Copilot CLI agent detected", - args: []string{"deploy"}, - envVars: map[string]string{"GITHUB_COPILOT_CLI": "true"}, - expectedNoPrompt: true, + name: "GitHub Copilot CLI agent detected", + args: []string{"deploy"}, + envVars: map[string]string{"GITHUB_COPILOT_CLI": "true"}, + expectedNoPrompt: true, + expectedFailOnPrompt: true, }, { - name: "OpenCode agent detected", - args: []string{"provision"}, - envVars: map[string]string{"OPENCODE": "1"}, - expectedNoPrompt: true, + name: "OpenCode agent detected", + args: []string{"provision"}, + envVars: map[string]string{"OPENCODE": "1"}, + expectedNoPrompt: true, + expectedFailOnPrompt: true, + }, + { + name: "fail-on-prompt flag implies no-prompt", + args: []string{"--fail-on-prompt", "up"}, + envVars: map[string]string{}, + expectedNoPrompt: true, + expectedFailOnPrompt: true, + }, + { + name: "no-prompt alone does not set fail-on-prompt", + args: []string{"--no-prompt", "up"}, + envVars: map[string]string{}, + expectedNoPrompt: true, + expectedFailOnPrompt: false, + }, + { + name: "fail-on-prompt explicit overrides agent detection", + args: []string{"--fail-on-prompt", "up"}, + envVars: map[string]string{ + "CLAUDE_CODE": "1", + }, + expectedNoPrompt: true, + expectedFailOnPrompt: true, }, } @@ -422,6 +454,8 @@ func TestParseGlobalFlags_AgentDetection(t *testing.T) { assert.Equal(t, tt.expectedNoPrompt, opts.NoPrompt, "NoPrompt should be %v for test case: %s", tt.expectedNoPrompt, tt.name) + assert.Equal(t, tt.expectedFailOnPrompt, opts.FailOnPrompt, + "FailOnPrompt should be %v for test case: %s", tt.expectedFailOnPrompt, tt.name) // Clean up for next test agentdetect.ResetDetection() diff --git a/cli/azd/cmd/container.go b/cli/azd/cmd/container.go index 4593a80218c..09046df261d 100644 --- a/cli/azd/cmd/container.go +++ b/cli/azd/cmd/container.go @@ -150,7 +150,7 @@ func registerCommonDependencies(container *ioc.NestedContainer) { } } - return input.NewConsole(rootOptions.NoPrompt, isTerminal, input.Writers{Output: writer}, input.ConsoleHandles{ + return input.NewConsole(rootOptions.NoPrompt, rootOptions.FailOnPrompt, isTerminal, input.Writers{Output: writer}, input.ConsoleHandles{ Stdin: cmd.InOrStdin(), Stdout: cmd.OutOrStdout(), Stderr: cmd.ErrOrStderr(), diff --git a/cli/azd/cmd/external_prompt_test.go b/cli/azd/cmd/external_prompt_test.go index 2425fc291ce..e3f5302ff9f 100644 --- a/cli/azd/cmd/external_prompt_test.go +++ b/cli/azd/cmd/external_prompt_test.go @@ -79,6 +79,7 @@ func TestExternalPromptFromEnvironmentVariables(t *testing.T) { // Create the console with external prompting configured console := input.NewConsole( rootOptions.NoPrompt, + rootOptions.FailOnPrompt, isTerminal, input.Writers{Output: writer}, input.ConsoleHandles{ diff --git a/cli/azd/cmd/testdata/TestFigSpec.ts b/cli/azd/cmd/testdata/TestFigSpec.ts index 8dce57c192c..b9d316d8d75 100644 --- a/cli/azd/cmd/testdata/TestFigSpec.ts +++ b/cli/azd/cmd/testdata/TestFigSpec.ts @@ -3508,6 +3508,11 @@ const completionSpec: Fig.Spec = { }, ], }, + { + name: ['--fail-on-prompt'], + description: 'Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt.', + isPersistent: true, + }, { name: ['--no-prompt'], description: 'Accepts the default value instead of prompting, or it fails if there is no default.', diff --git a/cli/azd/cmd/testdata/TestUsage-azd-add.snap b/cli/azd/cmd/testdata/TestUsage-azd-add.snap index 11209d07544..c87eb3a14dd 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-add.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-add.snap @@ -9,6 +9,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd add in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for add. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-ai-agent.snap b/cli/azd/cmd/testdata/TestUsage-azd-ai-agent.snap index e62da61e30b..32181eac312 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-ai-agent.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-ai-agent.snap @@ -9,6 +9,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd ai agent in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for agent. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-ai-finetuning.snap b/cli/azd/cmd/testdata/TestUsage-azd-ai-finetuning.snap index 2d078b0f730..c6451d39694 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-ai-finetuning.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-ai-finetuning.snap @@ -9,6 +9,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd ai finetuning in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for finetuning. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-ai-models.snap b/cli/azd/cmd/testdata/TestUsage-azd-ai-models.snap index d1327bec7f6..6e73868a78d 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-ai-models.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-ai-models.snap @@ -9,6 +9,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd ai models in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for models. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-ai.snap b/cli/azd/cmd/testdata/TestUsage-azd-ai.snap index b7cba1c07ba..7a86874d0ca 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-ai.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-ai.snap @@ -14,6 +14,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd ai in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for ai. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-appservice.snap b/cli/azd/cmd/testdata/TestUsage-azd-appservice.snap index 316fd405aac..4af3abc9059 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-appservice.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-appservice.snap @@ -9,6 +9,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd appservice in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for appservice. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-auth-login.snap b/cli/azd/cmd/testdata/TestUsage-azd-auth-login.snap index 8cc44be7014..f77405fe827 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-auth-login.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-auth-login.snap @@ -20,6 +20,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd auth login in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for login. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-auth-logout.snap b/cli/azd/cmd/testdata/TestUsage-azd-auth-logout.snap index d9087aac6cd..4544c058148 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-auth-logout.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-auth-logout.snap @@ -9,6 +9,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd auth logout in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for logout. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-auth-status.snap b/cli/azd/cmd/testdata/TestUsage-azd-auth-status.snap index cc345fc049c..42c0b15ce7e 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-auth-status.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-auth-status.snap @@ -9,6 +9,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd auth status in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for status. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-auth.snap b/cli/azd/cmd/testdata/TestUsage-azd-auth.snap index 9729ccd7ddb..87bb92d7e59 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-auth.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-auth.snap @@ -14,6 +14,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd auth in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for auth. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-coding-agent.snap b/cli/azd/cmd/testdata/TestUsage-azd-coding-agent.snap index 061ae82d4ce..c3d29b3ec4d 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-coding-agent.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-coding-agent.snap @@ -9,6 +9,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd coding-agent in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for coding-agent. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-completion-bash.snap b/cli/azd/cmd/testdata/TestUsage-azd-completion-bash.snap index cf52d0c75e0..4381946d06a 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-completion-bash.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-completion-bash.snap @@ -12,6 +12,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd completion bash in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for bash. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-completion-fig.snap b/cli/azd/cmd/testdata/TestUsage-azd-completion-fig.snap index ec79fe09e40..5bbbbeb2769 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-completion-fig.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-completion-fig.snap @@ -9,6 +9,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd completion fig in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for fig. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-completion-fish.snap b/cli/azd/cmd/testdata/TestUsage-azd-completion-fish.snap index 8b9098a5ad5..d2fd2310284 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-completion-fish.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-completion-fish.snap @@ -9,6 +9,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd completion fish in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for fish. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-completion-powershell.snap b/cli/azd/cmd/testdata/TestUsage-azd-completion-powershell.snap index 9fd63435228..1612a4ce62e 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-completion-powershell.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-completion-powershell.snap @@ -9,6 +9,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd completion powershell in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for powershell. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-completion-zsh.snap b/cli/azd/cmd/testdata/TestUsage-azd-completion-zsh.snap index 1963126b802..a3ea19d974f 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-completion-zsh.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-completion-zsh.snap @@ -13,6 +13,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd completion zsh in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for zsh. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-completion.snap b/cli/azd/cmd/testdata/TestUsage-azd-completion.snap index 36db73ecdee..be910b93be3 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-completion.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-completion.snap @@ -16,6 +16,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd completion in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for completion. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-concurx.snap b/cli/azd/cmd/testdata/TestUsage-azd-concurx.snap index 8e8936fc252..e0b76672a27 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-concurx.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-concurx.snap @@ -9,6 +9,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd concurx in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for concurx. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-config-get.snap b/cli/azd/cmd/testdata/TestUsage-azd-config-get.snap index 33fdd98a47c..c7cfb9f030c 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-config-get.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-config-get.snap @@ -9,6 +9,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd config get in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for get. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-config-list-alpha.snap b/cli/azd/cmd/testdata/TestUsage-azd-config-list-alpha.snap index 0094122eaf0..e7f97812c84 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-config-list-alpha.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-config-list-alpha.snap @@ -9,6 +9,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd config list-alpha in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for list-alpha. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-config-options.snap b/cli/azd/cmd/testdata/TestUsage-azd-config-options.snap index 8fa858952df..4315ff971ec 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-config-options.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-config-options.snap @@ -9,6 +9,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd config options in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for options. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-config-reset.snap b/cli/azd/cmd/testdata/TestUsage-azd-config-reset.snap index 83c41f51be0..5897dc3a9e8 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-config-reset.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-config-reset.snap @@ -12,6 +12,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd config reset in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for reset. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-config-set.snap b/cli/azd/cmd/testdata/TestUsage-azd-config-set.snap index 1c0bf8acbb3..8eb0fc7743c 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-config-set.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-config-set.snap @@ -9,6 +9,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd config set in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for set. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-config-show.snap b/cli/azd/cmd/testdata/TestUsage-azd-config-show.snap index 518483f35ea..1414de1b579 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-config-show.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-config-show.snap @@ -9,6 +9,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd config show in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for show. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-config-unset.snap b/cli/azd/cmd/testdata/TestUsage-azd-config-unset.snap index 14bc744972c..f97dbb04acb 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-config-unset.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-config-unset.snap @@ -9,6 +9,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd config unset in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for unset. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-config.snap b/cli/azd/cmd/testdata/TestUsage-azd-config.snap index c6812a024f5..d29ec5d111b 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-config.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-config.snap @@ -22,6 +22,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd config in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for config. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-copilot-consent-grant.snap b/cli/azd/cmd/testdata/TestUsage-azd-copilot-consent-grant.snap index 0d99f6023b7..7134ad3b708 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-copilot-consent-grant.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-copilot-consent-grant.snap @@ -18,6 +18,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd copilot consent grant in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for grant. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-copilot-consent-list.snap b/cli/azd/cmd/testdata/TestUsage-azd-copilot-consent-list.snap index c013ceb8351..de6fd7947d7 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-copilot-consent-list.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-copilot-consent-list.snap @@ -16,6 +16,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd copilot consent list in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for list. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-copilot-consent-revoke.snap b/cli/azd/cmd/testdata/TestUsage-azd-copilot-consent-revoke.snap index 472b67e4119..269a841d3b5 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-copilot-consent-revoke.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-copilot-consent-revoke.snap @@ -16,6 +16,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd copilot consent revoke in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for revoke. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-copilot-consent.snap b/cli/azd/cmd/testdata/TestUsage-azd-copilot-consent.snap index 752b63165da..fd7c46e1b9b 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-copilot-consent.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-copilot-consent.snap @@ -14,6 +14,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd copilot consent in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for consent. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-copilot.snap b/cli/azd/cmd/testdata/TestUsage-azd-copilot.snap index 337ebacf80f..b5dcb796650 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-copilot.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-copilot.snap @@ -12,6 +12,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd copilot in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for copilot. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-demo.snap b/cli/azd/cmd/testdata/TestUsage-azd-demo.snap index e55fe63154a..8d8f255bbe5 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-demo.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-demo.snap @@ -9,6 +9,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd demo in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for demo. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-deploy.snap b/cli/azd/cmd/testdata/TestUsage-azd-deploy.snap index 9affa80b9e2..4c48b027a63 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-deploy.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-deploy.snap @@ -15,11 +15,12 @@ Flags --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) Global Flags - -C, --cwd string : Sets the current working directory. - --debug : Enables debugging and diagnostics logging. - --docs : Opens the documentation for azd deploy in your web browser. - -h, --help : Gets help for deploy. - --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. + -C, --cwd string : Sets the current working directory. + --debug : Enables debugging and diagnostics logging. + --docs : Opens the documentation for azd deploy in your web browser. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. + -h, --help : Gets help for deploy. + --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. Examples Deploy all services in the current project to Azure. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-down.snap b/cli/azd/cmd/testdata/TestUsage-azd-down.snap index 24a88a1d10f..4afdd9d7637 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-down.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-down.snap @@ -12,11 +12,12 @@ Flags --purge : Does not require confirmation before it permanently deletes resources that are soft-deleted by default (for example, key vaults). Global Flags - -C, --cwd string : Sets the current working directory. - --debug : Enables debugging and diagnostics logging. - --docs : Opens the documentation for azd down in your web browser. - -h, --help : Gets help for down. - --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. + -C, --cwd string : Sets the current working directory. + --debug : Enables debugging and diagnostics logging. + --docs : Opens the documentation for azd down in your web browser. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. + -h, --help : Gets help for down. + --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. Examples Delete all resources for an application. You will be prompted to confirm your decision. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-env-config-get.snap b/cli/azd/cmd/testdata/TestUsage-azd-env-config-get.snap index e0f5e0b8ca3..6686ce80b5c 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-env-config-get.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-env-config-get.snap @@ -8,11 +8,12 @@ Flags -e, --environment string : The name of the environment to use. Global Flags - -C, --cwd string : Sets the current working directory. - --debug : Enables debugging and diagnostics logging. - --docs : Opens the documentation for azd env config get in your web browser. - -h, --help : Gets help for get. - --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. + -C, --cwd string : Sets the current working directory. + --debug : Enables debugging and diagnostics logging. + --docs : Opens the documentation for azd env config get in your web browser. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. + -h, --help : Gets help for get. + --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-env-config-set.snap b/cli/azd/cmd/testdata/TestUsage-azd-env-config-set.snap index 1f9f91d4086..06eac800882 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-env-config-set.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-env-config-set.snap @@ -8,11 +8,12 @@ Flags -e, --environment string : The name of the environment to use. Global Flags - -C, --cwd string : Sets the current working directory. - --debug : Enables debugging and diagnostics logging. - --docs : Opens the documentation for azd env config set in your web browser. - -h, --help : Gets help for set. - --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. + -C, --cwd string : Sets the current working directory. + --debug : Enables debugging and diagnostics logging. + --docs : Opens the documentation for azd env config set in your web browser. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. + -h, --help : Gets help for set. + --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-env-config-unset.snap b/cli/azd/cmd/testdata/TestUsage-azd-env-config-unset.snap index 8d6934bfcef..6d48c3812be 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-env-config-unset.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-env-config-unset.snap @@ -8,11 +8,12 @@ Flags -e, --environment string : The name of the environment to use. Global Flags - -C, --cwd string : Sets the current working directory. - --debug : Enables debugging and diagnostics logging. - --docs : Opens the documentation for azd env config unset in your web browser. - -h, --help : Gets help for unset. - --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. + -C, --cwd string : Sets the current working directory. + --debug : Enables debugging and diagnostics logging. + --docs : Opens the documentation for azd env config unset in your web browser. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. + -h, --help : Gets help for unset. + --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-env-config.snap b/cli/azd/cmd/testdata/TestUsage-azd-env-config.snap index 1d45f651488..5ee3f034a1a 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-env-config.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-env-config.snap @@ -18,6 +18,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd env config in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for config. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-env-get-value.snap b/cli/azd/cmd/testdata/TestUsage-azd-env-get-value.snap index fc6d79d8ef2..a8ed464d4ad 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-env-get-value.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-env-get-value.snap @@ -8,11 +8,12 @@ Flags -e, --environment string : The name of the environment to use. Global Flags - -C, --cwd string : Sets the current working directory. - --debug : Enables debugging and diagnostics logging. - --docs : Opens the documentation for azd env get-value in your web browser. - -h, --help : Gets help for get-value. - --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. + -C, --cwd string : Sets the current working directory. + --debug : Enables debugging and diagnostics logging. + --docs : Opens the documentation for azd env get-value in your web browser. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. + -h, --help : Gets help for get-value. + --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-env-get-values.snap b/cli/azd/cmd/testdata/TestUsage-azd-env-get-values.snap index 7c8296ba56d..db3517b4389 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-env-get-values.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-env-get-values.snap @@ -8,11 +8,12 @@ Flags -e, --environment string : The name of the environment to use. Global Flags - -C, --cwd string : Sets the current working directory. - --debug : Enables debugging and diagnostics logging. - --docs : Opens the documentation for azd env get-values in your web browser. - -h, --help : Gets help for get-values. - --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. + -C, --cwd string : Sets the current working directory. + --debug : Enables debugging and diagnostics logging. + --docs : Opens the documentation for azd env get-values in your web browser. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. + -h, --help : Gets help for get-values. + --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-env-list.snap b/cli/azd/cmd/testdata/TestUsage-azd-env-list.snap index abadf8f0286..f9de285d4ad 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-env-list.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-env-list.snap @@ -9,6 +9,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd env list in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for list. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-env-new.snap b/cli/azd/cmd/testdata/TestUsage-azd-env-new.snap index 5ff6986685b..5b5d1393c74 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-env-new.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-env-new.snap @@ -13,6 +13,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd env new in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for new. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-env-refresh.snap b/cli/azd/cmd/testdata/TestUsage-azd-env-refresh.snap index 786ba5faf86..7e7c27cb464 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-env-refresh.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-env-refresh.snap @@ -10,11 +10,12 @@ Flags --layer string : Provisioning layer to refresh the environment from. Global Flags - -C, --cwd string : Sets the current working directory. - --debug : Enables debugging and diagnostics logging. - --docs : Opens the documentation for azd env refresh in your web browser. - -h, --help : Gets help for refresh. - --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. + -C, --cwd string : Sets the current working directory. + --debug : Enables debugging and diagnostics logging. + --docs : Opens the documentation for azd env refresh in your web browser. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. + -h, --help : Gets help for refresh. + --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-env-remove.snap b/cli/azd/cmd/testdata/TestUsage-azd-env-remove.snap index 06a4ffc0f84..ce9b4e5b2d1 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-env-remove.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-env-remove.snap @@ -12,11 +12,12 @@ Flags --force : Skips confirmation before performing removal. Global Flags - -C, --cwd string : Sets the current working directory. - --debug : Enables debugging and diagnostics logging. - --docs : Opens the documentation for azd env remove in your web browser. - -h, --help : Gets help for remove. - --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. + -C, --cwd string : Sets the current working directory. + --debug : Enables debugging and diagnostics logging. + --docs : Opens the documentation for azd env remove in your web browser. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. + -h, --help : Gets help for remove. + --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-env-select.snap b/cli/azd/cmd/testdata/TestUsage-azd-env-select.snap index 65b2075488f..fb045dfd8f9 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-env-select.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-env-select.snap @@ -9,6 +9,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd env select in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for select. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-env-set-secret.snap b/cli/azd/cmd/testdata/TestUsage-azd-env-set-secret.snap index 6fa73e3fa94..5e805704e58 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-env-set-secret.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-env-set-secret.snap @@ -8,11 +8,12 @@ Flags -e, --environment string : The name of the environment to use. Global Flags - -C, --cwd string : Sets the current working directory. - --debug : Enables debugging and diagnostics logging. - --docs : Opens the documentation for azd env set-secret in your web browser. - -h, --help : Gets help for set-secret. - --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. + -C, --cwd string : Sets the current working directory. + --debug : Enables debugging and diagnostics logging. + --docs : Opens the documentation for azd env set-secret in your web browser. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. + -h, --help : Gets help for set-secret. + --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-env-set.snap b/cli/azd/cmd/testdata/TestUsage-azd-env-set.snap index 038d32ce199..67fceaa283e 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-env-set.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-env-set.snap @@ -9,11 +9,12 @@ Flags --file string : Path to .env formatted file to load environment values from. Global Flags - -C, --cwd string : Sets the current working directory. - --debug : Enables debugging and diagnostics logging. - --docs : Opens the documentation for azd env set in your web browser. - -h, --help : Gets help for set. - --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. + -C, --cwd string : Sets the current working directory. + --debug : Enables debugging and diagnostics logging. + --docs : Opens the documentation for azd env set in your web browser. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. + -h, --help : Gets help for set. + --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-env.snap b/cli/azd/cmd/testdata/TestUsage-azd-env.snap index 78060906ebe..fff45bb8bfc 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-env.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-env.snap @@ -26,6 +26,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd env in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for env. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-extension-install.snap b/cli/azd/cmd/testdata/TestUsage-azd-extension-install.snap index 5992ce8d59f..940fe467882 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-extension-install.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-extension-install.snap @@ -14,6 +14,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd extension install in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for install. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-extension-list.snap b/cli/azd/cmd/testdata/TestUsage-azd-extension-list.snap index 6b036f31527..417a17451bd 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-extension-list.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-extension-list.snap @@ -14,6 +14,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd extension list in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for list. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-extension-show.snap b/cli/azd/cmd/testdata/TestUsage-azd-extension-show.snap index 5be9f3a34e6..c0fd325e0a5 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-extension-show.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-extension-show.snap @@ -12,6 +12,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd extension show in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for show. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-extension-source-add.snap b/cli/azd/cmd/testdata/TestUsage-azd-extension-source-add.snap index 94783cf2ed0..23bf1b38943 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-extension-source-add.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-extension-source-add.snap @@ -14,6 +14,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd extension source add in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for add. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-extension-source-list.snap b/cli/azd/cmd/testdata/TestUsage-azd-extension-source-list.snap index c7f3f5d83aa..073f52f49af 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-extension-source-list.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-extension-source-list.snap @@ -9,6 +9,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd extension source list in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for list. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-extension-source-remove.snap b/cli/azd/cmd/testdata/TestUsage-azd-extension-source-remove.snap index 8fc14987e22..bcd02df5fe4 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-extension-source-remove.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-extension-source-remove.snap @@ -9,6 +9,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd extension source remove in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for remove. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-extension-source-validate.snap b/cli/azd/cmd/testdata/TestUsage-azd-extension-source-validate.snap index e8aadf6bbd2..f1c8e6a3fe8 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-extension-source-validate.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-extension-source-validate.snap @@ -12,6 +12,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd extension source validate in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for validate. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-extension-source.snap b/cli/azd/cmd/testdata/TestUsage-azd-extension-source.snap index 706d16fb3ea..d3cdbb45e91 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-extension-source.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-extension-source.snap @@ -15,6 +15,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd extension source in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for source. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-extension-uninstall.snap b/cli/azd/cmd/testdata/TestUsage-azd-extension-uninstall.snap index 2f5362e7d64..3d45250250c 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-extension-uninstall.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-extension-uninstall.snap @@ -12,6 +12,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd extension uninstall in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for uninstall. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-extension-upgrade.snap b/cli/azd/cmd/testdata/TestUsage-azd-extension-upgrade.snap index aa0c8a0bc75..8d185283edf 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-extension-upgrade.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-extension-upgrade.snap @@ -14,6 +14,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd extension upgrade in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for upgrade. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-extension.snap b/cli/azd/cmd/testdata/TestUsage-azd-extension.snap index e22ac3e811b..942579e4667 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-extension.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-extension.snap @@ -17,6 +17,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd extension in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for extension. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-hooks-run.snap b/cli/azd/cmd/testdata/TestUsage-azd-hooks-run.snap index e51a58ac200..d54332b258a 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-hooks-run.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-hooks-run.snap @@ -11,11 +11,12 @@ Flags --service string : Only runs hooks for the specified service. Global Flags - -C, --cwd string : Sets the current working directory. - --debug : Enables debugging and diagnostics logging. - --docs : Opens the documentation for azd hooks run in your web browser. - -h, --help : Gets help for run. - --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. + -C, --cwd string : Sets the current working directory. + --debug : Enables debugging and diagnostics logging. + --docs : Opens the documentation for azd hooks run in your web browser. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. + -h, --help : Gets help for run. + --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-hooks.snap b/cli/azd/cmd/testdata/TestUsage-azd-hooks.snap index 04694438fdb..9e1db1fddc7 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-hooks.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-hooks.snap @@ -12,6 +12,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd hooks in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for hooks. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-infra-generate.snap b/cli/azd/cmd/testdata/TestUsage-azd-infra-generate.snap index 8316acc388b..735b340413f 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-infra-generate.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-infra-generate.snap @@ -9,11 +9,12 @@ Flags --force : Overwrite any existing files without prompting Global Flags - -C, --cwd string : Sets the current working directory. - --debug : Enables debugging and diagnostics logging. - --docs : Opens the documentation for azd infra generate in your web browser. - -h, --help : Gets help for generate. - --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. + -C, --cwd string : Sets the current working directory. + --debug : Enables debugging and diagnostics logging. + --docs : Opens the documentation for azd infra generate in your web browser. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. + -h, --help : Gets help for generate. + --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-infra.snap b/cli/azd/cmd/testdata/TestUsage-azd-infra.snap index baa85b98824..328bf9c7265 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-infra.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-infra.snap @@ -12,6 +12,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd infra in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for infra. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-init.snap b/cli/azd/cmd/testdata/TestUsage-azd-init.snap index 7f09a7a7188..a3cd8efd0a6 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-init.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-init.snap @@ -19,11 +19,12 @@ Flags --up : Provision and deploy to Azure after initializing the project from a template. Global Flags - -C, --cwd string : Sets the current working directory. - --debug : Enables debugging and diagnostics logging. - --docs : Opens the documentation for azd init in your web browser. - -h, --help : Gets help for init. - --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. + -C, --cwd string : Sets the current working directory. + --debug : Enables debugging and diagnostics logging. + --docs : Opens the documentation for azd init in your web browser. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. + -h, --help : Gets help for init. + --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. Examples Initialize a template to your current local directory from a GitHub repo. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-mcp-start.snap b/cli/azd/cmd/testdata/TestUsage-azd-mcp-start.snap index e939d3cd760..582692ba1f7 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-mcp-start.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-mcp-start.snap @@ -9,6 +9,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd mcp start in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for start. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-mcp.snap b/cli/azd/cmd/testdata/TestUsage-azd-mcp.snap index f4ffa5d3f99..4b405b181e0 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-mcp.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-mcp.snap @@ -12,6 +12,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd mcp in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for mcp. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-monitor.snap b/cli/azd/cmd/testdata/TestUsage-azd-monitor.snap index b3a61421a00..8775592c866 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-monitor.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-monitor.snap @@ -11,11 +11,12 @@ Flags --overview : Open a browser to Application Insights Overview Dashboard. Global Flags - -C, --cwd string : Sets the current working directory. - --debug : Enables debugging and diagnostics logging. - --docs : Opens the documentation for azd monitor in your web browser. - -h, --help : Gets help for monitor. - --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. + -C, --cwd string : Sets the current working directory. + --debug : Enables debugging and diagnostics logging. + --docs : Opens the documentation for azd monitor in your web browser. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. + -h, --help : Gets help for monitor. + --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. Examples Open Application Insights Live Metrics. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-package.snap b/cli/azd/cmd/testdata/TestUsage-azd-package.snap index 46e5ed27b47..1e3e3a2ee8d 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-package.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-package.snap @@ -14,11 +14,12 @@ Flags --output-path string : File or folder path where the generated packages will be saved. Global Flags - -C, --cwd string : Sets the current working directory. - --debug : Enables debugging and diagnostics logging. - --docs : Opens the documentation for azd package in your web browser. - -h, --help : Gets help for package. - --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. + -C, --cwd string : Sets the current working directory. + --debug : Enables debugging and diagnostics logging. + --docs : Opens the documentation for azd package in your web browser. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. + -h, --help : Gets help for package. + --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. Examples Packages all services in the current project to Azure. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-pipeline-config.snap b/cli/azd/cmd/testdata/TestUsage-azd-pipeline-config.snap index 00371f49934..fc63bf5285f 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-pipeline-config.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-pipeline-config.snap @@ -19,11 +19,12 @@ Flags --remote-name string : The name of the git remote to configure the pipeline to run on. Global Flags - -C, --cwd string : Sets the current working directory. - --debug : Enables debugging and diagnostics logging. - --docs : Opens the documentation for azd pipeline config in your web browser. - -h, --help : Gets help for config. - --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. + -C, --cwd string : Sets the current working directory. + --debug : Enables debugging and diagnostics logging. + --docs : Opens the documentation for azd pipeline config in your web browser. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. + -h, --help : Gets help for config. + --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. Examples Configure a deployment pipeline for 'app-test' environment diff --git a/cli/azd/cmd/testdata/TestUsage-azd-pipeline.snap b/cli/azd/cmd/testdata/TestUsage-azd-pipeline.snap index d6a04b90891..eeda0fced80 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-pipeline.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-pipeline.snap @@ -16,6 +16,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd pipeline in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for pipeline. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-provision.snap b/cli/azd/cmd/testdata/TestUsage-azd-provision.snap index 7f18fcae373..c26fe558a7c 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-provision.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-provision.snap @@ -26,11 +26,12 @@ Flags --subscription string : ID of an Azure subscription to use for the new environment Global Flags - -C, --cwd string : Sets the current working directory. - --debug : Enables debugging and diagnostics logging. - --docs : Opens the documentation for azd provision in your web browser. - -h, --help : Gets help for provision. - --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. + -C, --cwd string : Sets the current working directory. + --debug : Enables debugging and diagnostics logging. + --docs : Opens the documentation for azd provision in your web browser. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. + -h, --help : Gets help for provision. + --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-publish.snap b/cli/azd/cmd/testdata/TestUsage-azd-publish.snap index 18b42fc6577..34a523c8a13 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-publish.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-publish.snap @@ -15,11 +15,12 @@ Flags --to string : The target container image in the form '[registry/]repository[:tag]' to publish to. Global Flags - -C, --cwd string : Sets the current working directory. - --debug : Enables debugging and diagnostics logging. - --docs : Opens the documentation for azd publish in your web browser. - -h, --help : Gets help for publish. - --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. + -C, --cwd string : Sets the current working directory. + --debug : Enables debugging and diagnostics logging. + --docs : Opens the documentation for azd publish in your web browser. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. + -h, --help : Gets help for publish. + --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. Examples Publish all services in the current project. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-restore.snap b/cli/azd/cmd/testdata/TestUsage-azd-restore.snap index 7c571438a97..2a1aca9bb41 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-restore.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-restore.snap @@ -12,11 +12,12 @@ Flags -e, --environment string : The name of the environment to use. Global Flags - -C, --cwd string : Sets the current working directory. - --debug : Enables debugging and diagnostics logging. - --docs : Opens the documentation for azd restore in your web browser. - -h, --help : Gets help for restore. - --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. + -C, --cwd string : Sets the current working directory. + --debug : Enables debugging and diagnostics logging. + --docs : Opens the documentation for azd restore in your web browser. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. + -h, --help : Gets help for restore. + --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. Examples Downloads and installs a specific application service dependency, Individual services are listed in your azure.yaml file. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-show.snap b/cli/azd/cmd/testdata/TestUsage-azd-show.snap index 45c2db40117..e6166165a7d 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-show.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-show.snap @@ -9,11 +9,12 @@ Flags --show-secrets : Unmask secrets in output. Global Flags - -C, --cwd string : Sets the current working directory. - --debug : Enables debugging and diagnostics logging. - --docs : Opens the documentation for azd show in your web browser. - -h, --help : Gets help for show. - --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. + -C, --cwd string : Sets the current working directory. + --debug : Enables debugging and diagnostics logging. + --docs : Opens the documentation for azd show in your web browser. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. + -h, --help : Gets help for show. + --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-template-list.snap b/cli/azd/cmd/testdata/TestUsage-azd-template-list.snap index cce5d2055db..0adf63e39f3 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-template-list.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-template-list.snap @@ -13,6 +13,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd template list in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for list. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-template-show.snap b/cli/azd/cmd/testdata/TestUsage-azd-template-show.snap index e45f70a8d12..b90578bc030 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-template-show.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-template-show.snap @@ -9,6 +9,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd template show in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for show. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-template-source-add.snap b/cli/azd/cmd/testdata/TestUsage-azd-template-source-add.snap index 193f36d47d4..2ce6dfce59c 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-template-source-add.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-template-source-add.snap @@ -18,6 +18,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd template source add in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for add. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-template-source-list.snap b/cli/azd/cmd/testdata/TestUsage-azd-template-source-list.snap index b7c111e7255..fe106b4893e 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-template-source-list.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-template-source-list.snap @@ -9,6 +9,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd template source list in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for list. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-template-source-remove.snap b/cli/azd/cmd/testdata/TestUsage-azd-template-source-remove.snap index 2949735e5ed..2505bb0317c 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-template-source-remove.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-template-source-remove.snap @@ -9,6 +9,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd template source remove in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for remove. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-template-source.snap b/cli/azd/cmd/testdata/TestUsage-azd-template-source.snap index 7d938010bb6..ae756ee9c28 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-template-source.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-template-source.snap @@ -17,6 +17,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd template source in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for source. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-template.snap b/cli/azd/cmd/testdata/TestUsage-azd-template.snap index 3042858f24c..275124c19dc 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-template.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-template.snap @@ -18,6 +18,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd template in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for template. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-up.snap b/cli/azd/cmd/testdata/TestUsage-azd-up.snap index be5be60fa75..a8b22b1d6ae 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-up.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-up.snap @@ -35,11 +35,12 @@ Flags --subscription string : ID of an Azure subscription to use for the new environment Global Flags - -C, --cwd string : Sets the current working directory. - --debug : Enables debugging and diagnostics logging. - --docs : Opens the documentation for azd up in your web browser. - -h, --help : Gets help for up. - --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. + -C, --cwd string : Sets the current working directory. + --debug : Enables debugging and diagnostics logging. + --docs : Opens the documentation for azd up in your web browser. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. + -h, --help : Gets help for up. + --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-version.snap b/cli/azd/cmd/testdata/TestUsage-azd-version.snap index 7a7656aebc8..c5b385c7545 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-version.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-version.snap @@ -9,6 +9,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd version in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for version. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd-x.snap b/cli/azd/cmd/testdata/TestUsage-azd-x.snap index 2c5b3245f63..0a921262593 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-x.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-x.snap @@ -9,6 +9,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd x in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for x. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. diff --git a/cli/azd/cmd/testdata/TestUsage-azd.snap b/cli/azd/cmd/testdata/TestUsage-azd.snap index 46400066c1f..4dc45c6f367 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd.snap @@ -51,6 +51,7 @@ Flags -C, --cwd string : Sets the current working directory. --debug : Enables debugging and diagnostics logging. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. Global Flags diff --git a/cli/azd/extensions/azure.ai.agents/internal/cmd/init.go b/cli/azd/extensions/azure.ai.agents/internal/cmd/init.go index 46b84762104..0cfa1e4bbea 100644 --- a/cli/azd/extensions/azure.ai.agents/internal/cmd/init.go +++ b/cli/azd/extensions/azure.ai.agents/internal/cmd/init.go @@ -174,6 +174,7 @@ func runInitFromManifest( console := input.NewConsole( false, // noPrompt + false, // failOnPrompt true, // isTerminal input.Writers{Output: os.Stdout}, input.ConsoleHandles{ @@ -994,6 +995,7 @@ func (a *InitAction) downloadAgentYaml( console = input.NewConsole( false, // noPrompt + false, // failOnPrompt true, // isTerminal input.Writers{Output: os.Stdout}, input.ConsoleHandles{ diff --git a/cli/azd/extensions/azure.ai.finetune/internal/cmd/init.go b/cli/azd/extensions/azure.ai.finetune/internal/cmd/init.go index 179f85e397e..e6012f3af5e 100644 --- a/cli/azd/extensions/azure.ai.finetune/internal/cmd/init.go +++ b/cli/azd/extensions/azure.ai.finetune/internal/cmd/init.go @@ -108,6 +108,7 @@ func newInitCommand(rootFlags rootFlagsDefinition) *cobra.Command { console := input.NewConsole( false, // noPrompt + false, // failOnPrompt true, // isTerminal input.Writers{Output: os.Stdout}, input.ConsoleHandles{ @@ -810,6 +811,7 @@ method: console = input.NewConsole( false, // noPrompt + false, // failOnPrompt true, // isTerminal input.Writers{Output: os.Stdout}, input.ConsoleHandles{ diff --git a/cli/azd/extensions/azure.coding-agent/internal/cmd/coding_agent_config.go b/cli/azd/extensions/azure.coding-agent/internal/cmd/coding_agent_config.go index 0bbf49e987e..1ef59b4c1b4 100644 --- a/cli/azd/extensions/azure.coding-agent/internal/cmd/coding_agent_config.go +++ b/cli/azd/extensions/azure.coding-agent/internal/cmd/coding_agent_config.go @@ -428,7 +428,7 @@ func newCommandRunner(showOutput bool) (azd_exec.CommandRunner, input.Console) { }) } - console := input.NewConsole(true, true, input.Writers{ + console := input.NewConsole(true, false, true, input.Writers{ Output: os.Stdout, Spinner: os.Stdout, }, input.ConsoleHandles{ diff --git a/cli/azd/internal/global_command_options.go b/cli/azd/internal/global_command_options.go index 47b8d0a14f5..e8c662f7925 100644 --- a/cli/azd/internal/global_command_options.go +++ b/cli/azd/internal/global_command_options.go @@ -33,6 +33,11 @@ type GlobalCommandOptions struct { // purposes such as URLs). EnvironmentName string + // FailOnPrompt when true, any interactive prompt fails immediately with an + // actionable error, even if a default value exists. This is stricter than + // NoPrompt which silently uses defaults. + FailOnPrompt bool + // EnableTelemetry indicates if telemetry should be sent. // The rootCmd will disable this based if the environment variable // AZURE_DEV_COLLECT_TELEMETRY is set to 'no'. diff --git a/cli/azd/internal/repository/app_init_test.go b/cli/azd/internal/repository/app_init_test.go index bccb7b45b74..dee7c377dd0 100644 --- a/cli/azd/internal/repository/app_init_test.go +++ b/cli/azd/internal/repository/app_init_test.go @@ -272,6 +272,7 @@ func TestInitializer_prjConfigFromDetect(t *testing.T) { t.Run(tt.name, func(t *testing.T) { i := &Initializer{ console: input.NewConsole( + false, false, false, input.Writers{Output: os.Stdout}, diff --git a/cli/azd/internal/repository/detect_confirm_test.go b/cli/azd/internal/repository/detect_confirm_test.go index 172c86084dc..75f2208354b 100644 --- a/cli/azd/internal/repository/detect_confirm_test.go +++ b/cli/azd/internal/repository/detect_confirm_test.go @@ -210,6 +210,7 @@ func Test_detectConfirm_confirm(t *testing.T) { t.Run(tt.name, func(t *testing.T) { d := &detectConfirm{ console: input.NewConsole( + false, false, false, input.Writers{Output: os.Stdout}, diff --git a/cli/azd/internal/repository/infra_confirm_test.go b/cli/azd/internal/repository/infra_confirm_test.go index 3f3b684938c..9b4b64ed086 100644 --- a/cli/azd/internal/repository/infra_confirm_test.go +++ b/cli/azd/internal/repository/infra_confirm_test.go @@ -218,6 +218,7 @@ func TestInitializer_infraSpecFromDetect(t *testing.T) { t.Run(tt.name, func(t *testing.T) { i := &Initializer{ console: input.NewConsole( + false, false, false, input.Writers{Output: os.Stdout}, diff --git a/cli/azd/internal/vsrpc/server_session.go b/cli/azd/internal/vsrpc/server_session.go index 5d36dbc8c9d..f657d316797 100644 --- a/cli/azd/internal/vsrpc/server_session.go +++ b/cli/azd/internal/vsrpc/server_session.go @@ -133,7 +133,7 @@ func (s *serverSession) newContainer(rc RequestContext) (*container, error) { stdin := strings.NewReader("") writer := colorable.NewNonColorable(stdout) - return input.NewConsole(true, false, input.Writers{ + return input.NewConsole(true, false, false, input.Writers{ Output: writer, Spinner: colorable.NewNonColorable(spinnerWriter)}, input.ConsoleHandles{ diff --git a/cli/azd/pkg/input/asker.go b/cli/azd/pkg/input/asker.go index fdf17299589..23a83697af9 100644 --- a/cli/azd/pkg/input/asker.go +++ b/cli/azd/pkg/input/asker.go @@ -17,7 +17,14 @@ import ( type Asker func(p survey.Prompt, response any) error -func NewAsker(noPrompt bool, isTerminal bool, w io.Writer, r io.Reader) Asker { +// NewAsker returns an Asker configured for the given prompt mode. +// When failOnPrompt is true, every prompt immediately returns an actionable error. +// When noPrompt is true, prompts silently use their default values. +func NewAsker(noPrompt bool, failOnPrompt bool, isTerminal bool, w io.Writer, r io.Reader) Asker { + if failOnPrompt { + return askOneFailOnPrompt + } + if noPrompt { return askOneNoPrompt } @@ -27,6 +34,47 @@ func NewAsker(noPrompt bool, isTerminal bool, w io.Writer, r io.Reader) Asker { } } +func askOneFailOnPrompt(p survey.Prompt, _ any) error { + switch v := p.(type) { + case *survey.Input: + return fmt.Errorf( + "interactive prompt not allowed in strict mode: %q"+ + " (provide the value via command-line flags"+ + " or environment variables)", + v.Message, + ) + case *survey.Select: + return fmt.Errorf( + "interactive prompt not allowed in strict mode: %q"+ + " (available options: %s — specify via"+ + " command-line flags or environment variables)", + v.Message, + strings.Join(v.Options, ", "), + ) + case *survey.Confirm: + return fmt.Errorf( + "interactive prompt not allowed in strict mode: %q"+ + " (provide the value via command-line flags"+ + " or environment variables)", + v.Message, + ) + case *survey.MultiSelect: + return fmt.Errorf( + "interactive prompt not allowed in strict mode: %q"+ + " (available options: %s — specify via"+ + " command-line flags or environment variables)", + v.Message, + strings.Join(v.Options, ", "), + ) + default: + return fmt.Errorf( + "interactive prompt not allowed in strict mode" + + " (provide the value via command-line flags" + + " or environment variables)", + ) + } +} + func askOneNoPrompt(p survey.Prompt, response any) error { switch v := p.(type) { case *survey.Input: diff --git a/cli/azd/pkg/input/asker_test.go b/cli/azd/pkg/input/asker_test.go index 861f8d2477f..e74850635ab 100644 --- a/cli/azd/pkg/input/asker_test.go +++ b/cli/azd/pkg/input/asker_test.go @@ -222,7 +222,7 @@ func Test_askOneNoPrompt_UnknownType_Panics(t *testing.T) { } func Test_NewAsker_NoPrompt(t *testing.T) { - asker := NewAsker(true, false, nil, nil) + asker := NewAsker(true, false, false, nil, nil) prompt := &survey.Confirm{ Message: "OK?", Default: true, @@ -239,7 +239,7 @@ func Test_NewAsker_NonTerminal_Input(t *testing.T) { r := strings.NewReader(input) w := &bytes.Buffer{} - asker := NewAsker(false, false, w, r) + asker := NewAsker(false, false, false, w, r) prompt := &survey.Input{ Message: "Name:", } @@ -256,7 +256,7 @@ func Test_NewAsker_NonTerminal_InputWithDefault(t *testing.T) { r := strings.NewReader(input) w := &bytes.Buffer{} - asker := NewAsker(false, false, w, r) + asker := NewAsker(false, false, false, w, r) prompt := &survey.Input{ Message: "Name:", Default: "Bob", @@ -288,7 +288,7 @@ func Test_NewAsker_NonTerminal_Confirm(t *testing.T) { r := strings.NewReader(tt.input) w := &bytes.Buffer{} - asker := NewAsker(false, false, w, r) + asker := NewAsker(false, false, false, w, r) prompt := &survey.Confirm{ Message: "Continue?", Default: tt.defVal, @@ -339,7 +339,7 @@ func Test_NewAsker_NonTerminal_Select(t *testing.T) { r := strings.NewReader(tt.input) w := &bytes.Buffer{} - asker := NewAsker(false, false, w, r) + asker := NewAsker(false, false, false, w, r) prompt := &survey.Select{ Message: "Pick:", Options: tt.options, @@ -363,7 +363,7 @@ func Test_NewAsker_NonTerminal_Password(t *testing.T) { r := strings.NewReader("s3cret\n") w := &bytes.Buffer{} - asker := NewAsker(false, false, w, r) + asker := NewAsker(false, false, false, w, r) prompt := &survey.Password{ Message: "Password:", } @@ -375,7 +375,7 @@ func Test_NewAsker_NonTerminal_Password(t *testing.T) { } func Test_NewAsker_NonTerminal_UnknownType_Panics(t *testing.T) { - asker := NewAsker(false, false, &bytes.Buffer{}, strings.NewReader("")) + asker := NewAsker(false, false, false, &bytes.Buffer{}, strings.NewReader("")) require.Panics(t, func() { var result string @@ -539,3 +539,137 @@ func Test_choicesFromOptions(t *testing.T) { }) } } + +func Test_askOneFailOnPrompt(t *testing.T) { + tests := []struct { + name string + prompt survey.Prompt + errContains []string + }{ + { + name: "Input_WithDefault", + prompt: &survey.Input{ + Message: "Enter name:", + Default: "Alice", + }, + errContains: []string{ + "interactive prompt not allowed in strict mode", + "Enter name:", + "command-line flags or environment variables", + }, + }, + { + name: "Input_WithoutDefault", + prompt: &survey.Input{ + Message: "Enter value:", + }, + errContains: []string{ + "interactive prompt not allowed in strict mode", + "Enter value:", + }, + }, + { + name: "Select_ListsOptions", + prompt: &survey.Select{ + Message: "Pick region:", + Options: []string{"eastus", "westus", "westeurope"}, + Default: "eastus", + }, + errContains: []string{ + "interactive prompt not allowed in strict mode", + "Pick region:", + "eastus", + "westeurope", + }, + }, + { + name: "Confirm_WithDefault", + prompt: &survey.Confirm{ + Message: "Continue?", + Default: true, + }, + errContains: []string{ + "interactive prompt not allowed in strict mode", + "Continue?", + }, + }, + { + name: "MultiSelect_ListsOptions", + prompt: &survey.MultiSelect{ + Message: "Select features:", + Options: []string{"auth", "storage", "compute"}, + }, + errContains: []string{ + "interactive prompt not allowed in strict mode", + "Select features:", + "auth", + "storage", + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + var response any + switch tt.prompt.(type) { + case *survey.Input: + response = new(string) + case *survey.Select: + response = new(int) + case *survey.Confirm: + response = new(bool) + case *survey.MultiSelect: + response = new([]string) + } + + err := askOneFailOnPrompt(tt.prompt, response) + require.Error(t, err) + + errMsg := err.Error() + for _, substr := range tt.errContains { + require.Contains(t, errMsg, substr) + } + }) + } +} + +func Test_askOneFailOnPrompt_UnknownType(t *testing.T) { + var result string + err := askOneFailOnPrompt( + &survey.Editor{Message: "Edit:"}, + &result, + ) + require.Error(t, err) + require.Contains( + t, err.Error(), + "interactive prompt not allowed in strict mode", + ) +} + +func Test_NewAsker_FailOnPrompt_ReturnsError(t *testing.T) { + asker := NewAsker(false, true, false, nil, nil) + prompt := &survey.Input{ + Message: "Name:", + Default: "default-val", + } + var result string + err := asker(prompt, &result) + + require.Error(t, err) + require.Contains(t, err.Error(), "strict mode") + // Result should not be populated + require.Empty(t, result) +} + +func Test_NoPrompt_StillUsesDefaults(t *testing.T) { + asker := NewAsker(true, false, false, nil, nil) + prompt := &survey.Input{ + Message: "Name:", + Default: "default-val", + } + var result string + err := asker(prompt, &result) + + require.NoError(t, err) + require.Equal(t, "default-val", result) +} diff --git a/cli/azd/pkg/input/console.go b/cli/azd/pkg/input/console.go index b30f253929b..5945fd2a413 100644 --- a/cli/azd/pkg/input/console.go +++ b/cli/azd/pkg/input/console.go @@ -151,8 +151,9 @@ type AskerConsole struct { // - Spinner progress will be written as standard newline messages. // - Prompting assumes a non-terminal environment, where output written and input received are machine-friendly text, // stripped of formatting characters. - isTerminal bool - noPrompt bool + isTerminal bool + noPrompt bool + failOnPrompt bool // when non nil, use this client instead of prompting ourselves on the console. promptClient *externalPromptClient // noPromptDialog when true, disables SupportsPromptDialog() even when promptClient is set. @@ -905,7 +906,7 @@ func (c *AskerConsole) EnsureBlankLine(ctx context.Context) { // wait until the next enter func (c *AskerConsole) WaitForEnter() { - if c.noPrompt { + if c.noPrompt || c.failOnPrompt { return } @@ -1019,12 +1020,13 @@ type ExternalPromptConfiguration struct { // instead of prompting on the console. func NewConsole( noPrompt bool, + failOnPrompt bool, isTerminal bool, writers Writers, handles ConsoleHandles, formatter output.Formatter, externalPromptCfg *ExternalPromptConfiguration) Console { - asker := NewAsker(noPrompt, isTerminal, handles.Stdout, handles.Stdin) + asker := NewAsker(noPrompt, failOnPrompt, isTerminal, handles.Stdout, handles.Stdin) c := &AskerConsole{ asker: asker, @@ -1035,6 +1037,7 @@ func NewConsole( isTerminal: isTerminal, currentIndent: atomic.NewString(""), noPrompt: noPrompt, + failOnPrompt: failOnPrompt, } if writers.Spinner == nil { diff --git a/cli/azd/pkg/input/console_helpers_test.go b/cli/azd/pkg/input/console_helpers_test.go index a84037a6c65..a84c3677b4b 100644 --- a/cli/azd/pkg/input/console_helpers_test.go +++ b/cli/azd/pkg/input/console_helpers_test.go @@ -25,6 +25,7 @@ func newTestConsole( c := NewConsole( noPrompt, false, + false, Writers{Output: buf}, ConsoleHandles{ Stderr: os.Stderr, @@ -188,6 +189,7 @@ func TestSupportsPromptDialog(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { c := NewConsole( + false, false, false, Writers{Output: &bytes.Buffer{}}, diff --git a/cli/azd/pkg/input/console_test.go b/cli/azd/pkg/input/console_test.go index 0c9535c30f2..48b9e595b01 100644 --- a/cli/azd/pkg/input/console_test.go +++ b/cli/azd/pkg/input/console_test.go @@ -51,6 +51,7 @@ func TestAskerConsole_Spinner_NonTty(t *testing.T) { lines := &lineCapturer{} c := NewConsole( + false, false, false, Writers{Output: lines}, @@ -99,6 +100,7 @@ func TestAskerConsole_Spinner_NonTty(t *testing.T) { func TestAskerConsoleExternalPrompt(t *testing.T) { newConsole := func(externalPromptCfg *ExternalPromptConfiguration) Console { return NewConsole( + false, false, false, Writers{ @@ -322,6 +324,7 @@ func TestAskerConsole_Message_JsonQueryFilter(t *testing.T) { c := NewConsole( true, false, + false, Writers{Output: writerAdapter{buf}}, ConsoleHandles{ Stderr: os.Stderr, @@ -346,6 +349,7 @@ func TestAskerConsole_Message_InvalidQuery_FallsBack(t *testing.T) { c := NewConsole( true, false, + false, Writers{Output: writerAdapter{buf}}, ConsoleHandles{ Stderr: os.Stderr, From cb5500dfece7e291fdf73bc39aab2fe8b8afead9 Mon Sep 17 00:00:00 2001 From: Shayne Boyer Date: Mon, 30 Mar 2026 17:07:14 -0400 Subject: [PATCH 02/14] Fix review: wire FailOnPrompt through prompt services and add Password type - Add FailOnPrompt checks before NoPrompt branches in prompt_service.go (subscription, location, resource group, resource selection) - Add FailOnPrompt checks in gRPC prompt_service.go (Confirm, Select, MultiSelect, Prompt) - Add *survey.Password case to askOneFailOnPrompt with prompt message - All strict-mode errors include actionable guidance Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- cli/azd/internal/grpcserver/prompt_service.go | 44 +++++++++++++++++ cli/azd/pkg/input/asker.go | 7 +++ cli/azd/pkg/prompt/prompt_service.go | 48 ++++++++++++++++++- 3 files changed, 97 insertions(+), 2 deletions(-) diff --git a/cli/azd/internal/grpcserver/prompt_service.go b/cli/azd/internal/grpcserver/prompt_service.go index 5d2adf580de..f7069195142 100644 --- a/cli/azd/internal/grpcserver/prompt_service.go +++ b/cli/azd/internal/grpcserver/prompt_service.go @@ -52,6 +52,14 @@ func (s *promptService) Confirm(ctx context.Context, req *azdext.ConfirmRequest) return nil, status.Error(codes.InvalidArgument, "request and options are required") } + if s.globalOptions.FailOnPrompt { + return nil, fmt.Errorf( + "interactive prompt not allowed in strict mode: %q"+ + " (provide the value via command-line flags or environment variables)", + req.Options.Message, + ) + } + if s.globalOptions.NoPrompt { if req.Options.DefaultValue == nil { return nil, fmt.Errorf("no default response for prompt '%s'", req.Options.Message) @@ -89,6 +97,20 @@ func (s *promptService) Select(ctx context.Context, req *azdext.SelectRequest) ( return nil, status.Error(codes.InvalidArgument, "request and options are required") } + if s.globalOptions.FailOnPrompt { + choiceLabels := make([]string, len(req.Options.Choices)) + for i, c := range req.Options.Choices { + choiceLabels[i] = c.Label + } + return nil, fmt.Errorf( + "interactive prompt not allowed in strict mode: %q"+ + " (available options: %s — specify via"+ + " command-line flags or environment variables)", + req.Options.Message, + strings.Join(choiceLabels, ", "), + ) + } + if s.globalOptions.NoPrompt { if req.Options.SelectedIndex == nil { return nil, fmt.Errorf("no default selection for prompt '%s'", req.Options.Message) @@ -139,6 +161,20 @@ func (s *promptService) MultiSelect( return nil, status.Error(codes.InvalidArgument, "request and options are required") } + if s.globalOptions.FailOnPrompt { + choiceLabels := make([]string, len(req.Options.Choices)) + for i, c := range req.Options.Choices { + choiceLabels[i] = c.Label + } + return nil, fmt.Errorf( + "interactive prompt not allowed in strict mode: %q"+ + " (available options: %s — specify via"+ + " command-line flags or environment variables)", + req.Options.Message, + strings.Join(choiceLabels, ", "), + ) + } + if s.globalOptions.NoPrompt { var selectedChoices []*azdext.MultiSelectChoice for _, choice := range req.Options.Choices { @@ -194,6 +230,14 @@ func (s *promptService) MultiSelect( } func (s *promptService) Prompt(ctx context.Context, req *azdext.PromptRequest) (*azdext.PromptResponse, error) { + if s.globalOptions.FailOnPrompt { + return nil, fmt.Errorf( + "interactive prompt not allowed in strict mode: %q"+ + " (provide the value via command-line flags or environment variables)", + req.Options.Message, + ) + } + if s.globalOptions.NoPrompt { if req.Options.Required && req.Options.DefaultValue == "" { return nil, fmt.Errorf("no default response for prompt '%s'", req.Options.Message) diff --git a/cli/azd/pkg/input/asker.go b/cli/azd/pkg/input/asker.go index 23a83697af9..d3a68518eb5 100644 --- a/cli/azd/pkg/input/asker.go +++ b/cli/azd/pkg/input/asker.go @@ -66,6 +66,13 @@ func askOneFailOnPrompt(p survey.Prompt, _ any) error { v.Message, strings.Join(v.Options, ", "), ) + case *survey.Password: + return fmt.Errorf( + "interactive prompt not allowed in strict mode: %q"+ + " (provide the value via command-line flags"+ + " or environment variables)", + v.Message, + ) default: return fmt.Errorf( "interactive prompt not allowed in strict mode" + diff --git a/cli/azd/pkg/prompt/prompt_service.go b/cli/azd/pkg/prompt/prompt_service.go index ecda02797d6..82cf537f4ba 100644 --- a/cli/azd/pkg/prompt/prompt_service.go +++ b/cli/azd/pkg/prompt/prompt_service.go @@ -251,6 +251,15 @@ func (ps *promptService) PromptSubscription( hideId := isDemoModeEnabled() + // Handle --fail-on-prompt mode: require explicit subscription flag + if ps.globalOptions.FailOnPrompt { + return nil, fmt.Errorf( + "interactive prompt not allowed in strict mode:" + + " subscription selection" + + " (use --subscription flag or" + + " 'azd config set defaults.subscription ')") + } + // Handle --no-prompt mode if ps.globalOptions.NoPrompt { // Load subscriptions for both default lookup and auto-selection @@ -368,10 +377,17 @@ func (ps *promptService) PromptLocation( } } + // Handle --fail-on-prompt mode: require explicit location flag + if ps.globalOptions.FailOnPrompt { + return nil, fmt.Errorf( + "interactive prompt not allowed in strict mode:" + + " location selection" + + " (use --location flag or" + + " 'azd config set defaults.location ')") + } + // Handle --no-prompt mode if ps.globalOptions.NoPrompt { - // Default location always exists (fallback to eastus2), so we can use it - // Load locations and find the default locationList, err := ps.subscriptionManager.GetLocations( ctx, azureContext.Scope.SubscriptionId, @@ -506,6 +522,14 @@ func (ps *promptService) PromptResourceGroup( return nil, err } + // Handle --fail-on-prompt mode + if ps.globalOptions.FailOnPrompt { + return nil, fmt.Errorf( + "interactive prompt not allowed in strict mode:" + + " resource group selection" + + " (specify via environment configuration)") + } + // Handle --no-prompt mode if ps.globalOptions.NoPrompt { if azureContext.Scope.ResourceGroup == "" { @@ -638,6 +662,16 @@ func (ps *promptService) PromptSubscriptionResource( return nil, err } + // Handle --fail-on-prompt mode + if ps.globalOptions.FailOnPrompt { + return nil, fmt.Errorf( + "interactive prompt not allowed in strict mode:"+ + " %s selection"+ + " (specify via environment variable or"+ + " configuration file)", + resourceName) + } + // Handle --no-prompt mode if ps.globalOptions.NoPrompt { return nil, fmt.Errorf( @@ -784,6 +818,16 @@ func (ps *promptService) PromptResourceGroupResource( return nil, err } + // Handle --fail-on-prompt mode + if ps.globalOptions.FailOnPrompt { + return nil, fmt.Errorf( + "interactive prompt not allowed in strict mode:"+ + " %s selection"+ + " (specify via environment variable or"+ + " configuration file)", + resourceName) + } + // Handle --no-prompt mode if ps.globalOptions.NoPrompt { return nil, fmt.Errorf( From 220821fdacb8d3d2351e2d800e142ff192de99fe Mon Sep 17 00:00:00 2001 From: Shayne Boyer Date: Mon, 30 Mar 2026 17:19:02 -0400 Subject: [PATCH 03/14] Fix CI: break long line in container.go, add extension replace directives - Break 144-char line in container.go to fit 125-char lll limit - Add replace directives in extension go.mod files so they can compile against the updated NewConsole/NewAsker signatures Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- cli/azd/cmd/container.go | 7 ++++++- cli/azd/extensions/azure.ai.agents/go.mod | 2 ++ cli/azd/extensions/azure.ai.finetune/go.mod | 2 ++ cli/azd/extensions/azure.coding-agent/go.mod | 2 ++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cli/azd/cmd/container.go b/cli/azd/cmd/container.go index 09046df261d..74b78f6e98f 100644 --- a/cli/azd/cmd/container.go +++ b/cli/azd/cmd/container.go @@ -150,7 +150,12 @@ func registerCommonDependencies(container *ioc.NestedContainer) { } } - return input.NewConsole(rootOptions.NoPrompt, rootOptions.FailOnPrompt, isTerminal, input.Writers{Output: writer}, input.ConsoleHandles{ + return input.NewConsole( + rootOptions.NoPrompt, + rootOptions.FailOnPrompt, + isTerminal, + input.Writers{Output: writer}, + input.ConsoleHandles{ Stdin: cmd.InOrStdin(), Stdout: cmd.OutOrStdout(), Stderr: cmd.ErrOrStderr(), diff --git a/cli/azd/extensions/azure.ai.agents/go.mod b/cli/azd/extensions/azure.ai.agents/go.mod index 521b747cb07..890c3410031 100644 --- a/cli/azd/extensions/azure.ai.agents/go.mod +++ b/cli/azd/extensions/azure.ai.agents/go.mod @@ -109,3 +109,5 @@ require ( golang.org/x/text v0.34.0 // indirect golang.org/x/time v0.14.0 // indirect ) + +replace github.com/azure/azure-dev/cli/azd => ../../ diff --git a/cli/azd/extensions/azure.ai.finetune/go.mod b/cli/azd/extensions/azure.ai.finetune/go.mod index 0ce5c5167fe..2f588463c20 100644 --- a/cli/azd/extensions/azure.ai.finetune/go.mod +++ b/cli/azd/extensions/azure.ai.finetune/go.mod @@ -103,3 +103,5 @@ require ( google.golang.org/grpc v1.79.3 // indirect google.golang.org/protobuf v1.36.11 // indirect ) + +replace github.com/azure/azure-dev/cli/azd => ../../ diff --git a/cli/azd/extensions/azure.coding-agent/go.mod b/cli/azd/extensions/azure.coding-agent/go.mod index 97137e5c9b2..66180b89da8 100644 --- a/cli/azd/extensions/azure.coding-agent/go.mod +++ b/cli/azd/extensions/azure.coding-agent/go.mod @@ -109,3 +109,5 @@ require ( ) tool go.uber.org/mock/mockgen + +replace github.com/azure/azure-dev/cli/azd => ../../ From 49a369fbda065c59b68160e41296845c5fe6bb9f Mon Sep 17 00:00:00 2001 From: Shayne Boyer Date: Tue, 31 Mar 2026 16:40:58 -0400 Subject: [PATCH 04/14] Fix gofmt formatting in container.go Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- cli/azd/cmd/container.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cli/azd/cmd/container.go b/cli/azd/cmd/container.go index 74b78f6e98f..268772035a1 100644 --- a/cli/azd/cmd/container.go +++ b/cli/azd/cmd/container.go @@ -156,10 +156,10 @@ func registerCommonDependencies(container *ioc.NestedContainer) { isTerminal, input.Writers{Output: writer}, input.ConsoleHandles{ - Stdin: cmd.InOrStdin(), - Stdout: cmd.OutOrStdout(), - Stderr: cmd.ErrOrStderr(), - }, formatter, externalPromptCfg) + Stdin: cmd.InOrStdin(), + Stdout: cmd.OutOrStdout(), + Stderr: cmd.ErrOrStderr(), + }, formatter, externalPromptCfg) }) container.MustRegisterSingleton( From 0b5b38093d9e8c635d0bdfed70bb3f0931f9a7e8 Mon Sep 17 00:00:00 2001 From: Shayne Boyer Date: Wed, 1 Apr 2026 10:53:08 -0400 Subject: [PATCH 05/14] Address review feedback: Password prompt, ASCII errors, gRPC tests, external prompt guard - Add *survey.Password case to askOneFailOnPrompt with message in error. - Replace Unicode em dashes with ASCII in all fail-on-prompt error strings (4 occurrences across asker.go and prompt_service.go). - Add Password_WithMessage test case to asker fail-on-prompt table. - Add FailOnPrompt test cases to gRPC prompt_service_test.go. - Short-circuit external prompting when failOnPrompt is set on console. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- cli/azd/internal/grpcserver/prompt_service.go | 4 +- .../grpcserver/prompt_service_test.go | 74 +++++++++++++++++++ cli/azd/pkg/input/asker.go | 4 +- cli/azd/pkg/input/asker_test.go | 13 ++++ cli/azd/pkg/input/console.go | 29 ++++++++ 5 files changed, 120 insertions(+), 4 deletions(-) diff --git a/cli/azd/internal/grpcserver/prompt_service.go b/cli/azd/internal/grpcserver/prompt_service.go index f7069195142..1ec3ad94464 100644 --- a/cli/azd/internal/grpcserver/prompt_service.go +++ b/cli/azd/internal/grpcserver/prompt_service.go @@ -104,7 +104,7 @@ func (s *promptService) Select(ctx context.Context, req *azdext.SelectRequest) ( } return nil, fmt.Errorf( "interactive prompt not allowed in strict mode: %q"+ - " (available options: %s — specify via"+ + " (available options: %s -- specify via"+ " command-line flags or environment variables)", req.Options.Message, strings.Join(choiceLabels, ", "), @@ -168,7 +168,7 @@ func (s *promptService) MultiSelect( } return nil, fmt.Errorf( "interactive prompt not allowed in strict mode: %q"+ - " (available options: %s — specify via"+ + " (available options: %s -- specify via"+ " command-line flags or environment variables)", req.Options.Message, strings.Join(choiceLabels, ", "), diff --git a/cli/azd/internal/grpcserver/prompt_service_test.go b/cli/azd/internal/grpcserver/prompt_service_test.go index e030bb3d826..5309c110873 100644 --- a/cli/azd/internal/grpcserver/prompt_service_test.go +++ b/cli/azd/internal/grpcserver/prompt_service_test.go @@ -158,6 +158,80 @@ func Test_PromptService_Prompt_NoPromptNotRequiredWithoutDefault(t *testing.T) { require.Equal(t, "", resp.Value) } +func Test_PromptService_Confirm_FailOnPrompt(t *testing.T) { + globalOptions := &internal.GlobalCommandOptions{FailOnPrompt: true} + service := NewPromptService(nil, nil, nil, globalOptions) + + _, err := service.Confirm(t.Context(), &azdext.ConfirmRequest{ + Options: &azdext.ConfirmOptions{ + Message: "Continue?", + DefaultValue: new(true), + }, + }) + + require.Error(t, err) + require.Contains(t, err.Error(), "interactive prompt not allowed in strict mode") + require.Contains(t, err.Error(), "Continue?") +} + +func Test_PromptService_Select_FailOnPrompt(t *testing.T) { + globalOptions := &internal.GlobalCommandOptions{FailOnPrompt: true} + service := NewPromptService(nil, nil, nil, globalOptions) + + _, err := service.Select(t.Context(), &azdext.SelectRequest{ + Options: &azdext.SelectOptions{ + Message: "Choose option:", + Choices: []*azdext.SelectChoice{ + {Value: "a", Label: "Option A"}, + {Value: "b", Label: "Option B"}, + }, + }, + }) + + require.Error(t, err) + require.Contains(t, err.Error(), "interactive prompt not allowed in strict mode") + require.Contains(t, err.Error(), "Choose option:") + require.Contains(t, err.Error(), "Option A") + require.Contains(t, err.Error(), "Option B") +} + +func Test_PromptService_MultiSelect_FailOnPrompt(t *testing.T) { + globalOptions := &internal.GlobalCommandOptions{FailOnPrompt: true} + service := NewPromptService(nil, nil, nil, globalOptions) + + _, err := service.MultiSelect(t.Context(), &azdext.MultiSelectRequest{ + Options: &azdext.MultiSelectOptions{ + Message: "Select items:", + Choices: []*azdext.MultiSelectChoice{ + {Value: "x", Label: "Item X"}, + {Value: "y", Label: "Item Y"}, + }, + }, + }) + + require.Error(t, err) + require.Contains(t, err.Error(), "interactive prompt not allowed in strict mode") + require.Contains(t, err.Error(), "Select items:") + require.Contains(t, err.Error(), "Item X") +} + +func Test_PromptService_Prompt_FailOnPrompt(t *testing.T) { + globalOptions := &internal.GlobalCommandOptions{FailOnPrompt: true} + service := NewPromptService(nil, nil, nil, globalOptions) + + _, err := service.Prompt(t.Context(), &azdext.PromptRequest{ + Options: &azdext.PromptOptions{ + Message: "Enter name:", + DefaultValue: "default-name", + Required: true, + }, + }) + + require.Error(t, err) + require.Contains(t, err.Error(), "interactive prompt not allowed in strict mode") + require.Contains(t, err.Error(), "Enter name:") +} + func Test_PromptService_PromptSubscription(t *testing.T) { mockPrompter := &mockprompt.MockPromptService{} globalOptions := &internal.GlobalCommandOptions{NoPrompt: false} diff --git a/cli/azd/pkg/input/asker.go b/cli/azd/pkg/input/asker.go index d3a68518eb5..be262a74ff5 100644 --- a/cli/azd/pkg/input/asker.go +++ b/cli/azd/pkg/input/asker.go @@ -46,7 +46,7 @@ func askOneFailOnPrompt(p survey.Prompt, _ any) error { case *survey.Select: return fmt.Errorf( "interactive prompt not allowed in strict mode: %q"+ - " (available options: %s — specify via"+ + " (available options: %s -- specify via"+ " command-line flags or environment variables)", v.Message, strings.Join(v.Options, ", "), @@ -61,7 +61,7 @@ func askOneFailOnPrompt(p survey.Prompt, _ any) error { case *survey.MultiSelect: return fmt.Errorf( "interactive prompt not allowed in strict mode: %q"+ - " (available options: %s — specify via"+ + " (available options: %s -- specify via"+ " command-line flags or environment variables)", v.Message, strings.Join(v.Options, ", "), diff --git a/cli/azd/pkg/input/asker_test.go b/cli/azd/pkg/input/asker_test.go index e74850635ab..43860efd62f 100644 --- a/cli/azd/pkg/input/asker_test.go +++ b/cli/azd/pkg/input/asker_test.go @@ -606,6 +606,17 @@ func Test_askOneFailOnPrompt(t *testing.T) { "storage", }, }, + { + name: "Password_WithMessage", + prompt: &survey.Password{ + Message: "Enter token:", + }, + errContains: []string{ + "interactive prompt not allowed in strict mode", + "Enter token:", + "command-line flags or environment variables", + }, + }, } for _, tt := range tests { @@ -620,6 +631,8 @@ func Test_askOneFailOnPrompt(t *testing.T) { response = new(bool) case *survey.MultiSelect: response = new([]string) + case *survey.Password: + response = new(string) } err := askOneFailOnPrompt(tt.prompt, response) diff --git a/cli/azd/pkg/input/console.go b/cli/azd/pkg/input/console.go index 5945fd2a413..22c0a816b99 100644 --- a/cli/azd/pkg/input/console.go +++ b/cli/azd/pkg/input/console.go @@ -583,6 +583,11 @@ func (c *AskerConsole) SupportsPromptDialog() bool { // PromptDialog prompts for multiple values using a single dialog. When successful, it returns a map of prompt IDs to their // values. func (c *AskerConsole) PromptDialog(ctx context.Context, dialog PromptDialog) (map[string]any, error) { + if c.failOnPrompt { + return nil, fmt.Errorf( + "interactive prompt not allowed in strict mode (--fail-on-prompt): %q"+ + " -- specify via command-line flags or environment variables", dialog.Title) + } request := externalPromptDialogRequest{ Title: dialog.Title, @@ -623,6 +628,12 @@ func (c *AskerConsole) PromptDialog(ctx context.Context, dialog PromptDialog) (m func (c *AskerConsole) Prompt(ctx context.Context, options ConsoleOptions) (string, error) { var response string + if c.failOnPrompt && c.promptClient != nil { + return "", fmt.Errorf( + "interactive prompt not allowed in strict mode (--fail-on-prompt): %q"+ + " -- specify via command-line flags or environment variables", options.Message) + } + if c.promptClient != nil { opts := promptOptions{ Type: "string", @@ -681,6 +692,12 @@ func choicesFromOptions(options ConsoleOptions) []promptChoice { // Prompts the user to select from a set of values func (c *AskerConsole) Select(ctx context.Context, options ConsoleOptions) (int, error) { + if c.failOnPrompt && c.promptClient != nil { + return -1, fmt.Errorf( + "interactive prompt not allowed in strict mode (--fail-on-prompt): %q"+ + " -- specify via command-line flags or environment variables", options.Message) + } + if c.promptClient != nil { opts := promptOptions{ Type: "select", @@ -761,6 +778,12 @@ func (c *AskerConsole) Select(ctx context.Context, options ConsoleOptions) (int, func (c *AskerConsole) MultiSelect(ctx context.Context, options ConsoleOptions) ([]string, error) { var response []string + if c.failOnPrompt && c.promptClient != nil { + return nil, fmt.Errorf( + "interactive prompt not allowed in strict mode (--fail-on-prompt): %q"+ + " -- specify via command-line flags or environment variables", options.Message) + } + if c.promptClient != nil { opts := promptOptions{ Type: "multiSelect", @@ -829,6 +852,12 @@ func (c *AskerConsole) MultiSelect(ctx context.Context, options ConsoleOptions) // Prompts the user to confirm an operation func (c *AskerConsole) Confirm(ctx context.Context, options ConsoleOptions) (bool, error) { + if c.failOnPrompt && c.promptClient != nil { + return false, fmt.Errorf( + "interactive prompt not allowed in strict mode (--fail-on-prompt): %q"+ + " -- specify via command-line flags or environment variables", options.Message) + } + if c.promptClient != nil { opts := promptOptions{ Type: "confirm", From 13ce4b080bb68a4f0a88cfaf881c7687310cb561 Mon Sep 17 00:00:00 2001 From: Shayne Boyer Date: Wed, 1 Apr 2026 11:41:52 -0400 Subject: [PATCH 06/14] Fix extension builds: update go.sum and add missing mock methods - Run go mod tidy on all 3 extensions to add missing go.sum entries for new core dependencies (azsecrets, armkeyvault, etc.). - Add PromptAiDeployment, PromptAiModel, PromptAiLocationWithQuota, and PromptAiModelLocationWithQuota to MockPromptServiceClient to match the updated PromptServiceClient interface. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- cli/azd/extensions/azure.ai.finetune/go.mod | 7 ++ cli/azd/extensions/azure.ai.finetune/go.sum | 18 +++++ cli/azd/extensions/azure.coding-agent/go.mod | 3 + cli/azd/extensions/azure.coding-agent/go.sum | 6 ++ .../internal/cmd/mocks_azdext_test.go | 80 +++++++++++++++++++ 5 files changed, 114 insertions(+) diff --git a/cli/azd/extensions/azure.ai.finetune/go.mod b/cli/azd/extensions/azure.ai.finetune/go.mod index 2f588463c20..13b3c2db09d 100644 --- a/cli/azd/extensions/azure.ai.finetune/go.mod +++ b/cli/azd/extensions/azure.ai.finetune/go.mod @@ -21,6 +21,10 @@ require ( github.com/AlecAivazis/survey/v2 v2.3.7 // indirect github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appservice/armappservice/v2 v2.3.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.5.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions v1.3.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.4.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.6.0 // indirect github.com/Masterminds/semver/v3 v3.4.0 // indirect github.com/adam-lavrik/go-imath v0.0.0-20210910152346-265a42a96f0b // indirect @@ -39,6 +43,7 @@ require ( github.com/charmbracelet/x/cellbuf v0.0.15 // indirect github.com/charmbracelet/x/exp/slice v0.0.0-20260204111555-7642919e0bee // indirect github.com/charmbracelet/x/term v0.2.2 // indirect + github.com/cli/browser v1.3.0 // indirect github.com/clipperhouse/displaywidth v0.9.0 // indirect github.com/clipperhouse/stringish v0.1.1 // indirect github.com/clipperhouse/uax29/v2 v2.5.0 // indirect @@ -47,6 +52,7 @@ require ( github.com/drone/envsubst v1.0.3 // indirect github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect + github.com/gofrs/flock v0.12.1 // indirect github.com/golang-jwt/jwt/v5 v5.3.1 // indirect github.com/golobby/container/v3 v3.3.2 // indirect github.com/google/uuid v1.6.0 // indirect @@ -92,6 +98,7 @@ require ( go.opentelemetry.io/otel/sdk v1.43.0 // indirect go.opentelemetry.io/otel/trace v1.43.0 // indirect go.uber.org/atomic v1.11.0 // indirect + go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.48.0 // indirect golang.org/x/exp v0.0.0-20260112195511-716be5621a96 // indirect golang.org/x/net v0.51.0 // indirect diff --git a/cli/azd/extensions/azure.ai.finetune/go.sum b/cli/azd/extensions/azure.ai.finetune/go.sum index 67a8d15a9d2..565817fadd1 100644 --- a/cli/azd/extensions/azure.ai.finetune/go.sum +++ b/cli/azd/extensions/azure.ai.finetune/go.sum @@ -15,8 +15,20 @@ github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appservice/armappservice/v github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appservice/armappservice/v2 v2.3.0/go.mod h1:nJLFPGJkyKfDDyJiPuHIXsCi/gpJkm07EvRgiX7SGlI= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices v1.8.0 h1:ZMGAqCZov8+7iFUPWKVcTaLgNXUeTlz20sIuWkQWNfg= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices v1.8.0/go.mod h1:BElPQ/GZtrdQ2i5uDZw3OKLE1we75W0AEWyeBR1TWQA= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0 h1:PTFGRSlMKCQelWwxUyYVEUqseBJVemLyqWJjvMyt0do= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0/go.mod h1:LRr2FzBTQlONPPa5HREE5+RjSCTXl7BwOvYOaWTqCaI= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0 h1:2qsIIvxVT+uE6yrNldntJKlLRgxGbZ85kgtz5SNBhMw= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0/go.mod h1:AW8VEadnhw9xox+VaVd9sP7NjzOAnaZBLRH6Tq3cJ38= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.5.0 h1:nnQ9vXH039UrEFxi08pPuZBE7VfqSJt343uJLw0rhWI= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.5.0/go.mod h1:4YIVtzMFVsPwBvitCDX7J9sqthSj43QD1sP6fYc1egc= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 h1:Dd+RhdJn0OTtVGaeDLZpcumkIVCtA/3/Fo42+eoYvVM= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0/go.mod h1:5kakwfW5CjC9KK+Q4wjXAg+ShuIm2mBMua0ZFj2C8PE= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions v1.3.0 h1:wxQx2Bt4xzPIKvW59WQf1tJNx/ZZKPfN+EhPX3Z6CYY= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions v1.3.0/go.mod h1:TpiwjwnW/khS0LKs4vW5UmmT9OWcxaveS8U7+tlknzo= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.4.0 h1:/g8S6wk65vfC6m3FIxJ+i5QDyN9JWwXI8Hb0Img10hU= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.4.0/go.mod h1:gpl+q95AzZlKVI3xSoseF9QPrypk0hQqBiJYeB/cR/I= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0 h1:nCYfgcSyHZXJI8J0IWE5MsCGlb2xp9fJiXyxWgmOFg4= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0/go.mod h1:ucUjca2JtSZboY8IoUqyQyuuXvwbMBVwFOm0vdQPNhA= github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= github.com/AzureAD/microsoft-authentication-library-for-go v1.6.0 h1:XRzhVemXdgvJqCH0sFfrBUTnUJSBrBf7++ypk+twtRs= @@ -73,6 +85,8 @@ github.com/charmbracelet/x/exp/slice v0.0.0-20260204111555-7642919e0bee h1:B/JPE github.com/charmbracelet/x/exp/slice v0.0.0-20260204111555-7642919e0bee/go.mod h1:vqEfX6xzqW1pKKZUUiFOKg0OQ7bCh54Q2vR/tserrRA= github.com/charmbracelet/x/term v0.2.2 h1:xVRT/S2ZcKdhhOuSP4t5cLi5o+JxklsoEObBSgfgZRk= github.com/charmbracelet/x/term v0.2.2/go.mod h1:kF8CY5RddLWrsgVwpw4kAa6TESp6EB5y3uxGLeCqzAI= +github.com/cli/browser v1.3.0 h1:LejqCrpWr+1pRqmEPDGnTZOjsMe7sehifLynZJuqJpo= +github.com/cli/browser v1.3.0/go.mod h1:HH8s+fOAxjhQoBUAsKuPCbqUuxZDhQ2/aD+SzsEfBTk= github.com/clipperhouse/displaywidth v0.9.0 h1:Qb4KOhYwRiN3viMv1v/3cTBlz3AcAZX3+y9OLhMtAtA= github.com/clipperhouse/displaywidth v0.9.0/go.mod h1:aCAAqTlh4GIVkhQnJpbL0T/WfcrJXHcj8C0yjYcjOZA= github.com/clipperhouse/stringish v0.1.1 h1:+NSqMOr3GR6k1FdRhhnXrLfztGzuG+VuFDfatpWHKCs= @@ -100,6 +114,8 @@ github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/gofrs/flock v0.12.1 h1:MTLVXXHf8ekldpJk3AKicLij9MdwOWkZ+a/jHHZby9E= +github.com/gofrs/flock v0.12.1/go.mod h1:9zxTsyu5xtJ9DK+1tFZyibEV7y3uwDxPPfbxeeHCoD0= github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY= github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= @@ -250,6 +266,8 @@ go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09 go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= diff --git a/cli/azd/extensions/azure.coding-agent/go.mod b/cli/azd/extensions/azure.coding-agent/go.mod index 66180b89da8..d5af112c751 100644 --- a/cli/azd/extensions/azure.coding-agent/go.mod +++ b/cli/azd/extensions/azure.coding-agent/go.mod @@ -22,7 +22,10 @@ require ( github.com/AlecAivazis/survey/v2 v2.3.7 // indirect github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2 v2.2.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.5.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions v1.3.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.4.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.6.0 // indirect github.com/Masterminds/semver/v3 v3.4.0 // indirect github.com/adam-lavrik/go-imath v0.0.0-20210910152346-265a42a96f0b // indirect diff --git a/cli/azd/extensions/azure.coding-agent/go.sum b/cli/azd/extensions/azure.coding-agent/go.sum index b784eca1aed..207a9d7ca86 100644 --- a/cli/azd/extensions/azure.coding-agent/go.sum +++ b/cli/azd/extensions/azure.coding-agent/go.sum @@ -17,6 +17,8 @@ github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0 h1:PTFG github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0/go.mod h1:LRr2FzBTQlONPPa5HREE5+RjSCTXl7BwOvYOaWTqCaI= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0 h1:2qsIIvxVT+uE6yrNldntJKlLRgxGbZ85kgtz5SNBhMw= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0/go.mod h1:AW8VEadnhw9xox+VaVd9sP7NjzOAnaZBLRH6Tq3cJ38= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.5.0 h1:nnQ9vXH039UrEFxi08pPuZBE7VfqSJt343uJLw0rhWI= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.5.0/go.mod h1:4YIVtzMFVsPwBvitCDX7J9sqthSj43QD1sP6fYc1egc= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups v1.0.0 h1:pPvTJ1dY0sA35JOeFq6TsY2xj6Z85Yo23Pj4wCCvu4o= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups v1.0.0/go.mod h1:mLfWfj8v3jfWKsL9G4eoBoXVcsqcIUTapmdKy7uGOp0= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi v1.3.0 h1:L7G3dExHBgUxsO3qpTGhk/P2dgnYyW48yn7AO33Tbek= @@ -25,6 +27,10 @@ github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1. github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0/go.mod h1:5kakwfW5CjC9KK+Q4wjXAg+ShuIm2mBMua0ZFj2C8PE= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions v1.3.0 h1:wxQx2Bt4xzPIKvW59WQf1tJNx/ZZKPfN+EhPX3Z6CYY= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions v1.3.0/go.mod h1:TpiwjwnW/khS0LKs4vW5UmmT9OWcxaveS8U7+tlknzo= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.4.0 h1:/g8S6wk65vfC6m3FIxJ+i5QDyN9JWwXI8Hb0Img10hU= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.4.0/go.mod h1:gpl+q95AzZlKVI3xSoseF9QPrypk0hQqBiJYeB/cR/I= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0 h1:nCYfgcSyHZXJI8J0IWE5MsCGlb2xp9fJiXyxWgmOFg4= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0/go.mod h1:ucUjca2JtSZboY8IoUqyQyuuXvwbMBVwFOm0vdQPNhA= github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= github.com/AzureAD/microsoft-authentication-library-for-go v1.6.0 h1:XRzhVemXdgvJqCH0sFfrBUTnUJSBrBf7++ypk+twtRs= diff --git a/cli/azd/extensions/azure.coding-agent/internal/cmd/mocks_azdext_test.go b/cli/azd/extensions/azure.coding-agent/internal/cmd/mocks_azdext_test.go index 27cb1e51279..f1234247f6c 100644 --- a/cli/azd/extensions/azure.coding-agent/internal/cmd/mocks_azdext_test.go +++ b/cli/azd/extensions/azure.coding-agent/internal/cmd/mocks_azdext_test.go @@ -305,3 +305,83 @@ func (mr *MockPromptServiceClientMockRecorder) Select(ctx, in any, opts ...any) varargs := append([]any{ctx, in}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Select", reflect.TypeOf((*MockPromptServiceClient)(nil).Select), varargs...) } + +// PromptAiDeployment mocks base method. +func (m *MockPromptServiceClient) PromptAiDeployment(ctx context.Context, in *azdext.PromptAiDeploymentRequest, opts ...grpc.CallOption) (*azdext.PromptAiDeploymentResponse, error) { + m.ctrl.T.Helper() + varargs := []any{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "PromptAiDeployment", varargs...) + ret0, _ := ret[0].(*azdext.PromptAiDeploymentResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PromptAiDeployment indicates an expected call of PromptAiDeployment. +func (mr *MockPromptServiceClientMockRecorder) PromptAiDeployment(ctx, in any, opts ...any) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]any{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PromptAiDeployment", reflect.TypeOf((*MockPromptServiceClient)(nil).PromptAiDeployment), varargs...) +} + +// PromptAiModel mocks base method. +func (m *MockPromptServiceClient) PromptAiModel(ctx context.Context, in *azdext.PromptAiModelRequest, opts ...grpc.CallOption) (*azdext.PromptAiModelResponse, error) { + m.ctrl.T.Helper() + varargs := []any{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "PromptAiModel", varargs...) + ret0, _ := ret[0].(*azdext.PromptAiModelResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PromptAiModel indicates an expected call of PromptAiModel. +func (mr *MockPromptServiceClientMockRecorder) PromptAiModel(ctx, in any, opts ...any) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]any{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PromptAiModel", reflect.TypeOf((*MockPromptServiceClient)(nil).PromptAiModel), varargs...) +} + +// PromptAiLocationWithQuota mocks base method. +func (m *MockPromptServiceClient) PromptAiLocationWithQuota(ctx context.Context, in *azdext.PromptAiLocationWithQuotaRequest, opts ...grpc.CallOption) (*azdext.PromptAiLocationWithQuotaResponse, error) { + m.ctrl.T.Helper() + varargs := []any{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "PromptAiLocationWithQuota", varargs...) + ret0, _ := ret[0].(*azdext.PromptAiLocationWithQuotaResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PromptAiLocationWithQuota indicates an expected call of PromptAiLocationWithQuota. +func (mr *MockPromptServiceClientMockRecorder) PromptAiLocationWithQuota(ctx, in any, opts ...any) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]any{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PromptAiLocationWithQuota", reflect.TypeOf((*MockPromptServiceClient)(nil).PromptAiLocationWithQuota), varargs...) +} + +// PromptAiModelLocationWithQuota mocks base method. +func (m *MockPromptServiceClient) PromptAiModelLocationWithQuota(ctx context.Context, in *azdext.PromptAiModelLocationWithQuotaRequest, opts ...grpc.CallOption) (*azdext.PromptAiModelLocationWithQuotaResponse, error) { + m.ctrl.T.Helper() + varargs := []any{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "PromptAiModelLocationWithQuota", varargs...) + ret0, _ := ret[0].(*azdext.PromptAiModelLocationWithQuotaResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PromptAiModelLocationWithQuota indicates an expected call of PromptAiModelLocationWithQuota. +func (mr *MockPromptServiceClientMockRecorder) PromptAiModelLocationWithQuota(ctx, in any, opts ...any) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]any{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PromptAiModelLocationWithQuota", reflect.TypeOf((*MockPromptServiceClient)(nil).PromptAiModelLocationWithQuota), varargs...) +} From 32ee17a650f6175c6602af154850879de7c83752 Mon Sep 17 00:00:00 2001 From: Shayne Boyer Date: Thu, 2 Apr 2026 10:39:56 -0400 Subject: [PATCH 07/14] Add FailOnPrompt tests for prompt_service.go methods Add tests for PromptSubscription, PromptLocation, PromptResourceGroup, PromptSubscriptionResource, and PromptResourceGroupResource covering the FailOnPrompt error paths with actionable error messages. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- cli/azd/pkg/prompt/prompt_service_test.go | 127 ++++++++++++++++++++++ 1 file changed, 127 insertions(+) diff --git a/cli/azd/pkg/prompt/prompt_service_test.go b/cli/azd/pkg/prompt/prompt_service_test.go index 939125d8ad9..4026f50abbf 100644 --- a/cli/azd/pkg/prompt/prompt_service_test.go +++ b/cli/azd/pkg/prompt/prompt_service_test.go @@ -399,3 +399,130 @@ func TestPromptLocation_NoPrompt_IgnoresEmptyAllowedValues(t *testing.T) { require.Equal(t, "westus3", location.Name) subscriptionManager.AssertExpectations(t) } + +func TestPromptSubscription_FailOnPrompt(t *testing.T) { + ucm := newInMemoryUserConfigManager(nil) + authManager := &mockauth.MockAuthManager{} + subscriptionManager := &mockaccount.MockSubscriptionManager{} + resourceService := &mockazapi.MockResourceService{} + mockConsole := mockinput.NewMockConsole() + + ps := NewPromptService( + authManager, + mockConsole, + ucm, + subscriptionManager, + resourceService, + &internal.GlobalCommandOptions{FailOnPrompt: true}, + ) + + result, err := ps.PromptSubscription(t.Context(), nil) + require.Nil(t, result) + require.Error(t, err) + require.Contains(t, err.Error(), "interactive prompt not allowed in strict mode") + require.Contains(t, err.Error(), "subscription selection") +} + +func TestPromptLocation_FailOnPrompt(t *testing.T) { + ucm := newInMemoryUserConfigManager(nil) + authManager := &mockauth.MockAuthManager{} + subscriptionManager := &mockaccount.MockSubscriptionManager{} + resourceService := &mockazapi.MockResourceService{} + mockConsole := mockinput.NewMockConsole() + + ps := NewPromptService( + authManager, + mockConsole, + ucm, + subscriptionManager, + resourceService, + &internal.GlobalCommandOptions{FailOnPrompt: true}, + ) + + result, err := ps.PromptLocation(t.Context(), &AzureContext{ + Scope: AzureScope{SubscriptionId: "sub-123"}, + }, nil) + require.Nil(t, result) + require.Error(t, err) + require.Contains(t, err.Error(), "interactive prompt not allowed in strict mode") + require.Contains(t, err.Error(), "location selection") +} + +func TestPromptResourceGroup_FailOnPrompt(t *testing.T) { + ucm := newInMemoryUserConfigManager(nil) + authManager := &mockauth.MockAuthManager{} + subscriptionManager := &mockaccount.MockSubscriptionManager{} + resourceService := &mockazapi.MockResourceService{} + mockConsole := mockinput.NewMockConsole() + + ps := NewPromptService( + authManager, + mockConsole, + ucm, + subscriptionManager, + resourceService, + &internal.GlobalCommandOptions{FailOnPrompt: true}, + ) + + result, err := ps.PromptResourceGroup(t.Context(), &AzureContext{ + Scope: AzureScope{SubscriptionId: "sub-123"}, + }, nil) + require.Nil(t, result) + require.Error(t, err) + require.Contains(t, err.Error(), "interactive prompt not allowed in strict mode") + require.Contains(t, err.Error(), "resource group selection") +} + +func TestPromptSubscriptionResource_FailOnPrompt(t *testing.T) { + ucm := newInMemoryUserConfigManager(nil) + authManager := &mockauth.MockAuthManager{} + subscriptionManager := &mockaccount.MockSubscriptionManager{} + resourceService := &mockazapi.MockResourceService{} + mockConsole := mockinput.NewMockConsole() + + ps := NewPromptService( + authManager, + mockConsole, + ucm, + subscriptionManager, + resourceService, + &internal.GlobalCommandOptions{FailOnPrompt: true}, + ) + + result, err := ps.PromptSubscriptionResource(t.Context(), &AzureContext{ + Scope: AzureScope{SubscriptionId: "sub-123"}, + }, ResourceOptions{ + ResourceTypeDisplayName: "test resource", + }) + require.Nil(t, result) + require.Error(t, err) + require.Contains(t, err.Error(), "interactive prompt not allowed in strict mode") + require.Contains(t, err.Error(), "test resource selection") +} + +func TestPromptResourceGroupResource_FailOnPrompt(t *testing.T) { + ucm := newInMemoryUserConfigManager(nil) + authManager := &mockauth.MockAuthManager{} + subscriptionManager := &mockaccount.MockSubscriptionManager{} + resourceService := &mockazapi.MockResourceService{} + mockConsole := mockinput.NewMockConsole() + + ps := NewPromptService( + authManager, + mockConsole, + ucm, + subscriptionManager, + resourceService, + &internal.GlobalCommandOptions{FailOnPrompt: true}, + ) + + result, err := ps.PromptResourceGroupResource(t.Context(), &AzureContext{ + Scope: AzureScope{SubscriptionId: "sub-123", ResourceGroup: "rg-1"}, + }, ResourceOptions{ + ResourceTypeDisplayName: "test resource", + }) + require.Nil(t, result) + require.Error(t, err) + require.Contains(t, err.Error(), "interactive prompt not allowed in strict mode") + require.Contains(t, err.Error(), "test resource selection") +} From b71bf46dc4c51d9a984f667151314efce3b66c1d Mon Sep 17 00:00:00 2001 From: Shayne Boyer Date: Fri, 3 Apr 2026 12:21:23 -0400 Subject: [PATCH 08/14] Re-trigger CI (ADO Linux infra failure) From 1750aea6ab61b83617e0c8ad9e4393d17f4eda5b Mon Sep 17 00:00:00 2001 From: Shayne Boyer Date: Thu, 9 Apr 2026 12:12:03 -0400 Subject: [PATCH 09/14] fix: remove duplicate mock methods in azure.coding-agent extension Remove duplicate PromptAi* method declarations in mocks_azdext_test.go that caused golangci-lint typecheck failures in CI. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../internal/cmd/mocks_azdext_test.go | 80 ------------------- 1 file changed, 80 deletions(-) diff --git a/cli/azd/extensions/azure.coding-agent/internal/cmd/mocks_azdext_test.go b/cli/azd/extensions/azure.coding-agent/internal/cmd/mocks_azdext_test.go index f1234247f6c..27cb1e51279 100644 --- a/cli/azd/extensions/azure.coding-agent/internal/cmd/mocks_azdext_test.go +++ b/cli/azd/extensions/azure.coding-agent/internal/cmd/mocks_azdext_test.go @@ -305,83 +305,3 @@ func (mr *MockPromptServiceClientMockRecorder) Select(ctx, in any, opts ...any) varargs := append([]any{ctx, in}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Select", reflect.TypeOf((*MockPromptServiceClient)(nil).Select), varargs...) } - -// PromptAiDeployment mocks base method. -func (m *MockPromptServiceClient) PromptAiDeployment(ctx context.Context, in *azdext.PromptAiDeploymentRequest, opts ...grpc.CallOption) (*azdext.PromptAiDeploymentResponse, error) { - m.ctrl.T.Helper() - varargs := []any{ctx, in} - for _, a := range opts { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "PromptAiDeployment", varargs...) - ret0, _ := ret[0].(*azdext.PromptAiDeploymentResponse) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// PromptAiDeployment indicates an expected call of PromptAiDeployment. -func (mr *MockPromptServiceClientMockRecorder) PromptAiDeployment(ctx, in any, opts ...any) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]any{ctx, in}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PromptAiDeployment", reflect.TypeOf((*MockPromptServiceClient)(nil).PromptAiDeployment), varargs...) -} - -// PromptAiModel mocks base method. -func (m *MockPromptServiceClient) PromptAiModel(ctx context.Context, in *azdext.PromptAiModelRequest, opts ...grpc.CallOption) (*azdext.PromptAiModelResponse, error) { - m.ctrl.T.Helper() - varargs := []any{ctx, in} - for _, a := range opts { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "PromptAiModel", varargs...) - ret0, _ := ret[0].(*azdext.PromptAiModelResponse) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// PromptAiModel indicates an expected call of PromptAiModel. -func (mr *MockPromptServiceClientMockRecorder) PromptAiModel(ctx, in any, opts ...any) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]any{ctx, in}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PromptAiModel", reflect.TypeOf((*MockPromptServiceClient)(nil).PromptAiModel), varargs...) -} - -// PromptAiLocationWithQuota mocks base method. -func (m *MockPromptServiceClient) PromptAiLocationWithQuota(ctx context.Context, in *azdext.PromptAiLocationWithQuotaRequest, opts ...grpc.CallOption) (*azdext.PromptAiLocationWithQuotaResponse, error) { - m.ctrl.T.Helper() - varargs := []any{ctx, in} - for _, a := range opts { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "PromptAiLocationWithQuota", varargs...) - ret0, _ := ret[0].(*azdext.PromptAiLocationWithQuotaResponse) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// PromptAiLocationWithQuota indicates an expected call of PromptAiLocationWithQuota. -func (mr *MockPromptServiceClientMockRecorder) PromptAiLocationWithQuota(ctx, in any, opts ...any) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]any{ctx, in}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PromptAiLocationWithQuota", reflect.TypeOf((*MockPromptServiceClient)(nil).PromptAiLocationWithQuota), varargs...) -} - -// PromptAiModelLocationWithQuota mocks base method. -func (m *MockPromptServiceClient) PromptAiModelLocationWithQuota(ctx context.Context, in *azdext.PromptAiModelLocationWithQuotaRequest, opts ...grpc.CallOption) (*azdext.PromptAiModelLocationWithQuotaResponse, error) { - m.ctrl.T.Helper() - varargs := []any{ctx, in} - for _, a := range opts { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "PromptAiModelLocationWithQuota", varargs...) - ret0, _ := ret[0].(*azdext.PromptAiModelLocationWithQuotaResponse) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// PromptAiModelLocationWithQuota indicates an expected call of PromptAiModelLocationWithQuota. -func (mr *MockPromptServiceClientMockRecorder) PromptAiModelLocationWithQuota(ctx, in any, opts ...any) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]any{ctx, in}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PromptAiModelLocationWithQuota", reflect.TypeOf((*MockPromptServiceClient)(nil).PromptAiModelLocationWithQuota), varargs...) -} From ead8acf1695370825b393e217f823ada2035473d Mon Sep 17 00:00:00 2001 From: Shayne Boyer Date: Thu, 9 Apr 2026 12:34:27 -0400 Subject: [PATCH 10/14] fix: update command usage snapshot for --fail-on-prompt flag Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- cli/azd/cmd/testdata/TestUsage-azd-update.snap | 1 + 1 file changed, 1 insertion(+) diff --git a/cli/azd/cmd/testdata/TestUsage-azd-update.snap b/cli/azd/cmd/testdata/TestUsage-azd-update.snap index 28970b06c8a..4b8260254f4 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-update.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-update.snap @@ -13,6 +13,7 @@ Global Flags --debug : Enables debugging and diagnostics logging. --docs : Opens the documentation for azd update in your web browser. -e, --environment string : The name of the environment to use. + --fail-on-prompt : Fails with an actionable error whenever a prompt is encountered, even if a default exists. Implies --no-prompt. -h, --help : Gets help for update. --no-prompt : Accepts the default value instead of prompting, or it fails if there is no default. From 6132f92bf650a409a621fa17100a4696b0e11ac6 Mon Sep 17 00:00:00 2001 From: Shayne Boyer Date: Thu, 9 Apr 2026 12:46:12 -0400 Subject: [PATCH 11/14] fix: apply go fix modernization (strings.SplitSeq) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- cli/azd/pkg/azdext/process_darwin.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/azd/pkg/azdext/process_darwin.go b/cli/azd/pkg/azdext/process_darwin.go index 68ab14d04b2..55a42898c6e 100644 --- a/cli/azd/pkg/azdext/process_darwin.go +++ b/cli/azd/pkg/azdext/process_darwin.go @@ -66,7 +66,7 @@ func findProcessByNameOS(name string) []ProcessInfo { nameLower := strings.ToLower(name) var results []ProcessInfo - for _, line := range strings.Split(string(output), "\n") { + for line := range strings.SplitSeq(string(output), "\n") { line = strings.TrimSpace(line) if line == "" { continue From 779cd90b9e276f4736e15323fb308c7a1a1ac208 Mon Sep 17 00:00:00 2001 From: Shayne Boyer Date: Thu, 9 Apr 2026 16:27:14 -0400 Subject: [PATCH 12/14] fix: unify fail-on-prompt error format with shared helper - Extract FailOnPromptError/FailOnPromptSelectError helpers - Use shared helpers in asker.go, console.go, and prompt_service.go - Revert unrelated go fix change (process_darwin.go) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- cli/azd/internal/grpcserver/prompt_service.go | 29 +++---------- cli/azd/pkg/azdext/process_darwin.go | 2 +- cli/azd/pkg/input/asker.go | 43 +++---------------- cli/azd/pkg/input/console.go | 20 +++------ cli/azd/pkg/input/fail_on_prompt_error.go | 30 +++++++++++++ 5 files changed, 47 insertions(+), 77 deletions(-) create mode 100644 cli/azd/pkg/input/fail_on_prompt_error.go diff --git a/cli/azd/internal/grpcserver/prompt_service.go b/cli/azd/internal/grpcserver/prompt_service.go index 1ec3ad94464..453e4c750d5 100644 --- a/cli/azd/internal/grpcserver/prompt_service.go +++ b/cli/azd/internal/grpcserver/prompt_service.go @@ -16,6 +16,7 @@ import ( "github.com/azure/azure-dev/cli/azd/pkg/ai" "github.com/azure/azure-dev/cli/azd/pkg/azapi" "github.com/azure/azure-dev/cli/azd/pkg/azdext" + "github.com/azure/azure-dev/cli/azd/pkg/input" "github.com/azure/azure-dev/cli/azd/pkg/output" "github.com/azure/azure-dev/cli/azd/pkg/prompt" "github.com/azure/azure-dev/cli/azd/pkg/ux" @@ -53,11 +54,7 @@ func (s *promptService) Confirm(ctx context.Context, req *azdext.ConfirmRequest) } if s.globalOptions.FailOnPrompt { - return nil, fmt.Errorf( - "interactive prompt not allowed in strict mode: %q"+ - " (provide the value via command-line flags or environment variables)", - req.Options.Message, - ) + return nil, input.FailOnPromptError(req.Options.Message) } if s.globalOptions.NoPrompt { @@ -102,13 +99,7 @@ func (s *promptService) Select(ctx context.Context, req *azdext.SelectRequest) ( for i, c := range req.Options.Choices { choiceLabels[i] = c.Label } - return nil, fmt.Errorf( - "interactive prompt not allowed in strict mode: %q"+ - " (available options: %s -- specify via"+ - " command-line flags or environment variables)", - req.Options.Message, - strings.Join(choiceLabels, ", "), - ) + return nil, input.FailOnPromptSelectError(req.Options.Message, choiceLabels) } if s.globalOptions.NoPrompt { @@ -166,13 +157,7 @@ func (s *promptService) MultiSelect( for i, c := range req.Options.Choices { choiceLabels[i] = c.Label } - return nil, fmt.Errorf( - "interactive prompt not allowed in strict mode: %q"+ - " (available options: %s -- specify via"+ - " command-line flags or environment variables)", - req.Options.Message, - strings.Join(choiceLabels, ", "), - ) + return nil, input.FailOnPromptSelectError(req.Options.Message, choiceLabels) } if s.globalOptions.NoPrompt { @@ -231,11 +216,7 @@ func (s *promptService) MultiSelect( func (s *promptService) Prompt(ctx context.Context, req *azdext.PromptRequest) (*azdext.PromptResponse, error) { if s.globalOptions.FailOnPrompt { - return nil, fmt.Errorf( - "interactive prompt not allowed in strict mode: %q"+ - " (provide the value via command-line flags or environment variables)", - req.Options.Message, - ) + return nil, input.FailOnPromptError(req.Options.Message) } if s.globalOptions.NoPrompt { diff --git a/cli/azd/pkg/azdext/process_darwin.go b/cli/azd/pkg/azdext/process_darwin.go index 55a42898c6e..68ab14d04b2 100644 --- a/cli/azd/pkg/azdext/process_darwin.go +++ b/cli/azd/pkg/azdext/process_darwin.go @@ -66,7 +66,7 @@ func findProcessByNameOS(name string) []ProcessInfo { nameLower := strings.ToLower(name) var results []ProcessInfo - for line := range strings.SplitSeq(string(output), "\n") { + for _, line := range strings.Split(string(output), "\n") { line = strings.TrimSpace(line) if line == "" { continue diff --git a/cli/azd/pkg/input/asker.go b/cli/azd/pkg/input/asker.go index be262a74ff5..bd9651be346 100644 --- a/cli/azd/pkg/input/asker.go +++ b/cli/azd/pkg/input/asker.go @@ -37,48 +37,17 @@ func NewAsker(noPrompt bool, failOnPrompt bool, isTerminal bool, w io.Writer, r func askOneFailOnPrompt(p survey.Prompt, _ any) error { switch v := p.(type) { case *survey.Input: - return fmt.Errorf( - "interactive prompt not allowed in strict mode: %q"+ - " (provide the value via command-line flags"+ - " or environment variables)", - v.Message, - ) + return FailOnPromptError(v.Message) case *survey.Select: - return fmt.Errorf( - "interactive prompt not allowed in strict mode: %q"+ - " (available options: %s -- specify via"+ - " command-line flags or environment variables)", - v.Message, - strings.Join(v.Options, ", "), - ) + return FailOnPromptSelectError(v.Message, v.Options) case *survey.Confirm: - return fmt.Errorf( - "interactive prompt not allowed in strict mode: %q"+ - " (provide the value via command-line flags"+ - " or environment variables)", - v.Message, - ) + return FailOnPromptError(v.Message) case *survey.MultiSelect: - return fmt.Errorf( - "interactive prompt not allowed in strict mode: %q"+ - " (available options: %s -- specify via"+ - " command-line flags or environment variables)", - v.Message, - strings.Join(v.Options, ", "), - ) + return FailOnPromptSelectError(v.Message, v.Options) case *survey.Password: - return fmt.Errorf( - "interactive prompt not allowed in strict mode: %q"+ - " (provide the value via command-line flags"+ - " or environment variables)", - v.Message, - ) + return FailOnPromptError(v.Message) default: - return fmt.Errorf( - "interactive prompt not allowed in strict mode" + - " (provide the value via command-line flags" + - " or environment variables)", - ) + return FailOnPromptError("") } } diff --git a/cli/azd/pkg/input/console.go b/cli/azd/pkg/input/console.go index 22c0a816b99..ba1cf75eee6 100644 --- a/cli/azd/pkg/input/console.go +++ b/cli/azd/pkg/input/console.go @@ -584,9 +584,7 @@ func (c *AskerConsole) SupportsPromptDialog() bool { // values. func (c *AskerConsole) PromptDialog(ctx context.Context, dialog PromptDialog) (map[string]any, error) { if c.failOnPrompt { - return nil, fmt.Errorf( - "interactive prompt not allowed in strict mode (--fail-on-prompt): %q"+ - " -- specify via command-line flags or environment variables", dialog.Title) + return nil, FailOnPromptError(dialog.Title) } request := externalPromptDialogRequest{ @@ -629,9 +627,7 @@ func (c *AskerConsole) Prompt(ctx context.Context, options ConsoleOptions) (stri var response string if c.failOnPrompt && c.promptClient != nil { - return "", fmt.Errorf( - "interactive prompt not allowed in strict mode (--fail-on-prompt): %q"+ - " -- specify via command-line flags or environment variables", options.Message) + return "", FailOnPromptError(options.Message) } if c.promptClient != nil { @@ -693,9 +689,7 @@ func choicesFromOptions(options ConsoleOptions) []promptChoice { // Prompts the user to select from a set of values func (c *AskerConsole) Select(ctx context.Context, options ConsoleOptions) (int, error) { if c.failOnPrompt && c.promptClient != nil { - return -1, fmt.Errorf( - "interactive prompt not allowed in strict mode (--fail-on-prompt): %q"+ - " -- specify via command-line flags or environment variables", options.Message) + return -1, FailOnPromptError(options.Message) } if c.promptClient != nil { @@ -779,9 +773,7 @@ func (c *AskerConsole) MultiSelect(ctx context.Context, options ConsoleOptions) var response []string if c.failOnPrompt && c.promptClient != nil { - return nil, fmt.Errorf( - "interactive prompt not allowed in strict mode (--fail-on-prompt): %q"+ - " -- specify via command-line flags or environment variables", options.Message) + return nil, FailOnPromptError(options.Message) } if c.promptClient != nil { @@ -853,9 +845,7 @@ func (c *AskerConsole) MultiSelect(ctx context.Context, options ConsoleOptions) // Prompts the user to confirm an operation func (c *AskerConsole) Confirm(ctx context.Context, options ConsoleOptions) (bool, error) { if c.failOnPrompt && c.promptClient != nil { - return false, fmt.Errorf( - "interactive prompt not allowed in strict mode (--fail-on-prompt): %q"+ - " -- specify via command-line flags or environment variables", options.Message) + return false, FailOnPromptError(options.Message) } if c.promptClient != nil { diff --git a/cli/azd/pkg/input/fail_on_prompt_error.go b/cli/azd/pkg/input/fail_on_prompt_error.go new file mode 100644 index 00000000000..ff7c54b69a3 --- /dev/null +++ b/cli/azd/pkg/input/fail_on_prompt_error.go @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package input + +import ( + "fmt" + "strings" +) + +// FailOnPromptError returns a consistent error for when --fail-on-prompt blocks a simple prompt. +func FailOnPromptError(promptMessage string) error { + return fmt.Errorf( + "interactive prompt not allowed in strict mode (--fail-on-prompt): %q"+ + " -- provide the value via command-line flags or environment variables", + promptMessage, + ) +} + +// FailOnPromptSelectError returns a consistent error for when --fail-on-prompt blocks a selection prompt, +// including the available options in the message. +func FailOnPromptSelectError(promptMessage string, options []string) error { + return fmt.Errorf( + "interactive prompt not allowed in strict mode (--fail-on-prompt): %q"+ + " (available options: %s)"+ + " -- specify via command-line flags or environment variables", + promptMessage, + strings.Join(options, ", "), + ) +} From c91aa2212e6c98ea0fefb60e83f876f02f5b91c8 Mon Sep 17 00:00:00 2001 From: Shayne Boyer Date: Fri, 10 Apr 2026 10:38:35 -0400 Subject: [PATCH 13/14] fix: address PR review feedback for fail-on-prompt - Add nil guard for req/req.Options in Prompt() before FailOnPrompt check, matching the pattern used by Confirm, Select, and MultiSelect - Use FailOnPromptSelectError in Select and MultiSelect console methods to include available options in the error message, matching the asker path - Revert extension go.mod/go.sum files that had local replace directives breaking CI extension builds Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- cli/azd/extensions/azure.ai.agents/go.mod | 2 -- cli/azd/extensions/azure.ai.finetune/go.mod | 9 --------- cli/azd/extensions/azure.ai.finetune/go.sum | 18 ------------------ cli/azd/extensions/azure.coding-agent/go.mod | 5 ----- cli/azd/extensions/azure.coding-agent/go.sum | 6 ------ cli/azd/internal/grpcserver/prompt_service.go | 4 ++++ cli/azd/pkg/input/console.go | 8 ++++++-- 7 files changed, 10 insertions(+), 42 deletions(-) diff --git a/cli/azd/extensions/azure.ai.agents/go.mod b/cli/azd/extensions/azure.ai.agents/go.mod index 890c3410031..521b747cb07 100644 --- a/cli/azd/extensions/azure.ai.agents/go.mod +++ b/cli/azd/extensions/azure.ai.agents/go.mod @@ -109,5 +109,3 @@ require ( golang.org/x/text v0.34.0 // indirect golang.org/x/time v0.14.0 // indirect ) - -replace github.com/azure/azure-dev/cli/azd => ../../ diff --git a/cli/azd/extensions/azure.ai.finetune/go.mod b/cli/azd/extensions/azure.ai.finetune/go.mod index 13b3c2db09d..0ce5c5167fe 100644 --- a/cli/azd/extensions/azure.ai.finetune/go.mod +++ b/cli/azd/extensions/azure.ai.finetune/go.mod @@ -21,10 +21,6 @@ require ( github.com/AlecAivazis/survey/v2 v2.3.7 // indirect github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appservice/armappservice/v2 v2.3.0 // indirect - github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.5.0 // indirect - github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions v1.3.0 // indirect - github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.4.0 // indirect - github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.6.0 // indirect github.com/Masterminds/semver/v3 v3.4.0 // indirect github.com/adam-lavrik/go-imath v0.0.0-20210910152346-265a42a96f0b // indirect @@ -43,7 +39,6 @@ require ( github.com/charmbracelet/x/cellbuf v0.0.15 // indirect github.com/charmbracelet/x/exp/slice v0.0.0-20260204111555-7642919e0bee // indirect github.com/charmbracelet/x/term v0.2.2 // indirect - github.com/cli/browser v1.3.0 // indirect github.com/clipperhouse/displaywidth v0.9.0 // indirect github.com/clipperhouse/stringish v0.1.1 // indirect github.com/clipperhouse/uax29/v2 v2.5.0 // indirect @@ -52,7 +47,6 @@ require ( github.com/drone/envsubst v1.0.3 // indirect github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/gofrs/flock v0.12.1 // indirect github.com/golang-jwt/jwt/v5 v5.3.1 // indirect github.com/golobby/container/v3 v3.3.2 // indirect github.com/google/uuid v1.6.0 // indirect @@ -98,7 +92,6 @@ require ( go.opentelemetry.io/otel/sdk v1.43.0 // indirect go.opentelemetry.io/otel/trace v1.43.0 // indirect go.uber.org/atomic v1.11.0 // indirect - go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.48.0 // indirect golang.org/x/exp v0.0.0-20260112195511-716be5621a96 // indirect golang.org/x/net v0.51.0 // indirect @@ -110,5 +103,3 @@ require ( google.golang.org/grpc v1.79.3 // indirect google.golang.org/protobuf v1.36.11 // indirect ) - -replace github.com/azure/azure-dev/cli/azd => ../../ diff --git a/cli/azd/extensions/azure.ai.finetune/go.sum b/cli/azd/extensions/azure.ai.finetune/go.sum index 565817fadd1..67a8d15a9d2 100644 --- a/cli/azd/extensions/azure.ai.finetune/go.sum +++ b/cli/azd/extensions/azure.ai.finetune/go.sum @@ -15,20 +15,8 @@ github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appservice/armappservice/v github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appservice/armappservice/v2 v2.3.0/go.mod h1:nJLFPGJkyKfDDyJiPuHIXsCi/gpJkm07EvRgiX7SGlI= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices v1.8.0 h1:ZMGAqCZov8+7iFUPWKVcTaLgNXUeTlz20sIuWkQWNfg= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/armcognitiveservices v1.8.0/go.mod h1:BElPQ/GZtrdQ2i5uDZw3OKLE1we75W0AEWyeBR1TWQA= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0 h1:PTFGRSlMKCQelWwxUyYVEUqseBJVemLyqWJjvMyt0do= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0/go.mod h1:LRr2FzBTQlONPPa5HREE5+RjSCTXl7BwOvYOaWTqCaI= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0 h1:2qsIIvxVT+uE6yrNldntJKlLRgxGbZ85kgtz5SNBhMw= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0/go.mod h1:AW8VEadnhw9xox+VaVd9sP7NjzOAnaZBLRH6Tq3cJ38= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.5.0 h1:nnQ9vXH039UrEFxi08pPuZBE7VfqSJt343uJLw0rhWI= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.5.0/go.mod h1:4YIVtzMFVsPwBvitCDX7J9sqthSj43QD1sP6fYc1egc= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 h1:Dd+RhdJn0OTtVGaeDLZpcumkIVCtA/3/Fo42+eoYvVM= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0/go.mod h1:5kakwfW5CjC9KK+Q4wjXAg+ShuIm2mBMua0ZFj2C8PE= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions v1.3.0 h1:wxQx2Bt4xzPIKvW59WQf1tJNx/ZZKPfN+EhPX3Z6CYY= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions v1.3.0/go.mod h1:TpiwjwnW/khS0LKs4vW5UmmT9OWcxaveS8U7+tlknzo= -github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.4.0 h1:/g8S6wk65vfC6m3FIxJ+i5QDyN9JWwXI8Hb0Img10hU= -github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.4.0/go.mod h1:gpl+q95AzZlKVI3xSoseF9QPrypk0hQqBiJYeB/cR/I= -github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0 h1:nCYfgcSyHZXJI8J0IWE5MsCGlb2xp9fJiXyxWgmOFg4= -github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0/go.mod h1:ucUjca2JtSZboY8IoUqyQyuuXvwbMBVwFOm0vdQPNhA= github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= github.com/AzureAD/microsoft-authentication-library-for-go v1.6.0 h1:XRzhVemXdgvJqCH0sFfrBUTnUJSBrBf7++ypk+twtRs= @@ -85,8 +73,6 @@ github.com/charmbracelet/x/exp/slice v0.0.0-20260204111555-7642919e0bee h1:B/JPE github.com/charmbracelet/x/exp/slice v0.0.0-20260204111555-7642919e0bee/go.mod h1:vqEfX6xzqW1pKKZUUiFOKg0OQ7bCh54Q2vR/tserrRA= github.com/charmbracelet/x/term v0.2.2 h1:xVRT/S2ZcKdhhOuSP4t5cLi5o+JxklsoEObBSgfgZRk= github.com/charmbracelet/x/term v0.2.2/go.mod h1:kF8CY5RddLWrsgVwpw4kAa6TESp6EB5y3uxGLeCqzAI= -github.com/cli/browser v1.3.0 h1:LejqCrpWr+1pRqmEPDGnTZOjsMe7sehifLynZJuqJpo= -github.com/cli/browser v1.3.0/go.mod h1:HH8s+fOAxjhQoBUAsKuPCbqUuxZDhQ2/aD+SzsEfBTk= github.com/clipperhouse/displaywidth v0.9.0 h1:Qb4KOhYwRiN3viMv1v/3cTBlz3AcAZX3+y9OLhMtAtA= github.com/clipperhouse/displaywidth v0.9.0/go.mod h1:aCAAqTlh4GIVkhQnJpbL0T/WfcrJXHcj8C0yjYcjOZA= github.com/clipperhouse/stringish v0.1.1 h1:+NSqMOr3GR6k1FdRhhnXrLfztGzuG+VuFDfatpWHKCs= @@ -114,8 +100,6 @@ github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/gofrs/flock v0.12.1 h1:MTLVXXHf8ekldpJk3AKicLij9MdwOWkZ+a/jHHZby9E= -github.com/gofrs/flock v0.12.1/go.mod h1:9zxTsyu5xtJ9DK+1tFZyibEV7y3uwDxPPfbxeeHCoD0= github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY= github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= @@ -266,8 +250,6 @@ go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09 go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= -go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= diff --git a/cli/azd/extensions/azure.coding-agent/go.mod b/cli/azd/extensions/azure.coding-agent/go.mod index d5af112c751..97137e5c9b2 100644 --- a/cli/azd/extensions/azure.coding-agent/go.mod +++ b/cli/azd/extensions/azure.coding-agent/go.mod @@ -22,10 +22,7 @@ require ( github.com/AlecAivazis/survey/v2 v2.3.7 // indirect github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2 v2.2.0 // indirect - github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.5.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions v1.3.0 // indirect - github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.4.0 // indirect - github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.6.0 // indirect github.com/Masterminds/semver/v3 v3.4.0 // indirect github.com/adam-lavrik/go-imath v0.0.0-20210910152346-265a42a96f0b // indirect @@ -112,5 +109,3 @@ require ( ) tool go.uber.org/mock/mockgen - -replace github.com/azure/azure-dev/cli/azd => ../../ diff --git a/cli/azd/extensions/azure.coding-agent/go.sum b/cli/azd/extensions/azure.coding-agent/go.sum index 207a9d7ca86..b784eca1aed 100644 --- a/cli/azd/extensions/azure.coding-agent/go.sum +++ b/cli/azd/extensions/azure.coding-agent/go.sum @@ -17,8 +17,6 @@ github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0 h1:PTFG github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0/go.mod h1:LRr2FzBTQlONPPa5HREE5+RjSCTXl7BwOvYOaWTqCaI= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0 h1:2qsIIvxVT+uE6yrNldntJKlLRgxGbZ85kgtz5SNBhMw= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0/go.mod h1:AW8VEadnhw9xox+VaVd9sP7NjzOAnaZBLRH6Tq3cJ38= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.5.0 h1:nnQ9vXH039UrEFxi08pPuZBE7VfqSJt343uJLw0rhWI= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.5.0/go.mod h1:4YIVtzMFVsPwBvitCDX7J9sqthSj43QD1sP6fYc1egc= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups v1.0.0 h1:pPvTJ1dY0sA35JOeFq6TsY2xj6Z85Yo23Pj4wCCvu4o= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups v1.0.0/go.mod h1:mLfWfj8v3jfWKsL9G4eoBoXVcsqcIUTapmdKy7uGOp0= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi v1.3.0 h1:L7G3dExHBgUxsO3qpTGhk/P2dgnYyW48yn7AO33Tbek= @@ -27,10 +25,6 @@ github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1. github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0/go.mod h1:5kakwfW5CjC9KK+Q4wjXAg+ShuIm2mBMua0ZFj2C8PE= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions v1.3.0 h1:wxQx2Bt4xzPIKvW59WQf1tJNx/ZZKPfN+EhPX3Z6CYY= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions v1.3.0/go.mod h1:TpiwjwnW/khS0LKs4vW5UmmT9OWcxaveS8U7+tlknzo= -github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.4.0 h1:/g8S6wk65vfC6m3FIxJ+i5QDyN9JWwXI8Hb0Img10hU= -github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.4.0/go.mod h1:gpl+q95AzZlKVI3xSoseF9QPrypk0hQqBiJYeB/cR/I= -github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0 h1:nCYfgcSyHZXJI8J0IWE5MsCGlb2xp9fJiXyxWgmOFg4= -github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0/go.mod h1:ucUjca2JtSZboY8IoUqyQyuuXvwbMBVwFOm0vdQPNhA= github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= github.com/AzureAD/microsoft-authentication-library-for-go v1.6.0 h1:XRzhVemXdgvJqCH0sFfrBUTnUJSBrBf7++ypk+twtRs= diff --git a/cli/azd/internal/grpcserver/prompt_service.go b/cli/azd/internal/grpcserver/prompt_service.go index 453e4c750d5..67364cff224 100644 --- a/cli/azd/internal/grpcserver/prompt_service.go +++ b/cli/azd/internal/grpcserver/prompt_service.go @@ -215,6 +215,10 @@ func (s *promptService) MultiSelect( } func (s *promptService) Prompt(ctx context.Context, req *azdext.PromptRequest) (*azdext.PromptResponse, error) { + if req == nil || req.Options == nil { + return nil, status.Error(codes.InvalidArgument, "request and options are required") + } + if s.globalOptions.FailOnPrompt { return nil, input.FailOnPromptError(req.Options.Message) } diff --git a/cli/azd/pkg/input/console.go b/cli/azd/pkg/input/console.go index ba1cf75eee6..d93d3643c44 100644 --- a/cli/azd/pkg/input/console.go +++ b/cli/azd/pkg/input/console.go @@ -689,7 +689,9 @@ func choicesFromOptions(options ConsoleOptions) []promptChoice { // Prompts the user to select from a set of values func (c *AskerConsole) Select(ctx context.Context, options ConsoleOptions) (int, error) { if c.failOnPrompt && c.promptClient != nil { - return -1, FailOnPromptError(options.Message) + choiceLabels := make([]string, len(options.Options)) + copy(choiceLabels, options.Options) + return -1, FailOnPromptSelectError(options.Message, choiceLabels) } if c.promptClient != nil { @@ -773,7 +775,9 @@ func (c *AskerConsole) MultiSelect(ctx context.Context, options ConsoleOptions) var response []string if c.failOnPrompt && c.promptClient != nil { - return nil, FailOnPromptError(options.Message) + choiceLabels := make([]string, len(options.Options)) + copy(choiceLabels, options.Options) + return nil, FailOnPromptSelectError(options.Message, choiceLabels) } if c.promptClient != nil { From 7bfd658051eba0c3ad71c47270aeb08bbedc6b32 Mon Sep 17 00:00:00 2001 From: Shayne Boyer Date: Fri, 10 Apr 2026 13:48:47 -0400 Subject: [PATCH 14/14] fix: revert extension NewConsole changes until core module is released Extensions use the published azd module which doesn't have the failOnPrompt parameter yet. Update extensions in a follow-up PR after the core module version is published. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- cli/azd/extensions/azure.ai.agents/internal/cmd/init.go | 2 -- cli/azd/extensions/azure.ai.finetune/internal/cmd/init.go | 2 -- .../azure.coding-agent/internal/cmd/coding_agent_config.go | 2 +- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/cli/azd/extensions/azure.ai.agents/internal/cmd/init.go b/cli/azd/extensions/azure.ai.agents/internal/cmd/init.go index 0cfa1e4bbea..46b84762104 100644 --- a/cli/azd/extensions/azure.ai.agents/internal/cmd/init.go +++ b/cli/azd/extensions/azure.ai.agents/internal/cmd/init.go @@ -174,7 +174,6 @@ func runInitFromManifest( console := input.NewConsole( false, // noPrompt - false, // failOnPrompt true, // isTerminal input.Writers{Output: os.Stdout}, input.ConsoleHandles{ @@ -995,7 +994,6 @@ func (a *InitAction) downloadAgentYaml( console = input.NewConsole( false, // noPrompt - false, // failOnPrompt true, // isTerminal input.Writers{Output: os.Stdout}, input.ConsoleHandles{ diff --git a/cli/azd/extensions/azure.ai.finetune/internal/cmd/init.go b/cli/azd/extensions/azure.ai.finetune/internal/cmd/init.go index e6012f3af5e..179f85e397e 100644 --- a/cli/azd/extensions/azure.ai.finetune/internal/cmd/init.go +++ b/cli/azd/extensions/azure.ai.finetune/internal/cmd/init.go @@ -108,7 +108,6 @@ func newInitCommand(rootFlags rootFlagsDefinition) *cobra.Command { console := input.NewConsole( false, // noPrompt - false, // failOnPrompt true, // isTerminal input.Writers{Output: os.Stdout}, input.ConsoleHandles{ @@ -811,7 +810,6 @@ method: console = input.NewConsole( false, // noPrompt - false, // failOnPrompt true, // isTerminal input.Writers{Output: os.Stdout}, input.ConsoleHandles{ diff --git a/cli/azd/extensions/azure.coding-agent/internal/cmd/coding_agent_config.go b/cli/azd/extensions/azure.coding-agent/internal/cmd/coding_agent_config.go index 1ef59b4c1b4..0bbf49e987e 100644 --- a/cli/azd/extensions/azure.coding-agent/internal/cmd/coding_agent_config.go +++ b/cli/azd/extensions/azure.coding-agent/internal/cmd/coding_agent_config.go @@ -428,7 +428,7 @@ func newCommandRunner(showOutput bool) (azd_exec.CommandRunner, input.Console) { }) } - console := input.NewConsole(true, false, true, input.Writers{ + console := input.NewConsole(true, true, input.Writers{ Output: os.Stdout, Spinner: os.Stdout, }, input.ConsoleHandles{