在本快速入門中,您會安裝 Azure 開發人員 CLI (azd) 示範延伸模組,並用它來探索 azd 擴充功能架構功能。
擴充 功能可讓您新增功能、自動化工作流程,以及整合其他服務與 azd。 示範延伸模組提供如何在延伸模組中實作各種功能的範例,例如如何提示使用者輸入或顯示專案的相關信息。
Note
azd 擴展目前處於測試階段。
初始化專案
若要遵循後續步驟,請初始化 hello-azd 入門範本。 您也可以使用自己的範本來跟進。
azd init -t hello-azd
安裝擴充套件
完成下列步驟以安裝示範延伸模組:
從官方登入安裝示範延伸模組:
azd extension install microsoft.azd.demo列出您已安裝的擴充功能,以確認擴充功能已正確安裝。
azd extension list --installed
使用範例擴充套件工作流程
安裝之後,示範延伸模組會將新的命令新增至 azd ,以用來探索擴充功能範例。
azd demo執行 命令以檢視可用示範指令的清單:azd demo輸出應該如以下所示:
Demonstrates AZD extension framework capabilities. Usage: azd [command] Available Commands: colors Displays all ASCII colors with their standard and high-intensity variants. context Get the context of the AZD project & environment. listen Starts the extension and listens for events. prompt Examples of prompting the user for input. version Prints the version of the application Flags: --debug Enable debug mode -h, --help help for azd Use "azd [command] --help" for more information about a command.azd demo version執行 命令以顯示應用程式的版本:azd demo version輸出格式應該如下所示:
Version: 0.2.0 Commit: 611d05a6f7190f3bda379e92b4ece6470584c6f0 Build Date: 2025-04-23T17:21:58Z執行
azd demo context命令以顯示azd專案與環境的內容:azd demo contextazd demo prompt執行 命令以探索如何使用擴充功能提示使用者輸入的範例:azd demo prompt工作流程的第一個步驟示範如何篩選清單:
? Which Azure services do you use most with AZD?: Container Apps Filter: Type to filter list > [✔] Container Apps [ ] Functions [ ] Static Web Apps [ ] App Service [ ] Cosmos DB [ ] SQL Database ...選取 [容器應用程式 ],然後按 Enter。 繼續完成其餘提示,以查看其他提示選項的範例,例如布林值是/否或清單選項。