Skip to content

A plugin marketplace for GitHub Copilot and other AI agents that provides Power Platform development plugins, including reusable skills, agents, and commands for building and deploying solutions.

9.7 KB
Raw Blame

Power Apps Standalone App Template

This template is an Expo, React Native, and TypeScript starter for building an iOS, Android, or hosted web app that connects to Power Platform data through @microsoft/power-apps-native-host.

Requirements

  • Node.js 24 LTS.
  • npm 10 or newer.
  • The Power Apps Mobile Preview app from the Apple App Store or Google Play.

Setup

Building native mobile apps with Power Platform is in Private Preview; do not use this in production.

Start from the Power Platform mobile app template, then use the mobile-app skill to generate the app plan, data model, screens, native capabilities, and connector wiring.

  1. Create a new app from the template and install dependencies:

    npx degit microsoft/power-platform-skills/plugins/mobile-apps/template#main my-mobile-app
    cd my-mobile-app
    npm install
    
  2. Install the mobile-app plugin from the Power Platform Skills marketplace.

    For GitHub Copilot in VS Code:

    1. Open the Extensions view.
    2. Enter @agentplugin in the search box.
    3. Find the Power Platform mobile-app plugin and select Install.
    4. Reload VS Code if prompted, then open Copilot Chat in Agent mode.

    Alternatively, run these manual commands inside a Claude Code or GitHub Copilot CLI session, not a shell:

    /plugin marketplace add microsoft/power-platform-skills
    /plugin install mobile-app@power-platform-skills
    

    See the public manual installation instructions. If installed but disabled or not loaded, enable/load the plugin in your host. Installation is optional and never performed automatically by app guidance.

  3. Open the template folder in VS Code and run the skill from Copilot Chat:

    /create-mobile-app
    

    The template includes this host package and the required Expo / React Native runtime dependencies. The skill updates the app in place as it designs and generates the mobile experience.

    When prompted to sign in, use credentials for the tenant where the Dataverse environment belongs.

  4. Create the Microsoft Entra app registration from Power Apps Wrap.

    Open the app-registration page for the Power Platform environment selected during /create-mobile-app:

    https://make.powerapps.com/environments/<environment-id>/wraps#create-app-registration
    

    Create the registration on that page, copy its Application (client) ID, and paste it when /create-mobile-app asks. The Wrap experience configures the native app registration for this flow. Do not add redirect URIs or API permissions manually; use Wrap to repair missing configuration. Some repairs and consent operations require an Azure tenant admin.

    If the app was created without a client ID, run /set-app-registration-native later from the app folder. It discovers tenant-visible registrations, checks the required permission profile, and writes the selected client ID to auth.config.json.

    Required API permissions

    The read-only checker validates the native runtime profile. The baseline is Dynamics CRM user_impersonation plus Power Platform API PowerApps.Apps.Read. Apps using Power Platform connectors additionally require Azure API Connections Runtime.All and the Power Platform API Connectivity.Connectors.Read, Connectivity.Connections.Read, Connectivity.Connections.Write, and Connectivity.Connections.UserConsent scopes. The checker does not require unrelated Wrap packaging permissions. Redirect platforms, packaging permissions, third-party-app allowlisting, and admin consent are finalized in Wrap.

  5. Start mobile app:

    /create-mobile-app starts Metro with npm run dev; its predev lifecycle runs schema generation and type-checking before Expo starts. The template's Metro config delegates sanitized logging to the native host package, which writes .powernative/metro-logs/, allowing /debug-app to work across VS Code, Copilot CLI, and Claude Code without a terminal ID.

    To start Metro manually instead, run the command below from the app directory. Manual starts and /debug-app use the same .powernative log source.

    npm run dev
    

    Multi-tenant support

    To let users choose among environments in multiple Microsoft Entra tenants, set the app registration's supported account type to accounts in any organizational directory and add the following fields under expo.extra.powerappsNative in app.json:

    {
      "tenantMode": "multi",
      "appDisplayName": "My App",
      "appName": "MyApp",
      "tenantPolicy": "organizations"
    }
    

    Use { "allowedTenantIds": ["<tenant-guid>"] } for tenantPolicy to restrict access to specific tenants. The native host supplies the sign-in, environment discovery, and environment-selection screens.

    Dev tunneling

    When a device cannot reach the workstation over the local network, start an authenticated Microsoft Dev Tunnel:

    az login
    npm run dev -- --tunnel
    

    Pass --tunnel-tenant <tenant-id> to select an Entra tenant. The command creates no anonymous access rule and deletes the tunnel when Metro exits.

  6. Preview the app by scanning the QR code with the Power Apps Mobile Preview app

App-local agent guidance

AGENTS.md is the canonical guidance for agents working in this app. CLAUDE.md imports it, and .github/copilot-instructions.md links to it relatively, so the guidance travels with the app without private plugin paths. It routes relevant requests to skills advertised by the current host, keeps small edits small, and separates startup diagnosis from upgrades.

Approved fresh-template preparation adds only missing guidance files and preserves existing customer guidance byte-for-byte. Existing apps can opt into guidance adoption separately; do not run fresh-template preparation over them. /debug-app can diagnose startup failures before the app loads. An agent already running creation can offer that workflow after observing a failure, but npm run dev alone does not wake an agent or install a monitor. No automatic hooks or watchers are added.

For app problems (including dependency installation, startup, runtime, or QR opening), try the available /debug-app skill first before reporting an issue. This is a recommendation, not a prerequisite: honor explicit direct report requests. Plugin installation/loading failures can make app diagnosis unavailable; do not block reporting in those cases.

Upgrade the Native Host

From the app directory, preview the next template upgrade:

npx --package @microsoft/power-apps-native-host@latest upgrade-template --dry-run

Apply it:

npx --package @microsoft/power-apps-native-host@latest upgrade-template

Each run upgrades one template version, installs compatible dependencies, and runs Expo validation. If another version is available, run the command again. The current version is stored in app.json under expo.extra.powerappsNative; do not edit this object.

Apps created before this version file existed must specify their source template version:

npx --package @microsoft/power-apps-native-host@latest \
	upgrade-template --from-version 1

The upgrader never changes app/, src/, android/, or ios/. If a root configuration change conflicts with your customization, it writes a .rej file for manual resolution. Failed validation restores files managed by the upgrade.

Supported package managers are npm, pnpm, and Bun. See CUSTOMIZATION.md before changing root configuration files.

Manual migration to a new template

To migrate without upgrade-template, create a new app from the latest template instead of modifying the old app in place. Commit or back up the old app first.

  1. Create the new app and install its dependencies.

  2. Copy the contents of app/ and src/ from the old app into the same directories in the new app:

    cp -R ../old-app/app/. app/
    cp -R ../old-app/src/. src/
    
  3. Copy app-owned assets and settings such as assets/, auth.config.json, power.config.json, and offline-profile.json as needed. Review each file before replacing the version supplied by the new template.

  4. Keep the new template's package.json, lock file, root configuration files, android/, and ios/. Reapply old customizations selectively rather than copying these files wholesale.

  5. Run npm install, npm run type-check, and the bundle command for each target platform, such as npm run bundle:android or npm run bundle:ios.

  6. Give the resulting errors to GitHub Copilot in Agent mode and ask it to update the migrated app/ and src/ code for the new template APIs while preserving the new template configuration. Review the changes and rerun the failing command until the build succeeds.

Web

Start the browser app:

npm run web

The command opens Local Play in your default browser and embeds the local Expo app in the hosted Power Apps player. Use the same browser profile as your Power Platform tenant.

Web builds are supported in Code Apps. They are also supported in Power Pages when the app uses Dataverse only.

To publish as a Code App, run npm run bundle:web, set appType to CodeApp and buildPath to dist-web in power.config.json, then run npx --no-install pa app push. Ensure Code App and the Mobile App have different app id by removing the appId field before pushing the app

To publish to Power Pages, run npm run bundle:web -- powerpages, then use the Power Pages skills to upload the generated dist-web directory.

License and notices

This template is provided under the license in LICENSE.