This README covers the Azure OpenAI version of the AI‑Auto Troubleshooter.
Files:
aiauto_azure.ps1— PowerShell script that talks to Azure OpenAI Chat Completionsaiauto_azure.bat— Windows launcher that prompts for inputs and runs the PS1
- Windows 10/11 with PowerShell 5+
- Internet access to your Azure OpenAI resource
- Azure OpenAI resource with a deployed Chat model (e.g.,
gpt-4o-minior similar) - One Azure OpenAI API key
Set these once (Machine or User scope). The script reads Machine → User → Process.
AZURE_OPENAI_ENDPOINT—https://<your-resource>.openai.azure.comAZURE_OPENAI_DEPLOYMENT— The deployment name you created (not the base model name)AZURE_OPENAI_API_KEY— Your Azure OpenAI keyAZURE_OPENAI_API_VERSION— Optional. Defaults to2024-08-01-preview
REM Run an elevated Command Prompt
setx AZURE_OPENAI_ENDPOINT "https://your-resource.openai.azure.com" /M
setx AZURE_OPENAI_DEPLOYMENT "your-deployment" /M
setx AZURE_OPENAI_API_KEY "<your-key>" /M
setx AZURE_OPENAI_API_VERSION "2024-08-01-preview" /M
REM For the current window (without restarting):
set AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com
set AZURE_OPENAI_DEPLOYMENT=your-deployment
set AZURE_OPENAI_API_KEY=<your-key>
set AZURE_OPENAI_API_VERSION=2024-08-01-preview$env:AZURE_OPENAI_ENDPOINT = 'https://your-resource.openai.azure.com'
$env:AZURE_OPENAI_DEPLOYMENT = 'your-deployment'
$env:AZURE_OPENAI_API_KEY = '<your-key>'
$env:AZURE_OPENAI_API_VERSION = '2024-08-01-preview' # optional- Double‑click
aiauto_azure.bat - Enter the troubleshooting goal (e.g., "Investigate slowness")
- Adjust options (Max steps, per‑command timeout, flags)
- Script runs and then opens the report in Notepad
powershell -ExecutionPolicy Bypass -File .\aiauto_azure.ps1 \
-Goal "Investigate slowness" \
-MaxSteps 5 \
-CmdTimeoutSec 45 \
-AllowMaintenance \
-AllowKillAll parameters are optional except -Goal. If omitted, defaults are used.
-AllowMaintenance: Enables safe maintenance (SFC/DISM, service restarts)-AllowKill: Allows targeted process kills by PID (taskkill /PID <n>,Stop-Process -Id <n>)-AllowDangerous: Operator override. Still blocks hard‑denied commands-MaxSteps: Max AI planning loop iterations (default 5)-CmdTimeoutSec: Per‑command timeout (default 45s)-ReportPath: Where the final Markdown report is saved (defaults to Desktop if not set)
Guardrails:
- Hard‑denies destructive operations (format, shutdown, bcdedit, etc.)
- Allows read‑only diagnostics by default
- Maintenance and kills require explicit flags
- Prompts the Azure model to propose 1–2 safe diagnostic commands per step (JSON only)
- Executes commands through a policy gate and captures short output previews
- Iterates for up to
MaxSteps - Generates a concise Markdown report with findings and next steps
Logs are written to: C:\ProgramData\AIExec\logs\run_*.log
- Error about environment variables: Ensure all required
AZURE_OPENAI_*values are set - 401/403 from API: Check the key and that your deployment name is correct
- Empty or malformed model output: The script retries the loop only when JSON parses; otherwise it stops and still writes a report
- No report opened: The BAT writes to a temp file path and then opens it; confirm the file exists and Notepad is available
-
Azure endpoint format used by the script:
https://{endpoint}/openai/deployments/{deployment}/chat/completions?api-version={version} -
Auth header:
api-key: <your-key> -
Request body uses only
messages(deployment is selected by URL)
REM Launch the Azure version
aiauto_azure.bat
REM Or call PowerShell directly
powershell -NoProfile -ExecutionPolicy Bypass -File .\aiauto_azure.ps1 -Goal "Network drops when docking" -MaxSteps 6 -CmdTimeoutSec 60- Read‑only actions by default; maintenance and kills are opt‑in
- Hard‑denies persist even with
-AllowDangerous - All executed commands and brief outputs are logged to the run log