共用方式為


針對 SQL Server Management Studio 中的 Copilot 問題進行疑難解答

一般記錄

在需要更多詳細數據調查問題的案例中,您可以使用 [ 檢視>輸出 ],並從下拉式清單中選取 [Copilot ] 來檢視輸出視窗中的 Copilot 命令。 或者,您可以使用 /log 命令在提示方塊中儲存資訊。

設定

如果您在初次執行體驗中輸入端點和部署值(第一次啟動 Copilot 時的初始對話框)和進度列重複,請檢查瀏覽器是否有Microsoft Entra 驗證對話框。

日誌擷取

如果您在第一次執行體驗中輸入端點和部署值之後收到錯誤(第一次啟動 Copilot 時的初始對話方塊),請使用錯誤訊息清單進一步進行疑難解答,或擷取輸出視窗中的記錄。

  1. 移至 工具>選項>Copilot 以輸入端點和部署值,然後選取 確定
  2. 此對話框中不會發生任何驗證。
  3. 開啟 Copilot 之前,請移至 [檢視>輸出] 以開啟輸出檢視器。
  4. 選取工具列上的 [Copilot ] 按鈕,以在 SSMS 中啟動 Copilot。
  5. 啟動時,除非您使用 API 金鑰,否則系統會提示您向 Azure 進行驗證。
  6. 如果您沒有看到驗證提示,請檢查瀏覽器是否有Microsoft Entra 驗證對話方塊。
  7. 如果您在 Copilot 聊天中看到錯誤,請從輸出查看器中的下拉式清單中選取 Copilot
  8. 輸出查看器中的資訊可用於進一步的疑難解答。

測試存取

使用 Azure Command-Line Interfact (CLI) 來確認您可以存取 Azure OpenAI 資源。 Azure CLI 必須安裝在與 SQL Server Management Studio (SSMS) 相同的電腦上。 如果 Azure OpenAI 資源使用 Microsoft Entra 驗證,您必須先使用登入 Azure,然後才能執行 PowerShell 腳本。 腳本需要裝載 Azure OpenAI 資源的資源群組名稱,以及端點資源的名稱。 如果腳本順利完成,可用的 Azure OpenAI 模型會列為輸出。

# Set your Azure OpenAI resource values
$resourceGroup = "msdocs-azuresql-rg-$randomIdentifier"
$resourceName = "copilot-in-ssms"

# ---- Get the endpoint ----
$endpoint = az cognitiveservices account show `
    --name $resourceName `
    --resource-group $resourceGroup `
    --query "properties.endpoint" `
    --output tsv

if (-not $endpoint) {
    Write-Host "Couldn't retrieve endpoint. Check resource group/name." -ForegroundColor Red
    exit 1
}

# ---- Get an API key for the resource ----
$apiKey = az cognitiveservices account keys list `
    --name $resourceName `
    --resource-group $resourceGroup `
    --query "key1" `
    --output tsv

if (-not $apiKey) {
    Write-Host "Couldn't retrieve API key. Check permissions." -ForegroundColor Red
    exit 1
}

# ---- Make a request to /openai/models ----
$headers = @{
    "api-key" = $apiKey
    "Content-Type" = "application/json"
}
$url = "$endpoint/openai/models?api-version=2024-02-01"

try {
    $response = Invoke-RestMethod -Method Get -Uri $url -Headers $headers
    Write-Host "✅ Successfully connected to Azure OpenAI endpoint and listed models:" -ForegroundColor Green
    $response.data | Select-Object id
}
catch {
    Write-Host "❌ Failed to connect or authenticate with Azure OpenAI endpoint." -ForegroundColor Red
    Write-Host $_.Exception.Message
    exit 1
}

錯誤訊息

錯誤 後續步驟
無效的 URI:無法判斷 URI 的格式 確保端點和部署的值不會被意外交換。
未知的端點: 'https://value-for-endpoint.openai.azure.com/'。 請確認端點。 確認您有 Azure OpenAI 端點的正確的數值。
此資源的 API 部署不存在。 建立部署如果是在過去五(5)分鐘內完成的,請等待一會兒,然後再嘗試。
請確認您已獲得 Azure OpenAI 部署的正確的值。
確認部署名稱的開頭或結尾沒有空格。
如果部署的值正確,且部署是最近創建的,請稍候幾分鐘再試一次。
因為訂用帳戶金鑰無效或 API 端點錯誤而拒絕存取。 請務必為作用中的訂用帳戶提供有效的 API 金鑰,併為資源使用正確的區域 API 端點。 確認部署的組態,以及它是否使用 Microsoft Entra 驗證或 API 金鑰。 如果您的部署使用 Microsoft Entra 驗證,而且您輸入 API 金鑰,就會出現此錯誤。
如果您的部署使用 API 金鑰,請確認您擁有的 API 金鑰正確且未輪替為新的值。
HTTP 400 錯誤 部署未以模型 gpt-4o 配置。
HTTP 429 錯誤 端點已被限制流量。