Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 30, 2025

The --force flag was ignored when the installed version matched the target version, preventing recovery when extension files were missing but metadata indicated installation.

Reproduction:

azd ext install microsoft.azd.extensions  # Install extension
rm -rf ~/.azd/extensions/                  # Delete files, metadata remains
azd ext install microsoft.azd.extensions --force  # Skips: "version already installed"

Changes

  • Core logic (extension.go:628): Check --force flag before skipping same-version installs

    // Before: always skipped
    if installedExtension.Version == targetVersion {
    
    // After: skip only when force not set
    if installedExtension.Version == targetVersion && !a.flags.force {
  • Flag description (extension.go:536): Updated help text to reflect reinstall capability

    "Force installation, including downgrades and reinstalling the same version"
    

With --force, the extension now uses the upgrade path (uninstall + reinstall) to restore missing files.

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 version -stringintconv -tests /tmp/go-build2740150305/b249/vet.cfg esourcemanager/resourcegraph/armresourcegraph@v0.9.0/build.go ified extensionInstallAction.Run to check --force flag before skipping installation when the ins-atomic x_amd64/compile --gdwarf-5 nager/appconfigu-unsafeptr=false (dns block)
    • Triggering command: ./azd ./azd extension source add -n test-local -t file -l /home/REDACTED/work/azure-dev/azure-dev/cli/azd/extensions/registry.json -o 64/pkg/tool/linu/tmp/go-build2740150305/b212/vet.cfg -I 1.76.0/internal/resolver/delegat-p -I 64/pkg/tool/linux_amd64/compile --gdwarf-5 grpclog -o 64/pkg/tool/linu-buildtags (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 -tests /tmp/go-build2740150305/b296/vet.cfg 1.76.0/internal/grpclog/prefix_l-I -I 64/pkg/tool/linux_amd64/compile --gdwarf-5 ershell =0 64/pkg/tool/linu/tmp/go-build2740150305/b214/vet.cfg swit�� g/convert/util.go _3vczQfb- 64/pkg/tool/linux_amd64/compile --gdwarf-5 nal/encoding/jso-atomic p=/opt/hostedtoo-bool 64/pkg/tool/linu-buildtags (dns block)
  • code.cloudfoundry.org
    • Triggering command: /update-job-proxy /update-job-proxy -o br-a179c154df24 -j DOCKER-ISOLATION-STAGE-2 icrosec_e-Szigno_Root_CA_2009.pem /opt/hostedtoolc-e (dns block)
  • dario.cat
    • Triggering command: /update-job-proxy /update-job-proxy -o br-a179c154df24 -j DOCKER-ISOLATION-STAGE-2 icrosec_e-Szigno_Root_CA_2009.pem /opt/hostedtoolc-e (dns block)
  • go.googlesource.com
    • Triggering command: /update-job-proxy /update-job-proxy -o br-a179c154df24 -j DOCKER-ISOLATION-STAGE-2 icrosec_e-Szigno_Root_CA_2009.pem /opt/hostedtoolc-e (dns block)
  • go.lsp.dev
    • Triggering command: /update-job-proxy /update-job-proxy -o br-a179c154df24 -j DOCKER-ISOLATION-STAGE-2 icrosec_e-Szigno_Root_CA_2009.pem /opt/hostedtoolc-e (dns block)
  • go.opentelemetry.io
    • Triggering command: /update-job-proxy /update-job-proxy -o br-a179c154df24 -j DOCKER-ISOLATION-STAGE-2 icrosec_e-Szigno_Root_CA_2009.pem /opt/hostedtoolc-e (dns block)
  • go.starlark.net
    • Triggering command: /update-job-proxy /update-job-proxy -o br-a179c154df24 -j DOCKER-ISOLATION-STAGE-2 icrosec_e-Szigno_Root_CA_2009.pem /opt/hostedtoolc-e (dns block)
  • go.uber.org
    • Triggering command: /update-job-proxy /update-job-proxy -o br-a179c154df24 -j DOCKER-ISOLATION-STAGE-2 icrosec_e-Szigno_Root_CA_2009.pem /opt/hostedtoolc-e (dns block)
  • go.yaml.in
    • Triggering command: /update-job-proxy /update-job-proxy -o br-a179c154df24 -j DOCKER-ISOLATION-STAGE-2 icrosec_e-Szigno_Root_CA_2009.pem /opt/hostedtoolc-e (dns block)
  • google.golang.org
    • Triggering command: /update-job-proxy /update-job-proxy -o br-a179c154df24 -j DOCKER-ISOLATION-STAGE-2 icrosec_e-Szigno_Root_CA_2009.pem /opt/hostedtoolc-e (dns block)
  • gopkg.in
    • Triggering command: /update-job-proxy /update-job-proxy -o br-a179c154df24 -j DOCKER-ISOLATION-STAGE-2 icrosec_e-Szigno_Root_CA_2009.pem /opt/hostedtoolc-e (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 -tests /tmp/go-build2740150305/b296/vet.cfg 1.76.0/internal/grpclog/prefix_l-I -I 64/pkg/tool/linux_amd64/compile --gdwarf-5 ershell =0 64/pkg/tool/linu/tmp/go-build2740150305/b214/vet.cfg swit�� g/convert/util.go _3vczQfb- 64/pkg/tool/linux_amd64/compile --gdwarf-5 nal/encoding/jso-atomic p=/opt/hostedtoo-bool 64/pkg/tool/linu-buildtags (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 -tests /tmp/go-build2740150305/b336/vet.cfg uf@v1.36.10/proto/checkinit.go icy.go x_amd64/compile --gdwarf-5 (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 -tests /tmp/go-build2740150305/b335/vet.cfg (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>azd ext install --force should force install</issue_title>
<issue_description>Right now, it seems that running azd ext install --force only forces the version check downgrade, but does not install if the version is "up-to-date".

It may be extremely useful to have a --force option mean "always grab and patch regardless of what the local metadata says". This would help for recovery in cases where something bad has gone wrong on the user's machine, and the user needs a failsafe option to recover.

Repro:

  1. Delete ~/.azd/extensions/ directory
  2. Run azd ext install --force microsoft.azd.extensions

Expected: Installation should occur
Actual: Received the following skipped message.

Image</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 and others added 3 commits December 30, 2025 15:04
Modified extensionInstallAction.Run to check --force flag before skipping
installation when the installed version matches the target version. This
ensures that --force will reinstall even when version is already marked
as installed, which is critical for recovery when extension files are
missing.

Co-authored-by: spboyer <7681382+spboyer@users.noreply.github.com>
Updated the --force flag help text to clearly indicate it forces
installation including both downgrades AND reinstalling the same version.
This makes the flag's behavior more transparent to users.

Co-authored-by: spboyer <7681382+spboyer@users.noreply.github.com>
- End-to-end verification confirms fix works correctly
- Code review passed with no issues
- Security scan passed with 0 alerts
- All tests pass (extension package and cmd package)
- Help text updated and verified

Co-authored-by: spboyer <7681382+spboyer@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix force install option for azd ext command Fix azd ext install --force to reinstall when version matches Dec 30, 2025
Copilot AI requested a review from spboyer December 30, 2025 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

azd ext install --force should force install

2 participants