Skip to content

Improve error message for "resource not found" when resource group has been manually deleted (suggest --no-state workaround) #5667

@Be3751

Description

@Be3751
  • Make sure you've installed the latest version using instructions

Describe the bug
When running azd up, if the target resource group has been manually deleted by the user (e.g., via Azure Portal or CLI), the command fails with an error like:

  (-) Skipped: Didn't find new changes.

Deploying services (azd deploy)

  (x) Failed: Deploying service checkout-worker

ERROR: error executing step command 'deploy --all': getting target resource: getting default resource groups for environment: aca-otel-tracing: resource not found: 0 resource groups with prefix or suffix with value: 'aca-otel-tracing'

Currently, the error message does not provide guidance on how to resolve this situation.

In fact, running azd provision --no-state allows the user to ignore the cached state and successfully re-provision the resources. However, this workaround is not obvious to most users.

To Reproduce

  1. Run azd up to create an environment.
  2. Delete the resource group manually in the Azure Portal or with az group delete.
  3. Run azd up again.
  4. Observe the resource not found error without clear recovery instructions.

Expected behavior
The error message should include a hint such as:

"If the resource group was manually deleted, try running azd provision --no-state to re-create the resources."

This would improve the user experience by making the workaround discoverable and reducing friction.

Environment

  • Language: Python 3.11.10
  • IDE: VS Code 1.103.1
  • OS: Windows 11 / WSL2 (Ubuntu 22.04.3)

Additional context
This issue is related to #3559 and #3771, where the inability to detect deleted resources has been discussed.
This proposal does not aim to solve the detection logic itself, but rather to improve the user experience by surfacing the existing workaround (--no-state) in the error message.

I am considering submitting a PR for this change, but I wanted to confirm the team’s direction first.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions