Azure Citadel
  • Blogs

  • ARM
  • Azure Arc
    • Overview
    • Azure Arc-enabled Servers
      • Prereqs
      • Scenario
      • Hack Overview
      • Azure Landing Zone
      • Arc Pilot resource group
      • Azure Monitoring Agent
      • Additional policy assignments
      • Access your on prem VMs
      • Create onboarding scripts
      • Onboarding using scripts
      • Inventory
      • Monitoring
      • SSH
      • Windows Admin Center
      • Governance
      • Custom Script Extension
      • Key Vault Extension
      • Managed Identity
    • Azure Arc-enabled Kubernetes
      • Prereqs
      • Background
      • Deploy Cluster
      • Connect to Arc
      • Enable GitOps
      • Deploy Application
      • Enable Azure AD
      • Enforce Policy
      • Enable Monitoring
      • Enable Azure Defender
      • Enable Data Services
      • Enable Application Delivery
    • Useful Links
  • Azure CLI
    • Install
    • Get started
    • JMESPATH queries
    • Integrate with Bash
  • Azure Landing Zones
    • Prereqs
    • Day 1
      • Azure Baristas
      • Day 1 Challenge
    • Day 2
      • Example
      • Day 2 Challenge
    • Day 3
      • Day 3 Challenge
    • Useful Links
  • Azure Lighthouse
    • Minimal Lighthouse definition
    • Using service principals
    • Privileged Identity Management
  • Azure Policy
    • Azure Policy Basics
      • Policy Basics in the Azure Portal
      • Creating Policy via the CLI
      • Deploy If Not Exists
      • Management Groups and Initiatives
    • Creating Custom Policies
      • Customer scenario
      • Policy Aliases
      • Determine the logic
      • Create the custom policy
      • Define, assign and test
  • Azure Stack HCI
    • Overview
    • Useful Links
    • Updates from Microsoft Ignite 2022
  • Marketplace
    • Introduction
      • Terminology
      • Offer Types
    • Partner Center
    • Offer Type
    • Publish a VM Offer HOL
      • Getting Started
      • Create VM Image
      • Test VM Image
      • VM Offer with SIG
      • VM Offer with SAS
      • Publish Offer
    • Other VM Resources
    • Publish a Solution Template HOL
      • Getting Started
      • Create ARM Template
      • Validate ARM Template
      • Create UI Definition
      • Package Assets
      • Publish Offer
    • Publish a Managed App HOL
      • Getting Started
      • Create ARM Template
      • Validate ARM Template
      • Create UI Definition
      • Package Assets
      • Publish Offer
    • Managed Apps with AKS HOL
    • Other Managed App Resources
    • SaaS Offer HOLs
    • SaaS Offer Video Series
      • Video 1 - SaaS Offer Overview
      • Video 2 - Purchasing a SaaS Offer
      • Video 3 - Purchasing a Private SaaS Plan
      • Video 4 - Publishing a SaaS Offer
      • Video 5 - Publishing a Private SaaS Plan
      • Video 6 - SaaS Offer Technical Overview
      • Video 7 - Azure AD Application Registrations
      • Video 8 - Using the SaaS Offer REST Fulfillment API
      • Video 9 - The SaaS Client Library for .NET
      • Video 10 - Building a Simple SaaS Landing Page in .NET
      • Video 11 - Building a Simple SaaS Publisher Portal in .NET
      • Video 12 - SaaS Webhook Overview
      • Video 13 - Implementing a Simple SaaS Webhook in .NET
      • Video 14 - Securing a Simple SaaS Webhook in .NET
      • Video 15 - SaaS Metered Billing Overview
      • Video 16 - The SaaS Metered Billing API with REST
  • Microsoft Fabric
    • Theory
    • Prereqs
    • Fabric Capacity
    • Set up a Remote State
    • Create a repo from a GitHub template
    • Configure an app reg for development
    • Initial Terraform workflow
    • Expanding your config
    • Configure a workload identity
    • GitHub Actions for Microsoft Fabric
    • GitLab pipeline for Microsoft Fabric
  • Packer & Ansible
    • Packer
    • Ansible
    • Dynamic Inventories
    • Playbooks & Roles
    • Custom Roles
    • Shared Image Gallery
  • Partner Admin Link
    • Understanding PAL
    • User IDs & PAL
    • Service principals & PAL
    • CI/CD pipelines & PAL
    • Creating a dedicated PAL service principal
    • Azure Lighthouse & PAL
    • PAL FAQ
  • REST API
    • REST API theory
    • Using az rest
  • Setup
  • Terraform
    • Fundamentals
      • Initialise
      • Format
      • Validate
      • Plan
      • Apply
      • Adding resources
      • Locals and outputs
      • Managing state
      • Importing resources
      • Destroy
    • Working Environments for Terraform
      • Cloud Shell
      • macOS
      • Windows with PowerShell
      • Windows with Ubuntu in WSL2
    • Using AzAPI
      • Using the REST API
      • azapi_resource
      • Removing azapi_resource
      • azapi_update_resource
      • Data sources and outputs
      • Removing azapi_update_resource
  • Virtual Machines
    • Azure Bastion with native tools & AAD
    • Managed Identities

  • About
  • Archive
  1. Home
  2. Blog
  3. GitHub Copilot CLI

Table of Contents

  • Overview
  • Prerequisites
  • Install
    • Node.js and nvm
    • GitHub CLI
  • Adding the Microsoft Learn MCP Server
  • Creating Copilot instructions
  • Restarting

GitHub Copilot CLI

Richard Cheney • 22 Dec 2025

Table of Contents

  • Overview
  • Prerequisites
  • Install
    • Node.js and nvm
    • GitHub CLI
  • Adding the Microsoft Learn MCP Server
  • Creating Copilot instructions
  • Restarting

GitHub Copilot CLI is a powerful command-line tool that brings AI-powered assistance directly to your terminal. This guide walks through installation and configuration, including integration with Microsoft Learn documentation.

Overview

GitHub Copilot CLI provides an interactive terminal assistant that helps with software engineering tasks. It can answer questions, execute commands, search codebases, and integrate with external tools through the Model Context Protocol (MCP). The CLI offers context-aware assistance while you work, making it easier to navigate complex tasks without leaving your terminal.

I am often working with the newer technologies as part of my day job working with partner and I need to make sure that my references are fully up to date. After installing GitHub Copilot I will integrate with the Microsoft Learn MCP server to make sure that is the case, rather than relying on potentially stale training data.

Prerequisites

It is assumed that you have

  • curl
  • jq
  • gh

It is also assumed that you are authenticated to GitHub. (Check with gh auth status.)

Install

Node.js and nvm

First, ensure you have Node.js installed using nvm (Node Version Manager).

This guide is based on installing nvm and Node.js into WLS2, but you can also find guides for Windows and other OS.

  1. Install nvm

    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
    
  2. Install a supported Node.js version (22 or later)

    nvm install 22
    
  3. Set it as default

    nvm alias default 22
    nvm use default
    
  4. Show the installed versions and the currently set version.

    nvm ls
    

GitHub CLI

  1. Install GitHub Copilot CLI

    npm install -g @github/copilot@latest
    
  2. Verify the installation

    copilot --version
    

    Example output:

    0.0.372
    Commit: 5534560
    
  3. Start GitHub Copilot at the CLI

    copilot
    

    If you are already using the GitHub CLI (gh) and you are authenticated (gh auth status) then the GitHub Copilot CLI should use the same credentials.

Adding the Microsoft Learn MCP Server

The GitHub Copilot CLI is already set up with the GitHub MCP Server with a subset of tools suitable for CLI use. (You can override this with a switch to use the full set of tools.) GitHub Copilot will use the same set of stored credentials tha the GitHub CLI uses when connecting to the integrated GitHub MCP server.

In this section we will look at the process to add MCP servers. Here we’ll add the Microsoft Learn MCP server to provide access to official Microsoft documentation directly within Copilot CLI.

  1. Start GitHub Copilot at the CLI

    copilot
    
  2. Run the MCP server configuration command

    /mcp add
    
  3. Enter the server name

    Microsoft-Learn
    
  4. Select option 2 for HTTP transport

  5. Enter the URL

    https://learn.microsoft.com/api/mcp
    
  6. Save the configuration

  7. Use q to quit the wizard

  8. View the MCP config file

    The steps above will create a ~/.copilot/mcp-config.json file.

    jq . ~/.copilot/mcp-config.json
    

    Example output:

    {
      "mcpServers": {
        "Microsoft-Learn": {
          "type": "http",
          "url": "https://learn.microsoft.com/api/mcp",
          "headers": {},
          "tools": [
            "*"
          ]
        }
      }
    }
    

Creating Copilot instructions

Create a custom instructions file to enhance Copilot’s behavior:

mkdir -p $HOME/.copilot
cat > $HOME/.copilot/copilot-instructions.md << 'EOF'
# Copilot Instructions

## Microsoft Documentation

When answering questions about Microsoft technologies (Azure, .NET, C#, F#, ASP.NET Core, Microsoft.Extensions, NuGet, Entity Framework, PowerShell, Azure CLI, etc.), always use the `microsoft_docs_search`, `microsoft_docs_fetch`, or `microsoft_code_sample_search` MCP tools to verify information against official Microsoft Learn documentation.

These tools provide access to the latest official documentation and may contain more detailed or newer information than the training data.
EOF

This configuration ensures that Copilot always references official Microsoft documentation when answering questions about Microsoft technologies.

Restarting

After making configuration changes, restart your terminal session or reload your shell configuration:

  1. Restart by sourcing your config

    source ~/.bashrc
    

    Use source ~/.zshrc for zsh.

You’re now ready to use GitHub Copilot CLI with full Microsoft Learn integration!

Source: https://www.azurecitadel.com/blog/2025-12-22-github-copilot/
Author: Richard Cheney
Published: 22 Dec 2025
Printed: