Azure MCP 伺服器會使用模型內容通訊協定 (MCP) 來標準化 AI 應用程式與外部工具和資料來源之間的整合,讓 AI 系統能夠執行內容感知 Azure 資源的作業。
在本文中,您將瞭解如何完成下列工作:
- 安裝並驗證 Azure MCP 伺服器
- 使用 IntelliJ 的 AI 支援工具連線到 Azure MCP 伺服器
- 執行提示以測試 Azure MCP 伺服器作業並與 Azure 資源互動
先決條件
- 具有有效訂閱的 Azure 帳戶
- 已安裝 IntelliJ
- Node.js 已安裝 LTS
- 已安裝 GitHub Copilot for IntelliJ 擴充功能
安裝 Azure MCP 伺服器
若要在 IntelliJ 中安裝和設定 Azure MCP 伺服器,請選擇下列其中一個選項:
選取 IDE 和專案設定 齒輪圖示,然後選擇 Plugins..。
在 [設定] 對話方塊的 [外掛程式] 面板中,搜尋 Azure ToolKit for IntelliJ。
選取相符的結果,然後選取 [安裝]。
備註
如果您已安裝 GitHub Copilot for IntelliJ 外掛程式,則只有 Azure MCP 伺服器才包含在 Azure Toolkit for IntelliJ 安裝中。
向 Azure 驗證
Azure MCP 伺服器會使用 Azure 帳戶和 Microsoft Entra ID 提供順暢的驗證體驗。 若要使用 Azure MCP 伺服器,您必須先使用本機開發工具 (例如 Azure CLI、Azure 開發人員 CLI、Visual Studio 或 Visual Studio Code) 向 Azure 進行驗證。 Azure MCP 伺服器會自動從這些工具探索您的認證,並使用它們向 Azure 服務進行驗證。
例如,若要使用 Azure CLI 登入:
az login執行下列命令來驗證您的驗證狀態,以查看您目前登入的帳戶和訂用帳戶:
az account show請確定您的使用者帳戶具有您想要互動之 Azure 服務的適當角色指派。 您想要使用 Azure MCP 伺服器存取的 Azure 資源必須已存在於您的 Azure 訂用帳戶中。 例如,常見的角色指派包括:
- Blob 儲存體資料貢獻者 - 讀取和寫入儲存體帳戶中的 Blob 資料。
- 儲存體帳戶參與者 - 管理儲存體帳戶設定。
- 貢獻者 - 跨訂用帳戶的全面資源管理。
- 讀取者 - Azure 資源的唯讀存取權。
如需角色指派和本機開發驗證的詳細資訊,請參閱 在本機開發期間向 Azure 服務驗證 .NET 應用程式。
使用提示來測試 Azure MCP 伺服器
選擇右側工具欄上的 AI 聊天 按鈕以打開 IntelliJ 的 AI 助手界面。
輸入使用 Azure MCP 伺服器功能的提示,例如:
List my Azure storage accountsIntelliJ 會提示您執行工具來擷取儲存體帳戶,例如
storage account list。 選取 [執行工具] 以繼續。輸出應類似下列文字:
The following resource groups are available for your subscription: 1. **DefaultResourceGroup-EUS** (Location: `eastus`) 2. **rg-testing** (Location: `centralus`) 3. **rg-azd** (Location: `eastus2`) 4. **msdocs-sample** (Location: `southcentralus`) 5. **ai-testing** (Location: `eastus2`) Let me know if you need further details or actions related to any of these resource groups!使用其他相關提示探索更多 Azure MCP 作業,例如:
List all of the storage accounts in my subscription Get the available tables in my storage accounts Show me the configuration of my App Service instances