Build Copilot Managed Runtime apps with GitHub

Note

  • GitHub integration currently supports only organization-owned repositories on GitHub Enterprise Cloud.
  • Support for direct integration with other Git providers might be added in the future.
  • To use GitHub repositories outside GitHub Enterprise Cloud or other Git providers today, use bring your own build (--repo none).
  • Connecting an app to a GitHub repository is currently available only through the Copilot Managed Runtime CLI.
  • There's currently no administrator control to require apps to use GitHub repositories or a specific GitHub organization.

Connect an organization-owned GitHub repository to Microsoft Copilot Managed Runtime to keep your source code, pull requests, and repository policies in GitHub while the platform builds, scans, and deploys your app.

This article helps administrators install the Microsoft first-party GitHub App and configure repository access. It also walks developers through creating apps in GitHub as the backing repository (instead of the platform managed repo) then previewing, committing, and deploying an app.

GitHub Copilot isn't required. This walkthrough uses platform builds, not the external-build workflow with GitHub Actions.

Choose a repository and build option

Choose a mode when you run ms app create or ms app init. Changing modes later requires a new app.

Option Choose it when Create option
Platform-managed Git (default) You want a platform-provisioned repository and managed builds without GitHub setup. Omit --repo.
GitHub integration You want GitHub collaboration and repository controls with platform-managed builds. --repo <url>
Bring your own build You need another Git provider or build pipeline and will supply the built artifacts. --repo none

Prerequisites

Before you begin, make sure you have:

  • A repository on github.com or a *.ghe.com data-residency host, with a full HTTPS URL.
  • A GitHub organization owner to complete the Microsoft first-party GitHub App installation.
  • Read and write repository access, plus the applicable app and environment permissions.
  • An environment that allows CLI app creation.
  • Node.js, Git, and Git Credential Manager configured as described in the SDK prerequisites, including the licensing requirements for running apps.

Set up GitHub integration as an administrator

Install the App on the organization that owns the repository. Microsoft administrator roles don't grant GitHub access; platform administration remains separate.

Install the Microsoft first-party GitHub App

Follow these steps on the host that contains your repository:

  1. Sign in as a GitHub organization owner. On ghe.com, use your enterprise managed account and complete single sign-on.

  2. Open the installation page for your host:

    Host Installation page
    github.com Microsoft Copilot Managed Runtime in GitHub Marketplace. Select the free plan and begin installation.
    SUBDOMAIN.ghe.com Copy https://SUBDOMAIN.ghe.com/apps/external-app/microsoft-copilot-managed-runtime, replace SUBDOMAIN with your enterprise subdomain, and open it.

    For a repository at https://contoso.ghe.com/team/inventory-app, the subdomain is contoso, not team. Marketplace isn't available on ghe.com; installing on github.com doesn't grant access to your ghe.com repositories.

    Important

    Keep the installation paths as shown. The Marketplace listing uses microsoft-managed-apps, but the registered App uses microsoft-copilot-managed-runtime. The ghe.com path uses singular external-app.

  3. Confirm the App is Microsoft Copilot Managed Runtime, published by Microsoft, and choose the organization that owns your repository.

  4. Choose Only select repositories for specific repositories to connect. Use All repositories if you intend to use the integration in any repository in organization without needing additional administrator approvals for each.

  5. Review the following permissions and complete installation, including any required organization approval.

GitHub App permissions

The App's Transparency and security information lists these permissions. Review the live screen before approving changes.

Scope Permission
Repository Read access to metadata.
Repository Read and write access to code.
Organization Read access to organization plan.
User Read access to public repositories, public organization information, and public user profile data.

Installation grants the App access to the selected repositories, not additional access to contributors. Grant contributors read and write access separately in GitHub.

To add repositories or revoke installation access later, use GitHub App settings on the same host. This doesn't replace app-user sharing controls.

Set up GitHub integration as a developer

Complete administrator setup first. In the commands below, replace <repository-url> with your repository's full HTTPS URL, including its *.ghe.com host when applicable.

Install the CLI and sign in

Install the CLI, then sign in with your Microsoft Entra account for the app's tenant:

npm install -g @microsoft/cmr-cli
ms --version
ms auth login

When a command prompts for GitHub authorization, open the displayed verification URL, enter the code, and use your GitHub account on the repository's host. This maps your GitHub and Entra identities; Git Credential Manager separately authenticates clone, fetch, and push operations.

To change the mapped GitHub account, use ms git auth refresh --repo <repository-url>.

Connect a project

Choose one path, and make sure the App installation includes the repository:

  • New app: Create an empty GitHub repository without a README, license, or .gitignore. The local target must also be empty, including hidden files, or not yet exist. The CLI clones the repository and scaffolds your app:

    ms app create inventory-app --display-name "Inventory" --repo <repository-url>
    cd inventory-app
    
  • Existing web project: Clone the repository, or use your existing checkout, then initialize the app without replacing its source:

    git clone <repository-url> inventory-app
    cd inventory-app
    ms app init --display-name "Inventory" --repo <repository-url>
    

    The project must not already be a Copilot Managed Runtime app. For an app that's already registered, follow Collaborate on an app instead. Use git clone for GitHub repositories, not ms app clone.

Develop, preview, and deploy

From the app directory, follow this sequence:

  1. Install dependencies and start local development:

    npm install
    ms app dev
    

    Test the Local Play URL in your tenant's browser profile. Stop the local process with Ctrl+C when you're ready to continue.

  2. Commit and push a working branch:

    git switch -c configure-cmr
    git add .
    git commit -m "Configure the app for Copilot Managed Runtime"
    git push --set-upstream origin configure-cmr
    

    Complete required reviews and checks without disabling branch protections. If you merge, check out and pull the updated branch.

  3. Copy the pushed commit's full ID:

    git rev-parse HEAD
    

    Replace <commit-sha> with that ID to preview and check the build:

    ms app play --mode preview --commit <commit-sha>
    ms app build-status --commit <commit-sha>
    

    Preview builds the commit on demand if needed; pushing alone doesn't build or deploy. If the build fails, fix the reported error, commit and push, then preview the new commit.

  4. After validating the preview, deploy the same commit:

    ms app deploy --commit <commit-sha>
    

    Verify the returned live URL. Later commits don't change it until you deploy again.

For build behavior and rollback options, see Build, preview, and deploy apps.

Retain your security and supply-chain controls

Your GitHub reviews, branch policies, and security checks continue to apply. Platform-managed builds add checks such as credential scanning, but don't automatically make every GitHub status check a deployment gate. For runtime controls, see Manage security and compliance.

Bring your own build

To use another Git provider or your own build pipeline, create or initialize the app with --repo none:

ms app create inventory-app --display-name "Inventory" --repo none

Set up source control yourself. This mode creates no local Git repository or platform repository binding; the platform doesn't fetch or build your source.

External artifact deployment is disabled by default. An administrator must enable Allow external artifact deployment. Your organization secures the pipeline and validates artifacts instead of relying on platform build checks. For a complete example, see Deploy apps with GitHub Actions.

Frequently asked questions

These answers summarize the choices above.

Can admins require all repositories to be in our GitHub Enterprise organization?

Not currently. Enforcement of GitHub repositories for all Copilot Managed Runtime projects and authoring surfaces is planned.

Which Git hosts are supported?

Platform-managed Git and GitHub Enterprise Cloud. For non-enterprise GitHub or other providers, use bring your own build.

Can we keep our own security and supply-chain controls?

Yes. See Retain your security and supply-chain controls for the boundary between GitHub and platform checks.

Where do I manage permissions?

Manage repository permissions in GitHub; contributors need read and write access. App-user sharing and Microsoft administrator roles don't grant repository access.