次の方法で共有


クイック スタート: デモ拡張機能を調べる

このクイック スタートでは、Azure Developer CLI (azd) デモ拡張機能をインストールし、それを使用して拡張機能フレームワークの機能 azd 確認します。 拡張機能 は、新しい機能の追加、ワークフローの自動化、他のサービスと azdの統合を行う方法を提供します。 デモ拡張機能では、プロジェクトに関する情報の入力または表示をユーザーに求める方法など、拡張機能にさまざまな機能を実装する方法の例を示します。

プロジェクトを初期化する

先の手順に従って、 hello-azd スターター テンプレートを初期化します。 独自のテンプレートを使用して操作を進めることもできます。

azd init -t hello-azd

拡張機能をインストールする

デモ拡張機能をインストールするには、次の手順を実行します。

  1. azd構成で拡張機能が有効になっていることを確認します。

    azd config set alpha.extensions on
    
  2. 公式レジストリからデモ拡張機能をインストールします。

    azd extension install microsoft.azd.demo
    
  3. インストールされている拡張機能を一覧表示して、拡張機能がインストールされていることを確認します。

    azd extension list --installed
    

デモ拡張機能ワークフローを使用する

デモ拡張機能をインストールすると、拡張機能フレームワークの機能の例を調べるために使用できる azd に新しいコマンドが追加されます。

  1. 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.
    
  2. azd demo version コマンドを実行して、アプリのバージョンを表示します。

    azd demo version
    

    出力の書式設定は次のようになります。

    Version: 0.2.0
    Commit: 611d05a6f7190f3bda379e92b4ece6470584c6f0
    Build Date: 2025-04-23T17:21:58Z
    
  3. azd demo context コマンドを実行して、azd プロジェクトと環境のコンテキストを表示します。

    azd demo context
    
  4. azd 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
        ...
    

    [Container Apps] を選択し、Enter キーを押します。 残りのプロンプトに進み、ブール値 の [はい]/[いいえ] やリストの選択など、その他のプロンプト オプションの例を確認します。