From ca584eecaedf8b1020a0c37163e49f033fc30c12 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Dec 2025 17:47:47 +0000 Subject: [PATCH 1/8] Initial plan From 672a7945ff7c6a48e9b13a9c6ed4d1d22b27bef3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Dec 2025 18:02:05 +0000 Subject: [PATCH 2/8] Add azd config options command to list all available config settings Co-authored-by: spboyer <7681382+spboyer@users.noreply.github.com> --- cli/azd/cmd/config.go | 101 ++++++++++++++++++++++++++ cli/azd/pkg/config/config_options.go | 34 +++++++++ cli/azd/resources/config_options.yaml | 51 +++++++++++++ cli/azd/resources/resources.go | 3 + 4 files changed, 189 insertions(+) create mode 100644 cli/azd/pkg/config/config_options.go create mode 100644 cli/azd/resources/config_options.yaml diff --git a/cli/azd/cmd/config.go b/cli/azd/cmd/config.go index 9f06cc19ded..c2742466aff 100644 --- a/cli/azd/cmd/config.go +++ b/cli/azd/cmd/config.go @@ -169,6 +169,17 @@ $ azd config set defaults.location eastus`, ActionResolver: newConfigListAlphaAction, }) + group.Add("options", &actions.ActionDescriptorOptions{ + Command: &cobra.Command{ + Short: "List all available configuration settings.", + Long: "List all possible configuration settings that can be set with azd, " + + "including descriptions and allowed values.", + }, + ActionResolver: newConfigOptionsAction, + OutputFormats: []output.Format{output.JsonFormat, output.TableFormat}, + DefaultFormat: output.TableFormat, + }) + return group } @@ -510,3 +521,93 @@ func getCmdListAlphaHelpFooter(*cobra.Command) string { ), }) } + +// azd config options + +type configOptionsAction struct { + console input.Console + formatter output.Formatter + writer io.Writer + args []string +} + +func newConfigOptionsAction( + console input.Console, + formatter output.Formatter, + writer io.Writer, + args []string) actions.Action { + return &configOptionsAction{ + console: console, + formatter: formatter, + writer: writer, + args: args, + } +} + +func (a *configOptionsAction) Run(ctx context.Context) (*actions.ActionResult, error) { + options := config.GetAllConfigOptions() + + if a.formatter.Kind() == output.JsonFormat { + err := a.formatter.Format(options, a.writer, nil) + if err != nil { + return nil, fmt.Errorf("failed formatting config options: %w", err) + } + return nil, nil + } + + // Table format + type tableRow struct { + Key string + Description string + Type string + AllowedValues string + Example string + } + + var rows []tableRow + for _, option := range options { + allowedValues := "" + if len(option.AllowedValues) > 0 { + allowedValues = strings.Join(option.AllowedValues, ", ") + } + rows = append(rows, tableRow{ + Key: option.Key, + Description: option.Description, + Type: option.Type, + AllowedValues: allowedValues, + Example: option.Example, + }) + } + + columns := []output.Column{ + { + Heading: "Key", + ValueTemplate: "{{.Key}}", + }, + { + Heading: "Description", + ValueTemplate: "{{.Description}}", + }, + { + Heading: "Type", + ValueTemplate: "{{.Type}}", + }, + { + Heading: "Allowed Values", + ValueTemplate: "{{.AllowedValues}}", + }, + { + Heading: "Example", + ValueTemplate: "{{.Example}}", + }, + } + + err := a.formatter.Format(rows, a.writer, output.TableFormatterOptions{ + Columns: columns, + }) + if err != nil { + return nil, fmt.Errorf("failed formatting config options: %w", err) + } + + return nil, nil +} diff --git a/cli/azd/pkg/config/config_options.go b/cli/azd/pkg/config/config_options.go new file mode 100644 index 00000000000..a552c9800fe --- /dev/null +++ b/cli/azd/pkg/config/config_options.go @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package config + +import ( + "log" + + "github.com/azure/azure-dev/cli/azd/resources" + "github.com/braydonk/yaml" +) + +// ConfigOption defines a configuration setting that can be set in azd config +type ConfigOption struct { + Key string `yaml:"key"` + Description string `yaml:"description"` + Type string `yaml:"type"` + AllowedValues []string `yaml:"allowedValues,omitempty"` + Example string `yaml:"example,omitempty"` +} + +var allConfigOptions []ConfigOption + +func init() { + err := yaml.Unmarshal(resources.ConfigOptions, &allConfigOptions) + if err != nil { + log.Panic("Can't unmarshal config options! %w", err) + } +} + +// GetAllConfigOptions returns all available configuration options +func GetAllConfigOptions() []ConfigOption { + return allConfigOptions +} diff --git a/cli/azd/resources/config_options.yaml b/cli/azd/resources/config_options.yaml new file mode 100644 index 00000000000..7a3e9b705b8 --- /dev/null +++ b/cli/azd/resources/config_options.yaml @@ -0,0 +1,51 @@ +- key: defaults.subscription + description: "Default Azure subscription ID to use for operations." + type: string + example: "00000000-0000-0000-0000-000000000000" +- key: defaults.location + description: "Default Azure location/region to use for deployments." + type: string + example: "eastus" +- key: alpha.all + description: "Enable or disable all alpha features at once." + type: string + allowedValues: ["on", "off"] +- key: alpha.aks.helm + description: "Enable Helm support for AKS deployments." + type: string + allowedValues: ["on", "off"] +- key: alpha.aks.kustomize + description: "Enable Kustomize support for AKS deployments." + type: string + allowedValues: ["on", "off"] +- key: alpha.aca.persistDomains + description: "Do not change custom domains when deploying Azure Container Apps." + type: string + allowedValues: ["on", "off"] +- key: alpha.azd.operations + description: "Extends provisioning providers with azd operations." + type: string + allowedValues: ["on", "off"] +- key: alpha.aca.persistIngressSessionAffinity + description: "Do not change Ingress Session Affinity when deploying Azure Container Apps." + type: string + allowedValues: ["on", "off"] +- key: alpha.deployment.stacks + description: "Enables Azure deployment stacks for ARM/Bicep based deployments." + type: string + allowedValues: ["on", "off"] +- key: alpha.llm + description: "Enables the use of LLMs in the CLI." + type: string + allowedValues: ["on", "off"] +- key: alpha.language.custom + description: "Enables support for services to use custom language." + type: string + allowedValues: ["on", "off"] +- key: template.sources + description: "Custom template sources for azd template list and azd init." + type: object + example: "template.sources..type" +- key: pipeline.config.applicationServiceManagementReference + description: "Application Service Management Reference for Azure pipeline configuration." + type: string diff --git a/cli/azd/resources/resources.go b/cli/azd/resources/resources.go index dd28cbe3739..c3b7ef201f4 100644 --- a/cli/azd/resources/resources.go +++ b/cli/azd/resources/resources.go @@ -13,6 +13,9 @@ var TemplatesJson []byte //go:embed alpha_features.yaml var AlphaFeatures []byte +//go:embed config_options.yaml +var ConfigOptions []byte + //go:embed minimal/main.bicep var MinimalBicep []byte From f4aaa3a402408e42b29bb20092786726b2f2e67f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Dec 2025 18:06:13 +0000 Subject: [PATCH 3/8] Add tests and snapshot updates for config options command Co-authored-by: spboyer <7681382+spboyer@users.noreply.github.com> --- .../TestUsage-azd-config-options.snap | 16 +++++ .../cmd/testdata/TestUsage-azd-config.snap | 1 + cli/azd/pkg/config/config_options_test.go | 68 +++++++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 cli/azd/cmd/testdata/TestUsage-azd-config-options.snap create mode 100644 cli/azd/pkg/config/config_options_test.go diff --git a/cli/azd/cmd/testdata/TestUsage-azd-config-options.snap b/cli/azd/cmd/testdata/TestUsage-azd-config-options.snap new file mode 100644 index 00000000000..1a3f54831c2 --- /dev/null +++ b/cli/azd/cmd/testdata/TestUsage-azd-config-options.snap @@ -0,0 +1,16 @@ + +List all available configuration settings. + +Usage + azd config options [flags] + +Global Flags + -C, --cwd string : Sets the current working directory. + --debug : Enables debugging and diagnostics logging. + --docs : Opens the documentation for azd config options in your web browser. + -h, --help : Gets help for options. + --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-config.snap b/cli/azd/cmd/testdata/TestUsage-azd-config.snap index 671d9e0476d..a8540bd7c0a 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-config.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-config.snap @@ -11,6 +11,7 @@ Usage Available Commands get : Gets a configuration. list-alpha : Display the list of available features in alpha stage. + options : List all available configuration settings. reset : Resets configuration to default. set : Sets a configuration. show : Show all the configuration values. diff --git a/cli/azd/pkg/config/config_options_test.go b/cli/azd/pkg/config/config_options_test.go new file mode 100644 index 00000000000..6f529ed47d0 --- /dev/null +++ b/cli/azd/pkg/config/config_options_test.go @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package config + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestGetAllConfigOptions(t *testing.T) { + options := GetAllConfigOptions() + + // Should have at least some options + require.NotEmpty(t, options) + require.Greater(t, len(options), 0) + + // Check that we have the expected default options + foundDefaultsSubscription := false + foundDefaultsLocation := false + foundAlphaAll := false + + for _, option := range options { + require.NotEmpty(t, option.Key, "Config option key should not be empty") + require.NotEmpty(t, option.Description, "Config option description should not be empty") + require.NotEmpty(t, option.Type, "Config option type should not be empty") + + switch option.Key { + case "defaults.subscription": + foundDefaultsSubscription = true + require.Equal(t, "string", option.Type) + require.Contains(t, option.Description, "subscription") + case "defaults.location": + foundDefaultsLocation = true + require.Equal(t, "string", option.Type) + require.Contains(t, option.Description, "location") + case "alpha.all": + foundAlphaAll = true + require.Equal(t, "string", option.Type) + require.Contains(t, option.AllowedValues, "on") + require.Contains(t, option.AllowedValues, "off") + } + } + + // Verify expected options are present + require.True(t, foundDefaultsSubscription, "defaults.subscription option should be present") + require.True(t, foundDefaultsLocation, "defaults.location option should be present") + require.True(t, foundAlphaAll, "alpha.all option should be present") +} + +func TestConfigOptionStructure(t *testing.T) { + options := GetAllConfigOptions() + + for _, option := range options { + // All options should have required fields + require.NotEmpty(t, option.Key) + require.NotEmpty(t, option.Description) + require.NotEmpty(t, option.Type) + + // If AllowedValues is set, it should not be empty + if len(option.AllowedValues) > 0 { + for _, val := range option.AllowedValues { + require.NotEmpty(t, val, "Allowed value should not be empty") + } + } + } +} From 734ae360d88ea059f37e27ff9f3b709d1f3c91a6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Dec 2025 18:09:03 +0000 Subject: [PATCH 4/8] Fix log.Panic error formatting as per code review feedback Co-authored-by: spboyer <7681382+spboyer@users.noreply.github.com> --- cli/azd/pkg/config/config_options.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/azd/pkg/config/config_options.go b/cli/azd/pkg/config/config_options.go index a552c9800fe..f57ab7c7093 100644 --- a/cli/azd/pkg/config/config_options.go +++ b/cli/azd/pkg/config/config_options.go @@ -24,7 +24,7 @@ var allConfigOptions []ConfigOption func init() { err := yaml.Unmarshal(resources.ConfigOptions, &allConfigOptions) if err != nil { - log.Panic("Can't unmarshal config options! %w", err) + log.Panicf("Can't unmarshal config options! %v", err) } } From f20cebb86a3161b7e9fd72c8e0c9e98ed95eeb98 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Dec 2025 19:10:13 +0000 Subject: [PATCH 5/8] Add environment variable information to config options output Co-authored-by: spboyer <7681382+spboyer@users.noreply.github.com> --- cli/azd/cmd/config.go | 6 ++++++ cli/azd/pkg/config/config_options.go | 1 + cli/azd/pkg/config/config_options_test.go | 1 + cli/azd/resources/config_options.yaml | 13 +++++++++++++ 4 files changed, 21 insertions(+) diff --git a/cli/azd/cmd/config.go b/cli/azd/cmd/config.go index c2742466aff..d1cc2ca375d 100644 --- a/cli/azd/cmd/config.go +++ b/cli/azd/cmd/config.go @@ -561,6 +561,7 @@ func (a *configOptionsAction) Run(ctx context.Context) (*actions.ActionResult, e Description string Type string AllowedValues string + EnvVar string Example string } @@ -575,6 +576,7 @@ func (a *configOptionsAction) Run(ctx context.Context) (*actions.ActionResult, e Description: option.Description, Type: option.Type, AllowedValues: allowedValues, + EnvVar: option.EnvVar, Example: option.Example, }) } @@ -596,6 +598,10 @@ func (a *configOptionsAction) Run(ctx context.Context) (*actions.ActionResult, e Heading: "Allowed Values", ValueTemplate: "{{.AllowedValues}}", }, + { + Heading: "Environment Variable", + ValueTemplate: "{{.EnvVar}}", + }, { Heading: "Example", ValueTemplate: "{{.Example}}", diff --git a/cli/azd/pkg/config/config_options.go b/cli/azd/pkg/config/config_options.go index f57ab7c7093..e721ab857bf 100644 --- a/cli/azd/pkg/config/config_options.go +++ b/cli/azd/pkg/config/config_options.go @@ -17,6 +17,7 @@ type ConfigOption struct { Type string `yaml:"type"` AllowedValues []string `yaml:"allowedValues,omitempty"` Example string `yaml:"example,omitempty"` + EnvVar string `yaml:"envVar,omitempty"` } var allConfigOptions []ConfigOption diff --git a/cli/azd/pkg/config/config_options_test.go b/cli/azd/pkg/config/config_options_test.go index 6f529ed47d0..eb09650c582 100644 --- a/cli/azd/pkg/config/config_options_test.go +++ b/cli/azd/pkg/config/config_options_test.go @@ -40,6 +40,7 @@ func TestGetAllConfigOptions(t *testing.T) { require.Equal(t, "string", option.Type) require.Contains(t, option.AllowedValues, "on") require.Contains(t, option.AllowedValues, "off") + require.Equal(t, "AZD_ALPHA_ENABLE_ALL", option.EnvVar) } } diff --git a/cli/azd/resources/config_options.yaml b/cli/azd/resources/config_options.yaml index 7a3e9b705b8..0bf7b3a2749 100644 --- a/cli/azd/resources/config_options.yaml +++ b/cli/azd/resources/config_options.yaml @@ -10,38 +10,47 @@ description: "Enable or disable all alpha features at once." type: string allowedValues: ["on", "off"] + envVar: "AZD_ALPHA_ENABLE_ALL" - key: alpha.aks.helm description: "Enable Helm support for AKS deployments." type: string allowedValues: ["on", "off"] + envVar: "AZD_ALPHA_ENABLE_AKS_HELM" - key: alpha.aks.kustomize description: "Enable Kustomize support for AKS deployments." type: string allowedValues: ["on", "off"] + envVar: "AZD_ALPHA_ENABLE_AKS_KUSTOMIZE" - key: alpha.aca.persistDomains description: "Do not change custom domains when deploying Azure Container Apps." type: string allowedValues: ["on", "off"] + envVar: "AZD_ALPHA_ENABLE_ACA_PERSISTDOMAINS" - key: alpha.azd.operations description: "Extends provisioning providers with azd operations." type: string allowedValues: ["on", "off"] + envVar: "AZD_ALPHA_ENABLE_AZD_OPERATIONS" - key: alpha.aca.persistIngressSessionAffinity description: "Do not change Ingress Session Affinity when deploying Azure Container Apps." type: string allowedValues: ["on", "off"] + envVar: "AZD_ALPHA_ENABLE_ACA_PERSISTINGRESSSESSIONAFFINITY" - key: alpha.deployment.stacks description: "Enables Azure deployment stacks for ARM/Bicep based deployments." type: string allowedValues: ["on", "off"] + envVar: "AZD_ALPHA_ENABLE_DEPLOYMENT_STACKS" - key: alpha.llm description: "Enables the use of LLMs in the CLI." type: string allowedValues: ["on", "off"] + envVar: "AZD_ALPHA_ENABLE_LLM" - key: alpha.language.custom description: "Enables support for services to use custom language." type: string allowedValues: ["on", "off"] + envVar: "AZD_ALPHA_ENABLE_LANGUAGE_CUSTOM" - key: template.sources description: "Custom template sources for azd template list and azd init." type: object @@ -49,3 +58,7 @@ - key: pipeline.config.applicationServiceManagementReference description: "Application Service Management Reference for Azure pipeline configuration." type: string +- key: (env) AZD_CONFIG_DIR + description: "Override the default configuration directory location." + type: envvar + example: "/path/to/config" From 6accc32eae736bf419866e1b6b7bf151cc8a34e7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Dec 2025 19:45:53 +0000 Subject: [PATCH 6/8] Add Current Value column to config options table output Co-authored-by: spboyer <7681382+spboyer@users.noreply.github.com> --- cli/azd/cmd/config.go | 54 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/cli/azd/cmd/config.go b/cli/azd/cmd/config.go index d1cc2ca375d..2a9184092b3 100644 --- a/cli/azd/cmd/config.go +++ b/cli/azd/cmd/config.go @@ -525,28 +525,38 @@ func getCmdListAlphaHelpFooter(*cobra.Command) string { // azd config options type configOptionsAction struct { - console input.Console - formatter output.Formatter - writer io.Writer - args []string + console input.Console + formatter output.Formatter + writer io.Writer + configManager config.UserConfigManager + args []string } func newConfigOptionsAction( console input.Console, formatter output.Formatter, writer io.Writer, + configManager config.UserConfigManager, args []string) actions.Action { return &configOptionsAction{ - console: console, - formatter: formatter, - writer: writer, - args: args, + console: console, + formatter: formatter, + writer: writer, + configManager: configManager, + args: args, } } func (a *configOptionsAction) Run(ctx context.Context) (*actions.ActionResult, error) { options := config.GetAllConfigOptions() + // Load current config to show current values + currentConfig, err := a.configManager.Load() + if err != nil { + // If config doesn't exist or can't be loaded, continue with empty config + currentConfig = config.NewEmptyConfig() + } + if a.formatter.Kind() == output.JsonFormat { err := a.formatter.Format(options, a.writer, nil) if err != nil { @@ -560,6 +570,7 @@ func (a *configOptionsAction) Run(ctx context.Context) (*actions.ActionResult, e Key string Description string Type string + CurrentValue string AllowedValues string EnvVar string Example string @@ -571,10 +582,31 @@ func (a *configOptionsAction) Run(ctx context.Context) (*actions.ActionResult, e if len(option.AllowedValues) > 0 { allowedValues = strings.Join(option.AllowedValues, ", ") } + + // Get current value from config + currentValue := "" + // Skip environment-only variables (those with keys starting with "(env)") + if !strings.HasPrefix(option.Key, "(env)") { + if val, ok := currentConfig.Get(option.Key); ok { + // Convert value to string representation + switch v := val.(type) { + case string: + currentValue = v + case map[string]any: + currentValue = "" + case []any: + currentValue = "" + default: + currentValue = fmt.Sprintf("%v", v) + } + } + } + rows = append(rows, tableRow{ Key: option.Key, Description: option.Description, Type: option.Type, + CurrentValue: currentValue, AllowedValues: allowedValues, EnvVar: option.EnvVar, Example: option.Example, @@ -594,6 +626,10 @@ func (a *configOptionsAction) Run(ctx context.Context) (*actions.ActionResult, e Heading: "Type", ValueTemplate: "{{.Type}}", }, + { + Heading: "Current Value", + ValueTemplate: "{{.CurrentValue}}", + }, { Heading: "Allowed Values", ValueTemplate: "{{.AllowedValues}}", @@ -608,7 +644,7 @@ func (a *configOptionsAction) Run(ctx context.Context) (*actions.ActionResult, e }, } - err := a.formatter.Format(rows, a.writer, output.TableFormatterOptions{ + err = a.formatter.Format(rows, a.writer, output.TableFormatterOptions{ Columns: columns, }) if err != nil { From cf82fd03a2ce1e1c154903aee934ce3b6f485ed3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 2 Jan 2026 23:53:35 +0000 Subject: [PATCH 7/8] Address code review feedback and fix figspec snapshot test - Define EnvOnlyPrefix constant for environment-only config keys - Improve error handling to log non-NotExist errors instead of silently ignoring - Update figspec test snapshots for new config options command - Use constant instead of magic string for environment-only check Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com> --- cli/azd/cmd/config.go | 11 ++++++++--- cli/azd/cmd/testdata/TestFigSpec.ts | 8 ++++++++ cli/azd/pkg/config/config_options.go | 3 +++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/cli/azd/cmd/config.go b/cli/azd/cmd/config.go index 2a9184092b3..c637b2de300 100644 --- a/cli/azd/cmd/config.go +++ b/cli/azd/cmd/config.go @@ -8,6 +8,7 @@ import ( "fmt" "io" "maps" + "os" "path/filepath" "runtime" "slices" @@ -553,7 +554,11 @@ func (a *configOptionsAction) Run(ctx context.Context) (*actions.ActionResult, e // Load current config to show current values currentConfig, err := a.configManager.Load() if err != nil { - // If config doesn't exist or can't be loaded, continue with empty config + // Only ignore "file not found" errors; other errors should be logged + if !os.IsNotExist(err) { + // Log the error but continue with empty config to ensure the command still works + fmt.Fprintf(a.console.Handles().Stderr, "Warning: failed to load config: %v\n", err) + } currentConfig = config.NewEmptyConfig() } @@ -585,8 +590,8 @@ func (a *configOptionsAction) Run(ctx context.Context) (*actions.ActionResult, e // Get current value from config currentValue := "" - // Skip environment-only variables (those with keys starting with "(env)") - if !strings.HasPrefix(option.Key, "(env)") { + // Skip environment-only variables (those with keys starting with EnvOnlyPrefix) + if !strings.HasPrefix(option.Key, config.EnvOnlyPrefix) { if val, ok := currentConfig.Get(option.Key); ok { // Convert value to string representation switch v := val.(type) { diff --git a/cli/azd/cmd/testdata/TestFigSpec.ts b/cli/azd/cmd/testdata/TestFigSpec.ts index 11f41f1eb82..bd1184173f9 100644 --- a/cli/azd/cmd/testdata/TestFigSpec.ts +++ b/cli/azd/cmd/testdata/TestFigSpec.ts @@ -324,6 +324,10 @@ const completionSpec: Fig.Spec = { name: ['list-alpha'], description: 'Display the list of available features in alpha stage.', }, + { + name: ['options'], + description: 'List all available configuration settings.', + }, { name: ['reset'], description: 'Resets configuration to default.', @@ -1584,6 +1588,10 @@ const completionSpec: Fig.Spec = { name: ['list-alpha'], description: 'Display the list of available features in alpha stage.', }, + { + name: ['options'], + description: 'List all available configuration settings.', + }, { name: ['reset'], description: 'Resets configuration to default.', diff --git a/cli/azd/pkg/config/config_options.go b/cli/azd/pkg/config/config_options.go index e721ab857bf..f6401ec683e 100644 --- a/cli/azd/pkg/config/config_options.go +++ b/cli/azd/pkg/config/config_options.go @@ -10,6 +10,9 @@ import ( "github.com/braydonk/yaml" ) +// EnvOnlyPrefix is the prefix used to mark environment-only configuration options +const EnvOnlyPrefix = "(env) " + // ConfigOption defines a configuration setting that can be set in azd config type ConfigOption struct { Key string `yaml:"key"` From 2baf73ed2b7f634c4c42f3d70dcd6120768d3cfa Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 8 Jan 2026 18:03:09 +0000 Subject: [PATCH 8/8] Add help examples for azd config options command - Add getCmdConfigOptionsHelpFooter function with usage examples - Include examples for table format, JSON format, and setting config values - Update usage test snapshots to include new help examples - Improves discoverability and user experience for the new command Co-authored-by: spboyer <7681382+spboyer@users.noreply.github.com> --- cli/azd/cmd/config.go | 18 ++++++++++++++++++ .../testdata/TestUsage-azd-config-options.snap | 11 ++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/cli/azd/cmd/config.go b/cli/azd/cmd/config.go index c637b2de300..e9366247504 100644 --- a/cli/azd/cmd/config.go +++ b/cli/azd/cmd/config.go @@ -176,6 +176,9 @@ $ azd config set defaults.location eastus`, Long: "List all possible configuration settings that can be set with azd, " + "including descriptions and allowed values.", }, + HelpOptions: actions.ActionHelpOptions{ + Footer: getCmdConfigOptionsHelpFooter, + }, ActionResolver: newConfigOptionsAction, OutputFormats: []output.Format{output.JsonFormat, output.TableFormat}, DefaultFormat: output.TableFormat, @@ -523,6 +526,21 @@ func getCmdListAlphaHelpFooter(*cobra.Command) string { }) } +func getCmdConfigOptionsHelpFooter(*cobra.Command) string { + return generateCmdHelpSamplesBlock(map[string]string{ + "List all available configuration settings in table format": output.WithHighLightFormat( + "azd config options", + ), + "List all available configuration settings in JSON format": output.WithHighLightFormat( + "azd config options -o json", + ), + "View a setting and set it": output.WithHighLightFormat( + "azd config options") + "\n " + output.WithHighLightFormat( + "azd config set ", + ), + }) +} + // azd config options type configOptionsAction struct { diff --git a/cli/azd/cmd/testdata/TestUsage-azd-config-options.snap b/cli/azd/cmd/testdata/TestUsage-azd-config-options.snap index 1a3f54831c2..79bebb97bdd 100644 --- a/cli/azd/cmd/testdata/TestUsage-azd-config-options.snap +++ b/cli/azd/cmd/testdata/TestUsage-azd-config-options.snap @@ -11,6 +11,15 @@ Global Flags -h, --help : Gets help for options. --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. +Examples + List all available configuration settings in JSON format + azd config options -o json + + List all available configuration settings in table format + azd config options + + View a setting and set it + azd config options + azd config set