Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion cli/azd/cmd/middleware/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")),
Expand Down Expand Up @@ -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")),
Expand Down Expand Up @@ -311,6 +313,7 @@ func (e *ErrorMiddleware) checkErrorHandlingConsent(
ctx context.Context,
promptName string,
message string,
consentMessage string,
helpMessage string,
skip bool,
) (bool, error) {
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,4 +410,58 @@ az cognitiveservices account show --name <account-name> --resource-group <resour

# Example 3: List all Cognitive Services accounts in a resource group
az cognitiveservices account list --resource-group <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 <new-region>`

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
```
Loading