{
  "id": "cloud/azure-function-cold-start-sql-connection",
  "signature": "System.Data.SqlClient.SqlException: A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.)",
  "signature_zh": "System.Data.SqlClient.SqlException：与服务器成功建立连接，但在登录过程中发生错误。（提供程序：SSL提供程序，错误：0 - 证书链由不受信任的颁发机构颁发。）",
  "regex": "certificate chain was issued by an authority that is not trusted",
  "domain": "cloud",
  "category": "auth_error",
  "subcategory": null,
  "root_cause": "Azure Function's SQL connection string uses 'Encrypt=True' but the server's SSL certificate is not trusted by the client due to missing root CA or misconfigured trust store in the function runtime.",
  "root_cause_type": "generic",
  "root_cause_zh": "Azure Function的SQL连接字符串使用'Encrypt=True'，但服务器的SSL证书因缺少根CA或函数运行时中的信任存储配置错误而不受客户端信任。",
  "versions": [
    {
      "version": "Azure Functions .NET 8.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "SQL Server 2022",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "This disables SSL validation, which is a security risk and may violate compliance policies; also, it does not fix the underlying trust issue.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Regenerating certificates on the server does not update the client's trust store; the new certificate still needs to be trusted by the function.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Self-signed certificates still require client-side trust configuration; manual import in Azure Functions is complex and often fails due to runtime limitations.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Add the Azure SQL Database's root CA certificate to the function's trust store: download Baltimore CyberTrust Root cert and install via `update-ca-trust` in a custom container",
      "success_rate": 0.85,
      "how": "Add the Azure SQL Database's root CA certificate to the function's trust store: download Baltimore CyberTrust Root cert and install via `update-ca-trust` in a custom container",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use Managed Identity instead of SQL authentication: set connection string to 'Server=tcp:server.database.windows.net;Authentication=Active Directory Managed Identity;Database=mydb'",
      "success_rate": 0.9,
      "how": "Use Managed Identity instead of SQL authentication: set connection string to 'Server=tcp:server.database.windows.net;Authentication=Active Directory Managed Identity;Database=mydb'",
      "condition": "",
      "sources": []
    },
    {
      "action": "Set 'Encrypt=False' in connection string as a temporary workaround (not recommended for production)",
      "success_rate": 0.7,
      "how": "Set 'Encrypt=False' in connection string as a temporary workaround (not recommended for production)",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Add the Azure SQL Database's root CA certificate to the function's trust store: download Baltimore CyberTrust Root cert and install via `update-ca-trust` in a custom container",
    "Use Managed Identity instead of SQL authentication: set connection string to 'Server=tcp:server.database.windows.net;Authentication=Active Directory Managed Identity;Database=mydb'",
    "Set 'Encrypt=False' in connection string as a temporary workaround (not recommended for production)"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-error-pages#sql-connection-errors",
  "official_doc_section": null,
  "error_code": "SQL-18452",
  "verification_tier": "ai_generated",
  "confidence": 0.83,
  "fix_success_rate": 0.83,
  "resolvable": "partial",
  "first_seen": "2024-08-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}