共用方式為


使用 Azure DevOps 建置安全的應用程式

Azure DevOps 服務 |Azure DevOps Server |Azure DevOps Server 2022

建置與 Azure DevOps 整合的安全、可調整應用程式和服務,以存取用戶資源,並以程式設計方式自動化程式。 無論您是建立內部自動化工具或建置商業產品,Azure DevOps 都提供健全的 API 和新式驗證選項,以支援您的整合需求。

為什麼要與 Azure DevOps 整合?

Azure DevOps 整合可讓您:

🔧 自動化工作流程

  • 根據客戶報告自動建立和追蹤錯誤
  • 監視工作專案 ,並在自定義儀錶板上顯示狀態
  • 同步處理 Azure DevOps 與外部系統之間的數據
  • 從 Azure DevOps 數據產生報告和分析

🏗️ 建置商業解決方案

  • 開發 Azure DevOps 客戶的市集擴充功能
  • 建立與 Azure DevOps 整合的 SaaS 產品
  • 建置連線至 Azure DevOps 服務的行動應用程式
  • 整合 Azure DevOps 與企業系統

開始:選擇您的方向

🚀 快速入門選項

需要 建議的方法 適用對象
簡單自動化 具有個人存取權杖的 REST API (PAT) 腳本、個人工具
生產應用程式 具有受控識別的 .NET 用戶端連結庫 企業應用程式、Azure 裝載的服務
互動式應用程式 Microsoft Entra 驗證 使用者面向應用程式、桌面工具
自訂UI元件 Azure DevOps 擴充功能 團隊自定義、市場產品

🔐 驗證:安全性優先

選擇正確的驗證方法:

✅ 建議使用於生產環境:

⚡ 快速開發:

❌ 避免用於生產環境:

  • 使用者名稱/密碼驗證(已淘汰)
  • 原始碼中的硬式編碼認證
  • 許可權範圍過於廣泛

開發方法

🔌 REST API 整合

最適合: 直接 HTTP 呼叫,平臺無關的開發,簡單的自動化

**Key benefits:**
- Works with any programming language
- Full control over HTTP requests and responses
- Lightweight integration for simple scenarios
- Easy to debug and test

**Get started:**
- [Learn REST API basics](./how-to/call-rest-api.md)
- [Browse API reference](/rest/api/azure/devops/)
- [Try APIs in the browser](https://docs.microsoft.com/rest/api/azure/devops/)

📚 .NET 用戶端連結庫

最適合: C# 應用程式, 企業開發, 複雜的整合

**Key benefits:**
- Strongly typed APIs with IntelliSense support
- Built-in retry logic and error handling
- Async/await patterns for better performance
- Production-ready authentication options

**Get started:**
- [.NET client library samples](./get-started/client-libraries/samples.md)
- [Authentication guidance](./get-started/authentication/authentication-guidance.md)
- [Client library concepts](./concepts/dotnet-client-libraries.md)

🔔 事件驅動整合

最適合: 即時回應、Webhook型自動化、外部系統同步處理

**Key benefits:**
- Real-time event notifications
- Reduced polling and improved efficiency
- Support for multiple event types
- Easy integration with external services

**Get started:**
- [Service hooks overview](../service-hooks/overview.md)
- [Webhook configuration guide](../service-hooks/services/webhooks.md)
- [Event reference documentation](../service-hooks/events.md)

🧩 平台擴充功能

最適合: 自訂UI元件、小組特定功能、市集產品

**Key benefits:**
- Native integration with Azure DevOps UI
- Access to platform APIs and services
- Distribution through Visual Studio Marketplace
- Rich customization capabilities

**Get started:**
- [Extension development overview](../extend/overview.md)
- [Extension samples and tutorials](../extend/develop/samples-overview.md)
- [Marketplace publishing guide](../extend/publish/overview.md)

架構模式

微服務整合:

Azure Function/App Service → Managed Identity → Azure DevOps APIs
- Secure, serverless integration
- Automatic credential management
- Scalable and cost-effective

企業應用程式:

On-premises App → Service Principal → Azure DevOps REST APIs
- Certificate-based authentication
- Centralized credential management
- Audit logging and compliance

使用者面向應用程式:

Web/Mobile App → Microsoft Entra OAuth → Azure DevOps on behalf of user
- User consent flows
- Secure token management
- Granular permission control

安全性與合規性

🛡️ 安全性最佳做法

驗證安全性:

  • ✅ 盡可能使用受控識別
  • ✅ 實作適當的憑證刷新機制
  • ✅ 套用最低許可權原則
  • ✅ 啟用所有 API 呼叫的稽核記錄
  • ❌ 切勿將憑證提交到原始碼控制系統
  • ❌ 請勿使用過於廣泛的 PAT 範圍

應用程式安全性:

  • 實作適當的錯誤處理和記錄
  • 針對所有通訊使用 HTTPS
  • 驗證所有輸入數據
  • 妥善應對速率限制
  • 將敏感數據儲存在 Azure Key Vault 中

合規性考慮:

  • 檢閱 Azure DevOps 安全性概觀
  • 了解數據存留地需求
  • 實作適當的訪問控制和稽核
  • 遵循業界特定的合規性指導方針

資源和後續步驟

📖 重要文件

核心概念:

API 參考:

程式代碼範例:

🎯 快速動作

立即開始建置:

  1. 設定驗證 - 選擇您的驗證方法
  2. 試用 REST API - 進行您的第一個 API 呼叫
  3. 執行用戶端連結庫範例 - 請參閱運作中的程式碼範例
  4. 檢閱安全性做法 - 從頭開始安全地建置

需要協助嗎?

小提示

Azure DevOps 整合的新功能?身份驗證指導 開始瞭解您的選項,然後嘗試 REST API 快速入門,進行您的第一次成功的 API 呼叫。