Skip to content

Add interactive selector to azd env select when no environment specified#6347

Merged
vhvb1989 merged 5 commits into
mainfrom
copilot/add-cli-selector-command
Dec 12, 2025
Merged

Add interactive selector to azd env select when no environment specified#6347
vhvb1989 merged 5 commits into
mainfrom
copilot/add-cli-selector-command

Conversation

Copilot AI commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

Running azd env select without arguments required users to first run azd env list, then copy-paste the environment name. This adds an interactive picker when no argument is provided.

Changes

  • Modified azd env select to accept 0 or 1 arguments (previously required exactly 1)
  • Added interactive environment selection using console.Select() when no argument provided
  • Shows error with usage guidance when no environments exist
  • Updated command snapshots for help text and Fig autocomplete

Behavior

Before:

$ azd env select
Error: accepts 1 arg(s), received 0

After:

$ azd env select
? Select an environment:
  > dev
    staging
    prod

Explicit environment argument continues to work unchanged: azd env select dev

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • aka.ms
    • Triggering command: ./azd ./azd env select --help -goversion go1.25.4 -c=4 -nolocalimports -importcfg /tmp/go-build417905578/b936/importcfg -pack /tmp/go-build417905578/b936/_testmain.go -o xy0hPX0R_ pkg/mod/github.c-ifaceassert x_amd64/vet -p g/grpc/balancer/-o -lang=go1.20 x_amd64/vet (dns block)
    • Triggering command: /home/REDACTED/work/azure-dev/azure-dev/cli/azd/azd /home/REDACTED/work/azure-dev/azure-dev/cli/azd/azd env list x_amd64/vet -W I-novOX3- e-dev/cli/azd/in-ifaceassert x_amd64/vet . AADBbUda53gb --64 x_amd64/vet -I rg/x/text@v0.31.-errorsas cfg x_amd64/vet -pthread /azure-dev/cli/a--norc -fmessage-length--noprofile x_amd64/vet (dns block)
    • Triggering command: /home/REDACTED/work/azure-dev/azure-dev/cli/azd/azd /home/REDACTED/work/azure-dev/azure-dev/cli/azd/azd telemetry upload x_amd64/vet -W m6ga06Zhy e-dev/cli/azd/pk-ifaceassert x_amd64/vet . /trace --64 x_amd64/vet -qui�� om/tmc/langchain-errorsas cfg x_amd64/vet /tmp/go-build282bash /azure-dev/cli/a--norc x86_64-linux-gnu--noprofile x_amd64/vet (dns block)
  • code.cloudfoundry.org
    • Triggering command: /update-job-proxy /update-job-proxy -o br-54cf780eb562 -j DROP si_-_Surum_1.pem bash (dns block)
  • dario.cat
    • Triggering command: /update-job-proxy /update-job-proxy -o br-54cf780eb562 -j DROP si_-_Surum_1.pem bash (dns block)
  • go.googlesource.com
    • Triggering command: /update-job-proxy /update-job-proxy -o br-54cf780eb562 -j DROP si_-_Surum_1.pem bash (dns block)
  • go.opentelemetry.io
    • Triggering command: /update-job-proxy /update-job-proxy -o br-54cf780eb562 -j DROP si_-_Surum_1.pem bash (dns block)
  • go.uber.org
    • Triggering command: /update-job-proxy /update-job-proxy -o br-54cf780eb562 -j DROP si_-_Surum_1.pem bash (dns block)
  • go.yaml.in
    • Triggering command: /update-job-proxy /update-job-proxy -o br-54cf780eb562 -j DROP si_-_Surum_1.pem bash (dns block)
  • google.golang.org
    • Triggering command: /update-job-proxy /update-job-proxy -o br-54cf780eb562 -j DROP si_-_Surum_1.pem bash (dns block)
  • gopkg.in
    • Triggering command: /update-job-proxy /update-job-proxy -o br-54cf780eb562 -j DROP si_-_Surum_1.pem bash (dns block)
  • westus-0.in.applicationinsights.azure.com
    • Triggering command: /home/REDACTED/work/azure-dev/azure-dev/cli/azd/azd /home/REDACTED/work/azure-dev/azure-dev/cli/azd/azd telemetry upload x_amd64/vet -W m6ga06Zhy e-dev/cli/azd/pk-ifaceassert x_amd64/vet . /trace --64 x_amd64/vet -qui�� om/tmc/langchain-errorsas cfg x_amd64/vet /tmp/go-build282bash /azure-dev/cli/a--norc x86_64-linux-gnu--noprofile x_amd64/vet (dns block)
    • Triggering command: /home/REDACTED/work/azure-dev/azure-dev/cli/azd/azd /home/REDACTED/work/azure-dev/azure-dev/cli/azd/azd telemetry upload x_amd64/vet -W g_.a ache/go/1.25.4/x-ifaceassert x_amd64/vet . g/grpc/balancer/-atomic --64 x_amd64/vet -o vI3C4Mw7k cfg x_amd64/vet -p /azure-dev/cli/a--norc -lang=go1.25 x_amd64/vet (dns block)
    • Triggering command: /home/REDACTED/work/azure-dev/azure-dev/cli/azd/azd /home/REDACTED/work/azure-dev/azure-dev/cli/azd/azd telemetry upload x_amd64/vet -W g_.a e-dev/cli/azd/pk-ifaceassert x_amd64/vet . er --64 x_amd64/vet -o 3yaG8H3ma om/pelletier/go-github.com/azure/azure-dev/cli/azd/extensions/microsoft.azd.extensions/internal/--norc h -p uments -lang=go1.22 x_amd64/vet (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>[Feature] Add CLI selector to azd env select command</issue_title>
<issue_description>Please can the azd env select command have a CLI picker (like the environment selector)

$ azd env select                                 
Error: accepts 1 arg(s), received 0

Means you have to type azd env list then copy+paste the environment name to the argument of the azd env select command.

It would be simpler for the command to list the environments if no argument was specified and the user can select using a number or using a keyboard. </issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Dec 10, 2025
Copilot AI and others added 4 commits December 10, 2025 01:16
- Modified newEnvSelectCmd to accept 0 or 1 arguments
- Added console parameter to envSelectAction for interactive prompts
- Implemented environment selection prompt when no argument is provided
- Maintains backward compatibility with explicit environment argument
- Shows helpful error message when no environments exist

Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com>
- Updated TestUsage snapshot to reflect optional environment argument
- Updated TestFigSpec autocomplete spec with isOptional flag

Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com>
Make error message more explicit by including <environment-name> placeholder

Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com>
Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com>
Copilot AI changed the title [WIP] Add CLI selector to azd env select command Add interactive selector to azd env select when no environment specified Dec 10, 2025
Copilot AI requested a review from vhvb1989 December 10, 2025 01:34
@vhvb1989
vhvb1989 marked this pull request as ready for review December 10, 2025 03:31
@vhvb1989

Copy link
Copy Markdown
Member

/check-enforcer override

@vhvb1989
vhvb1989 enabled auto-merge (squash) December 12, 2025 18:49
@vhvb1989
vhvb1989 merged commit 99d6620 into main Dec 12, 2025
18 of 23 checks passed
@JeffreyCA
JeffreyCA deleted the copilot/add-cli-selector-command branch January 16, 2026 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Add CLI selector to azd env select command

3 participants