Improve error message when no subscriptions are found - #7046
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves the “no subscriptions found” experience by adding clearer, actionable guidance (especially for multi-tenant sign-in and MFA scenarios) via both the interactive prompt error text and the centralized error-suggestion pipeline.
Changes:
- Add a new
error_suggestions.yamlrule for matching “no subscriptions found” and providing next steps + docs link. - Update
PromptSubscription’s “no subscriptions found” error text to mention--tenant-idfor multi-tenant scenarios. - Add a pipeline test to verify the new YAML rule matches and returns the expected message/suggestion.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| cli/azd/resources/error_suggestions.yaml | Adds a new pattern-based rule for “no subscriptions found” with tenant/MFA guidance and a reference link. |
| cli/azd/pkg/prompt/prompter.go | Extends the subscription prompt error message with tenant-id guidance. |
| cli/azd/pkg/errorhandler/pipeline_test.go | Adds a test ensuring the new YAML rule is picked up and produces the expected output. |
Comments suppressed due to low confidence (1)
cli/azd/resources/error_suggestions.yaml:405
- This is a text-pattern-only rule (no errorType/properties), but it’s placed before the “Text Pattern Rules — Specific patterns first” section header. Since rules are ordered and the file is organized by rule type, consider moving this rule into the text-pattern section to keep the YAML structure consistent and easier to maintain.
# ============================================================================
# Subscription Errors
# ============================================================================
- patterns:
- "no subscriptions found"
message: "No Azure subscriptions were found for your account."
suggestion: >
Ensure you have an active subscription at https://portal.azure.com.
If you have multiple tenants, run 'azd auth login --tenant-id <tenant-id>'
to sign in to a specific tenant. Multi-factor authentication (MFA) may prevent
automatic access to all tenants — visit the Azure portal and switch to each tenant
to refresh your MFA sessions, then retry 'azd auth login'.
links:
- url: "https://learn.microsoft.com/azure/developer/azure-developer-cli/reference#azd-auth-login"
title: "azd auth login reference"
# ============================================================================
# Text Pattern Rules — Specific patterns first
# These are fallbacks for errors without typed Go structs.
# ============================================================================
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
wbreza
left a comment
There was a problem hiding this comment.
Code Review
Great work addressing issue #6419 — the MFA and multi-tenant scenario guidance is exactly the kind of actionable error messaging that improves the developer experience. The error suggestion YAML rule is well-structured and includes a helpful documentation link. 🎉
✅ What Looks Good
- Correctly leverages the
error_suggestions.yamlpipeline for error enrichment - YAML rule structure (patterns, message, suggestion, links) is consistent with existing rules
- MFA scenario guidance is thoughtful and addresses a real user pain point
- Test validates pattern matching through the standard pipeline approach
Findings Summary
| Priority | Count |
|---|---|
| High | 2 |
| Medium | 3 |
| Low | 1 |
| Total | 6 |
It would be great to establish a consistent model for custom error messages going forward — the inline error text in the Go code should stay minimal, and the YAML pipeline should own the enriched user-facing guidance. This keeps our error handling patterns clean and maintainable across the project.
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
* add error suggestion yml rule and actions in error message * address feedback
* add error suggestion yml rule and actions in error message * address feedback
* add error suggestion yml rule and actions in error message * address feedback
* add error suggestion yml rule and actions in error message * address feedback
* add error suggestion yml rule and actions in error message * address feedback
* add error suggestion yml rule and actions in error message * address feedback
* add error suggestion yml rule and actions in error message * address feedback
Fixes #6419
Description
When users run
azdcommands and no Azure subscriptions are found, the error message now includes actionable guidance for multi-tenant and MFA scenarios.Changes
azd auth login --tenant-id <tenant-id>for multi-tenant scenarios.azd auth logindocumentation.TestPipeline_NoSubscriptionsFoundto verify the YAML rule matches correctly.