You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This pull request introduces a new PowerShell-based AI recovery feature for AzCLIPS, adding two new cmdlets and supporting infrastructure to help users recover from errors by sending diagnostic data to Azure AI and retrieving recovery advice. It also includes new embedded prompt templates, comprehensive help documentation, and tests.
Added two new cmdlets: Get-AzRecoveryId (lists recent AzCLIPS errors with recovery IDs) and Send-AzRecovery (sends a selected error to Azure AI for troubleshooting advice). [1][2][3]
Added embedded prompt templates for both "oneshot" and "interactive" recovery sessions, guiding Azure AI to provide context-appropriate troubleshooting advice based on the existing markdown templates for az cli recovery commands. [1][2]
Added PlatyPS-based help files for both Get-AzRecoveryId and Send-AzRecovery, including syntax, usage, and parameter details. [1][2]
Testing Guide
Introduced tests for the new recovery cmdlets, covering error listing, ID stability, and correct AI prompt selection and posting.
The PR title starts with [Component Name] for customer-facing changes or {Component Name} for non-customer-facing changes, and does not end with trailing punctuation or spaces.
Customer-facing changes include a useful release note in the PR title or the History Notes section.
I added or updated tests for behavior changes.
I updated documentation when behavior, setup, support, or security guidance changed.
Azure Pipelines:
5 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Recovery IDs survive configuration resets, interactive recovery can hide answers or fail in noninteractive hosts, and requests omit diagnostic context and reasoning settings.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Raw error text can send secret query parameters to the model without informed confirmation, and interactive recovery and configuration handling have unresolved defects.
$Error is a mutable collection, and WriteObject runs downstream pipeline commands while this enumeration is still in progress. For example, Get-AzRecoveryId | ForEach-Object { Write-Error $_.Error } adds to $Error and invalidates the enumerator after the first result. Snapshot the entries before yielding them so downstream errors do not abort the listing.
Document the Az.Config dependency for enabling recovery
Set-AzConfig is exported by the separately installed preview Az.Config module, not by Az.Accounts. Standalone Accounts or leaf-module users therefore cannot follow these instructions to enable recovery, which defaults to off. Mention installing/importing the preview Config module here and in help/Send-AzRecovery.md:34–35.
Refresh the access token before each interactive request
accessToken is acquired once before the interactive loop and reused after arbitrary time spent at ReadLine(). If it expires while the user runs a suggested check, the next follow-up fails with 401 and the in-memory conversation is lost. Acquire a current token before each model request, using the auth service's token cache to refresh it when needed.
Include sanitized service error details in HTTP failures
When Azure AI rejects the configured model or API settings, EnsureSuccessStatusCode() reports only a status such as 400 Bad Request, omitting the service's error code and explanation. Surface a sanitized service error code/message and retain the HTTP status, with a fallback for non-JSON error bodies.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Recovery can send sensitive errors without review and restore errors from outside the opted-in history, while missing invocation context and reasoning settings and broken interactive handling impair diagnostics.
Snapshot recovery errors before output, suggest parameter names, and surface Azure AI error details with an HTTP status fallback. Remove the shared recovery reset hook to keep the PR scoped to the PowerShell recovery cmdlets.
Deferred (Azure#1484): turning recovery off does not invalidate PowerShell recovery IDs because tracking resets would require changes outside those cmdlets. HTTP status and service error codes are not reliably preserved because the existing error pipeline discards structured metadata, and shared services are intentionally unchanged.
Azure AI service error messages are not secret-redacted, matching the CLI approach at the user request; they may contain sensitive information.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Recovery can send errors outside the opt-in/reset boundary, use the wrong tenant and regional endpoint, omit service error details, and fail when interactive tokens expire.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
resolves #1483
This pull request introduces a new PowerShell-based AI recovery feature for AzCLIPS, adding two new cmdlets and supporting infrastructure to help users recover from errors by sending diagnostic data to Azure AI and retrieving recovery advice. It also includes new embedded prompt templates, comprehensive help documentation, and tests.
Added two new cmdlets:
Get-AzRecoveryId(lists recent AzCLIPS errors with recovery IDs) andSend-AzRecovery(sends a selected error to Azure AI for troubleshooting advice). [1] [2] [3]Added embedded prompt templates for both "oneshot" and "interactive" recovery sessions, guiding Azure AI to provide context-appropriate troubleshooting advice based on the existing markdown templates for az cli recovery commands. [1] [2]
Added PlatyPS-based help files for both
Get-AzRecoveryIdandSend-AzRecovery, including syntax, usage, and parameter details. [1] [2]Testing Guide
[Component Name]for customer-facing changes or{Component Name}for non-customer-facing changes, and does not end with trailing punctuation or spaces.