次の方法で共有


Azure で GitHub Copilot を使い始める

GitHub Copilot for Azure の使用を開始して、開発ワークフローを合理化し、Azure プラットフォームの生産性を向上させます。 このガイドでは、Visual Studio での GitHub Copilot for Azure の前提条件とインストールについて説明します。そのため、最初のプロンプトを記述できます。

前提条件

この記事の手順を完了するには、次の項目があることを確認します。

重要

GitHub Copilot は、GitHub によって管理される別のサブスクリプションです。 GitHub Copilot サブスクリプションとサポートに関する質問については、「 GitHub Copilot プランの概要」を参照してください。

既定では、Copilot in Azure はテナント内のすべてのユーザーが使用できます。 ただし、グローバル管理者は、組織の Azure で Copilot へのアクセスを管理できます。 必要に応じて、特定の Microsoft Entra ユーザーまたはグループにアクセス権を付与することもできます。 詳細については、「Microsoft Copilot in Azure へのアクセスを管理する」を参照してください。

GitHub Copilot for Azure をインストールする

  1. Visual Studio Code で、 Extensions アイコンを選択します。
  2. Extensions Marketplace で、Azure 用の GitHub Copilot を検索します。 GitHub Copilot for Azure 拡張機能が表示されたら、 Install を選択します。
  3. メッセージが表示されたら、Azure アカウントにサインインします。

最初のプロンプトを記述する

  1. 拡張機能がインストールされていること、正しく認証されていること、拡張機能が正しく動作していることを確認します。

  2. チャット ウィンドウがまだ開いていない場合は、メニュー バーの [チャットの切り替え ] ボタンを選択するか、[ チャットの切り替え ] ボタンの横にあるドロップダウンを選択して [チャットを開く] (Ctrl + Alt + I) を選択して開いていることを確認します。

    [チャットの切り替え] メニューが開き、[チャットを開く] メニュー オプションを選択していることを示すスクリーンショット。

  3. チャット ウィンドウの下部にあるチャット テキスト領域に、次のプロンプトを入力します。

    Do I have any Azure resources currently running?
    

    質問に対する回答は、サブスクリプションで現在 Azure で実行されている内容によって異なります。

  4. 次に、次のプロンプトを使用します。

    What are your tools?
    

    完了応答には、GitHub Copilot で使用できる Azure 固有のツールの GitHub Copilot の一覧が表示されます。 応答では、現在使用できる機能の種類の概要を示します。

    I'll ask the Azure development helper to recommend custom modes relevant to listing and explaining the GitHub Copilot for Azure tools in VS Code; expected outcome: a short set of recommended modes or tips to tailor the tools explanation.
    
    Progress update: I queried the Azure development helper to get recommended custom modes for this topic. Next, I'll list and briefly explain the tools I have available (grouped and with example prompts and common uses) so you can copy/paste or use them directly in VS Code.
    
    Tools I can use (concise overview)
    
    1. Search & navigation
    
       - Capabilities: semantic code/documentation search, file search with globs, text search (grep), list directory contents, read file contents, find usages/references.
       - Example prompts:
          - "Find all usages of MyService in this workspace."
          - "Search for connectionString in **/*.config files."
       - When to use: locating code, docs, or examples quickly inside your repo.
    
    2. Code editing & analysis
       - Capabilities: insert edits into files, create or modify files, suggest refactors, report code errors, find test files.
       - Example prompts:
          - "Add a function to validate input in src/utils.js."
          - "Refactor this function to use async/await and update its tests."
       - When to use: implementing features, fixing bugs, generating or updating code.
    
    3. Terminal & Git operations
    
       - Capabilities: run shell commands, read terminal output, show git diffs and changed files.
       - Example prompts:
          - "Run npm test and show me failing tests."
          - "Stage and commit the changes with message 'fix: update README'."
       - When to use: run builds/tests, inspect outputs, perform git workflows (if enabled).
    
    4. Project creation & workspace setup
    
       - Capabilities: create new workspaces, scaffold projects (templates), install VS Code extensions, create notebooks.
       - Example prompts:
          - "Generate a Node.js express app scaffold in a new folder."
          - "Add recommended extensions for Python development."
       - When to use: bootstrapping projects or adding project-level config.
    
    5. Web & API tools
    
       - Capabilities: fetch web pages, retrieve API docs (for example VS Code API references), gather remote content for research.
       - Example prompts:
          - "Fetch the Azure CLI docs for az storage account list."
          - "Get the VS Code extension API docs for commands."
       - When to use: look up official docs or examples during work.
    
    6. Azure-specific tools
    
       - Capabilities: Azure development best practices guidance, Microsoft Learn documentation lookup, query Azure Resource Graph (when authenticated), manage Azure auth context (change tenant, sign out), generate Azure CLI / Bicep / ARM snippets, Bicep schemas, and guidance for deploying models and services.
       - Example prompts:
          - "What are Azure best practices for deploying this function app?"
          - "@azure /changeTenant — set my default tenant to <tenant-id>"
          - "Generate a Bicep template for an App Service and a Storage Account."
       - When to use: any task that touches Azure resources, deployment, or configuration.
    
    7. Documentation & learning
    
       - Capabilities: search and extract Microsoft Learn articles, provide code samples from official docs, show relevant how-to steps.
       - Example prompts:
          - "Show official docs for configuring Key Vault access policies."
          - "Give me a short tutorial on using Azure App Configuration."
       - When to use: learn or reference official Microsoft guidance.
    
    How I present results
    
    - Short answers or step-by-step instructions.
    - Full edits (I can create or modify files if you allow the extension to act).
    - Commands and code snippets you can paste into your terminal.
    - Checks (like running tests or linters) when terminal access is allowed.
    
    Example: Quick copy-paste prompts you can use in the VS Code chat
    
    - "What are your tools?" — lists the tools (this reply).
    - "Find all TODO comments in this repo and open a summary."
    - "Generate an az CLI command to list storage accounts sorted by region."
    - "@azure /changeTenant" — opens tenant selection (if you need to set a default).
    
    Notes and privacy/permissions
    
    - Some capabilities (like querying your Azure resources or running commands) require you to be signed in and to enable those tools in the extension (you can enable/disable specific tools in the chat pane tool list).
    - I won't perform actions that need elevated permissions without verifying your explicit consent.
    
    If you'd like, I can:
    
    - Expand any tool section with more example prompts and exact commands.
    - Show a short step-by-step for enabling/disabling tools in the chat pane.
    - Generate a one-page cheatsheet you can paste into an internal docs file. Which would you like next?
    
    

    新しい機能とツールが追加されると、応答の内容が変わる可能性があり、時間の経過と伴って変化する可能性があります。

  5. Azure 固有のツールに関するプロンプトをテストするには、次のプロンプトを試してください。

    What is the az command to list all my storage accounts ordered by location?
    

    そのプロンプトの入力が完了すると、次のことが生成される場合があります。

    
    I'll show the exact az CLI commands (sorted ascending/descending) plus a few useful output variants and a quick note about prerequisites.
    
    Commands
    
    - Sorted by location (ascending), full JSON:
    
       az storage account list --query "sort_by(@, &location)" -o json
    
    - Sorted by location, show only name and location in a readable table:
    
       az storage account list --query "sort_by(@, &location)[].[name,location]" -o table
    
    - Sorted by location (descending):
    
       az storage account list --query "reverse(sort_by(@, &location))" -o json
    
    - Sorted by location and include resource group and SKU in table:
    
       az storage account list --query "sort_by(@, &location)[].[name,resourceGroup,sku.name,location]" -o table
    
    Notes
    
    - Run az login first and ensure the correct subscription is selected (e.g., az account set -s "<subscription-id-or-name>").
    - You need permission to list storage accounts in the chosen subscription.
    - The query uses JMESPath (sort_by/reverse) to order results client-side.
    
    Would you like a version that groups counts by region or that queries across all subscriptions?
    
    

エージェント モードでツールを有効または無効にする

GitHub Copilot for Azure で利用できる特定のツールを無効にするか、再度有効にしたい場合があります。

  1. チャット ウィンドウでツール アイコンを選択します。

    [ツールの構成] アイコンが強調表示されているチャット ウィンドウのスクリーンショット。

  2. ツールの一覧の横にあるチェック ボックスを使用して、ツール (またはツールのグループ) を有効または無効にします。

    Visual Studio Code のツールの一覧のスクリーンショット。

既定のテナントを設定する

複数の Microsoft Entra ID テナントがある場合は、次のプロンプトを使用して既定のテナントを設定できます。

@azure /changeTenant

上部のセンター のドロップダウンで、使用可能なテナントの一覧から選択します。

拡張機能の設定で既定のテナントを設定することもできます。

  1. Visual Studio Code のアクティビティ バーで、 Extensions を選択します。 次に、下にスクロールして GitHub Copilot for Azure

    Visual Studio Code の拡張機能の一覧に GitHub Copilot for Azure を示すスクリーンショット。

  2. 拡張機能のエントリの隅にある歯車アイコンを選択し、ポップアップ メニューから Settings を選択します。

    GitHub Copilot for Azure のポップアップ メニューを示すスクリーンショット。

  3. Settings タブで、Azure Resource Graph テナントを Microsoft Entra テナント ID に設定します。 Microsoft Entra テナント ID は、Azure portal で確認できます。

    Azure Resource Graph テナントを設定するオプションを含む [設定] タブを示すスクリーンショット。

GitHub Copilot for Azure の指示ファイルを表示する

命令ファイル ("Azure Copilot ガイドライン" とも呼ばれます) には、GitHub Copilot の概要ガイダンスが含まれています。これは、Azure ツールと Azure MCP Server ツール用の GitHub Copilot にプロンプトを送信するときにコンテキスト ウィンドウに追加されます。 このファイルのガイダンスは、本質的にグローバルであることを意図しています。つまり、すべてのプロジェクトにわたる GitHub Copilot for Azure 全体のすべての対話を対象としています。 このファイルは隠しフォルダーの場所にあり、変更を意図していません。 このファイルは、Azure の GitHub Copilot が低下または無効化される可能性があり、変更が GitHub Copilot for Azure の新しい更新で上書きされる可能性があるため、変更しないでください。

「Azure Copilot ガイドライン」を参照すると、GitHub Copilot for Azure ツールと Azure MCP Server ツールが GitHub Copilot にどのように導入されているかについての洞察を得ることができます。これは、そのすべてがどのように機能するかを深く理解するのに役立ちます。

重要

このファイルは変更しないでください。

  1. ctrl + shift + p選択してコマンド パレットを開きます。

  2. Chat: Configure Instructions入力し、エントリを選択します。

    Visual Studio Code コマンド パレットでの入力のスクリーンショット。

  3. 次の手順で、[ AzureCopilotGuidelines ] を選択します。

    [Azure Copilot Guidelines]\(Azure Copilot ガイドライン\) を選択するオプションのスクリーンショット。

  4. 命令ファイルを含む新しいタブが開きます。

    GitHub Copilot for Azure 命令ファイルのスクリーンショット。

    重要

    このファイルは変更しないでください。

前提条件

  • Azure アカウントと Azure サブスクリプションへのアクセス。 それらを設定する方法の詳細については、Azure アカウントの に関するページを参照してください

  • GitHub アカウントと GitHub Copilot サブスクリプション。 それらを設定する方法の詳細については、「 GitHub でのアカウントの作成 および GitHub Copilot の Quickstartを参照してください。

  • Visual Studio 2022 (任意のエディション)。 ダウンロードしてインストールする方法の詳細については、「 Visual Studio のインストール」を参照してください。

重要

GitHub Copilot は、GitHub によって管理される別のサブスクリプションです。 GitHub Copilot サブスクリプションとサポートに関する質問については、「 GitHub Copilot プランの概要」を参照してください。

GitHub Copilot for Azure をインストールする

  1. Visual Studio 2022 の [拡張機能] メニューで、[拡張機能の管理] を選択します。
  2. 拡張機能マネージャーで、 GitHub Copilot for Azure (VS 2022) を検索して選択します。 [インストール] ボタンを選択します。
  3. しばらくすると、「変更がスケジュールされました」というバナーが表示されます。 変更は、Microsoft Visual Studio が閉じられたときに開始されます。"Visual Studio をシャットダウンします。
  4. VSIX インストーラー ダイアログが開き、インストールの確認が表示されます。 [ 変更 ] ボタンを選択します。
  5. しばらくすると、"変更が完了しました" と表示されます。 [閉じる] ボタンを選択します。
  6. Visual Studio 2022 をもう一度開きます。
  7. ツール バーのウィンドウの右上にある [GitHub Copilot] ボタンを選択します。 [ チャット ウィンドウを開く] を選択します。
  8. GitHub Copilot チャット ウィンドウが表示されたら、下部のチャット領域で [エージェント モード] を選択し、[ツールの 選択 ] ボタン (2 本のレンチ) を選択します。
  9. [ ツールの選択 ] ダイアログボックスに、"Azure MCP サーバー" と表示されます。 右側には、ツールが選択されていない場合は "0/153" と表示されます (現在は既定です)。 親ノードを選択して、すべてのツールを選択します。

重要

ツールの一覧に "Azure MCP Server" が表示されない場合は、拡張機能のアンインストールと再インストールが必要になることがあります。

最初のプロンプトを記述する

  1. チャット ウィンドウがまだ開いていない場合は、 表示>GitHub Copilot チャット メニュー オプションを選択して開いていることを確認します。 既定では、右側にドッキングされたチャット ウィンドウが表示されます。

    Visual Studio 2022 の GitHub Copilot チャット ウィンドウを示すスクリーンショット。

  2. チャット ウィンドウの下部にあるチャット テキスト領域に、次のプロンプトを入力します。

    Do I have any resources currently running?
    

    Visual Studio 2022 のチャット領域に入力されたプロンプトの例を示すスクリーンショット。

既定では、GitHub Copilot は ask モードを使用します。 Ask モードでは、チャット ウィンドウのプロンプトに対する回答が表示されます。 エージェント モードを使用すると、GitHub Copilot がワークスペースでアクションを実行できます。

質問に対する回答は、サブスクリプションで現在 Azure で実行されている内容によって異なります。

エージェント モード

エージェント モードでは、GitHub Copilot は Visual Studio ワークスペース全体でタスクを実行し、編集、ターミナル コマンドの実行などを行うことができます。

GitHub Copilot for Azure では、Azure との緊密な統合を通じてエージェント エクスペリエンスを強化するための "ツール" が GitHub Copilot に提供されます。

Ask モードとエージェント モードを切り替えるには、チャット領域の Ask オプションの横にある下向きのシェブロンを選択し、目的のモードを選択します。

Visual Studio 2022 のチャット領域のモード メニューを示すスクリーンショット。

エージェント モードでツールを有効または無効にする

GitHub Copilot for Azure で利用できる特定のツールを無効にするか、再度有効にしたい場合があります。

  1. チャット ウィンドウで [ツールの選択] アイコンを選択します。

    Visual Studio 2022 で [ツールの選択] ボタンがクリックされたチャット ウィンドウのスクリーンショット。

  2. ツールの一覧の横にあるチェック ボックスを使用して、ツール (またはツールのグループ) を有効または無効にします。

前提条件

  • Azure アカウントと Azure サブスクリプションへのアクセス。 それらを設定する方法の詳細については、Azure アカウントの に関するページを参照してください

  • GitHub アカウントと GitHub Copilot サブスクリプション。 それらを設定する方法の詳細については、「 GitHub でのアカウントの作成 および GitHub Copilot の Quickstartを参照してください。

  • Visual Studio 2026 (任意のエディション)。 ダウンロードしてインストールする方法の詳細については、「 Visual Studio のインストール」を参照してください。

重要

GitHub Copilot は、GitHub によって管理される別のサブスクリプションです。 GitHub Copilot サブスクリプションとサポートに関する質問については、「 GitHub Copilot プランの概要」を参照してください。

GitHub Copilot for Azure をインストールする

  1. Visual Studio 2026 を既にインストールしていて、初期インストール後に GitHub Copilot for Azure を追加する場合は、Visual Studio インストーラーを開き、[ 変更 ] ボタンを選択すると、使用可能なワークロードが表示されます。

    [変更] ボタンが強調表示されている Visual Studio インストーラーを示すスクリーンショット。

    Visual Studio 2026 を初めてインストールする場合は、使用可能なワークロードが Visual Studio インストーラーによって自動的に表示されます。

  2.  [ワークロード] タブで、[Azure AI 開発] が選択されていることを確認します。

    Azure AI 開発オプションが選択され強調表示されている、Visual Studio インストーラーの使用可能なワークロードを示すスクリーンショット。

  3. [ インストール ] ボタンを選択してインストールを完了します。

  4. Visual Studio 2026 を起動し、プロジェクトを作成または読み込みます。

  5. GitHub Copilot Chat を開きます。

  6. メッセージが表示されたら、GitHub アカウントにサインインします。

  7. メッセージに従って Azure アカウントにサインインします。

  8. チャット領域で、[ ツールの選択 ] ボタン (2 つのレンチ アイコン) を選択して、使用可能なツールの一覧を表示します。 Azure の最上位ノードを確認して、すべての Azure ツールを有効にします。

    Azure ノードがオンになっている [ツールの選択] ダイアログを示すスクリーンショット。

    また、 Azure MCP Server の最上位ノードを選択します。

    Azure MCP サーバー ノードがオンになっている [ツールの選択] ダイアログを示すスクリーンショット。

最初のプロンプトを記述する

  1. チャット ウィンドウがまだ開いていない場合は、 表示>GitHub Copilot チャット メニュー オプションを選択して開いていることを確認します。 既定では、右側にドッキングされたチャット ウィンドウが表示されます。

    Visual Studio 2026 の GitHub Copilot チャット ウィンドウを示すスクリーンショット。

  2. チャット ウィンドウの下部にあるチャット テキスト領域に、次のプロンプトを入力します。

    Do I have any resources currently running?
    

    Visual Studio 2026 のチャット領域に入力されたプロンプトの例を示すスクリーンショット。

既定では、GitHub Copilot は ask モードを使用します。 Ask モードでは、チャット ウィンドウのプロンプトに対する回答が表示されます。 エージェント モードを使用すると、GitHub Copilot がワークスペースでアクションを実行できます。

質問に対する回答は、サブスクリプションで現在 Azure で実行されている内容によって異なります。

エージェント モード

エージェント モードでは、GitHub Copilot は Visual Studio ワークスペース全体でタスクを実行し、編集、ターミナル コマンドの実行などを行うことができます。

GitHub Copilot for Azure では、Azure との緊密な統合を通じてエージェント エクスペリエンスを強化するための "ツール" が GitHub Copilot に提供されます。

Ask モードとエージェント モードを切り替えるには、チャット領域の Ask オプションの横にある下向きのシェブロンを選択し、目的のモードを選択します。

Visual Studio 2026 のチャット領域のモード メニューを示すスクリーンショット。

エージェント モードでツールを有効または無効にする

GitHub Copilot for Azure で利用できる特定のツールを無効にするか、再度有効にしたい場合があります。

  1. チャット ウィンドウで [ツールの選択] アイコンを選択します。

    Visual Studio 2026 で [ツールの選択] ボタンがクリックされたチャット ウィンドウのスクリーンショット。

  2. ツールの一覧の横にあるチェック ボックスを使用して、ツール (またはツールのグループ) を有効または無効にします。