From d489f16bb23900ceb5231b2871ba312f80e38dff Mon Sep 17 00:00:00 2001 From: hemarina Date: Tue, 17 Feb 2026 16:54:17 -0800 Subject: [PATCH] address feedback to add warning message, add sku eastus errors in mcp common error tool --- cli/azd/cmd/middleware/error.go | 13 ++++- .../prompts/azd_provision_common_error.md | 54 +++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/cli/azd/cmd/middleware/error.go b/cli/azd/cmd/middleware/error.go index 6f983574871..3b38cb4b8ec 100644 --- a/cli/azd/cmd/middleware/error.go +++ b/cli/azd/cmd/middleware/error.go @@ -156,6 +156,7 @@ func (e *ErrorMiddleware) Run(ctx context.Context, next NextFn) (*actions.Action ctx, "mcp.errorHandling.troubleshooting", fmt.Sprintf("Generate troubleshooting steps using %s?", agentName), + "Generate Troubleshooting Steps", fmt.Sprintf("This action will run AI tools to generate troubleshooting steps."+ " Edit permissions for AI tools anytime by running %s.", output.WithHighLightFormat("azd mcp consent")), @@ -191,6 +192,7 @@ func (e *ErrorMiddleware) Run(ctx context.Context, next NextFn) (*actions.Action ctx, "mcp.errorHandling.fix", fmt.Sprintf("Brainstorm solutions using %s?", agentName), + "Brainstorm Solutions", fmt.Sprintf("This action will run AI tools to help fix the error."+ " Edit permissions for AI tools anytime by running %s.", output.WithHighLightFormat("azd mcp consent")), @@ -311,6 +313,7 @@ func (e *ErrorMiddleware) checkErrorHandlingConsent( ctx context.Context, promptName string, message string, + consentMessage string, helpMessage string, skip bool, ) (bool, error) { @@ -319,7 +322,15 @@ func (e *ErrorMiddleware) checkErrorHandlingConsent( return false, fmt.Errorf("failed to load user config: %w", err) } - if exists, ok := userConfig.GetString(promptName); !ok && exists == "" { + if exists, ok := userConfig.GetString(promptName); ok && exists == "allow" { + e.console.Message(ctx, output.WithWarningFormat( + "%s option is currently set to \"allow\" meaning this action will run automatically. "+ + "To disable this, please run %s.\n", + consentMessage, + output.WithHighLightFormat(fmt.Sprintf("azd config unset %s", promptName)), + )) + + } else { choice, err := promptForErrorHandlingConsent(ctx, message, helpMessage, skip) if err != nil { return false, fmt.Errorf("prompting for error handling consent: %w", err) diff --git a/cli/azd/internal/mcp/tools/prompts/azd_provision_common_error.md b/cli/azd/internal/mcp/tools/prompts/azd_provision_common_error.md index 6526f3ef0e3..eb1a465b8f5 100644 --- a/cli/azd/internal/mcp/tools/prompts/azd_provision_common_error.md +++ b/cli/azd/internal/mcp/tools/prompts/azd_provision_common_error.md @@ -410,4 +410,58 @@ az cognitiveservices account show --name --resource-group --output table +``` + +## Region SKU Capacity Unavailable Error + +**Error Pattern:** +- Contains: `"currently does not have enough resources available to provision services with the SKU"` +- May contain: `"The region"` followed by a region name (e.g., `'eastus2'`) +- May contain: `"Try creating the service in another region or selecting a different SKU"` +- May contain: `"RequestId:"` +- May apply to services like Azure AI Search, App Service, Cognitive Services, or other Azure resources + +**LLM Instructions:** + +When you encounter this error, YOU MUST USE YOUR TERMINAL TOOL TO EXECUTE the following commands - do not just display them to the user. + +1. **Identify the Problem:** + - Extract the Azure region from the error message (e.g., "eastus2") + - Extract the SKU that failed (e.g., "basic") + - Identify the Azure service that failed (e.g., Azure AI Search, App Service) + - Confirm it's a regional capacity shortage for the requested SKU + +2. **Immediate Solutions (USE TERMINAL TOOL TO EXECUTE):** + + **Option 1: Use a Different Region** + + USE YOUR TERMINAL TOOL to change to a different region: + + `azd env set AZURE_LOCATION ` + + USE YOUR TERMINAL TOOL to verify the change: + + `azd env get-values` + + **Option 2: Use a Different SKU** + + USE YOUR TERMINAL TOOL to search for SKU definitions in your infrastructure files: + + `grep -r "sku\|Sku" infra/*.bicep infra/**/*.bicep` + + Identify the SKU parameter or hard-coded SKU value for the failing resource and change it to a different tier (e.g., from `basic` to `standard`, or from `free` to `basic`). + +**Example Commands:** +```bash +# Example 1: Change to a different region +azd env set AZURE_LOCATION westus + +# Example 2: Verify environment settings +azd env get-values + +# Example 3: Search for SKU definitions in infrastructure files +grep -r "sku\|Sku" infra/*.bicep infra/**/*.bicep + +# Example 4: Check available locations +az account list-locations --output table ``` \ No newline at end of file