Initialize an app in a Copilot Managed Runtime partner integration

A partner integrating an app-creation experience must register each generated or existing project with Copilot Managed Runtime before it can be previewed or deployed. Initialization selects the source or artifact model, saves the app configuration, and connects the runtime SDK and build integration.

Choose an app setup flow

For generic setup, see the CLI quickstart or the Copilot quickstart. For command syntax and options, see ms app create and ms app init.

New app with platform-managed Git

ms app create my-app \
  --display-name "My App" \
  --non-interactive

cd my-app
npm install

The CLI normally routes the creator to an environment. Pass --environment-id <environmentId> only when the creator explicitly targets a specific environment.

Existing project with platform-managed Git

Use platform-managed Git as the preferred integration for an existing partner project:

cd <appRoot>

ms app init \
  --display-name "My App" \
  --repo native \
  --build-command "npm run build" \
  --build-path ./dist \
  --non-interactive

Existing partner project with partner-owned artifacts

Use this alternative when you retain partner-owned source and builds. External artifact deployment requires an environment administrator to enable it.

cd <appRoot>

ms app init \
  --display-name "My App" \
  --repo none \
  --build-command "npm run build" \
  --build-path ./dist \
  --non-interactive

Existing project with external Git

Use a supported repository owned by a GitHub Enterprise Cloud organization. See Repository options.

ms git auth refresh \
  --repo https://github.com/contoso/my-app \
  --open-browser

cd <appRoot>

ms app init \
  --display-name "My App" \
  --repo https://github.com/contoso/my-app \
  --build-command "npm run build" \
  --build-path ./dist \
  --non-interactive

Use a full commit SHA for build and deploy automation.

Persist app configuration

ms app create and ms app init write ms.config.json in the app root. Commit or otherwise persist it with the project. It contains identifiers and build settings, not user credentials.

Inspect ms.config.json directly to verify the local configuration. Use ms app info --json to inspect server-side app state.

Don't reuse one app's config file to register another app. Never persist the CLI's user token cache with app source.

Add the runtime SDK

npm install @microsoft/cmr-apps

The package exposes subpath imports rather than a root import:

import { getContext } from "@microsoft/cmr-apps/app";
import { getUser } from "@microsoft/cmr-apps/auth";
import { getClient } from "@microsoft/cmr-apps/data";

Configure Vite

npm install --save-dev @microsoft/cmr-apps-vite-plugin

Add the plugin to vite.config.ts:

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { copilotManagedRuntime } from "@microsoft/cmr-apps-vite-plugin";

export default defineConfig({
  plugins: [react(), copilotManagedRuntime()],
});