Microsoft App 浏览器预览
play
通过 `ms app play` 在浏览器中打开 Microsoft App。适用于打开已部署的线上版本或云端托管的预览版本(主分支或特定提交 SHA),而无需启动本地开发服务器。
- License 许可
- MIT
- 最近更新
- 2026-11-06
- Stars
- ★ 36
- Forks
- 12
01 前言 Front Matter
- name
- play
- description
- Opens a Microsoft App in the browser via `ms app play`. Use when opening the live deployed version or a cloud-hosted preview (main branch or specific commit SHA) without starting a local dev server.
- allowed-tools
- Read Grep Bash AskUserQuestion
03 SKILL.md 正文
? Shared Instructions: shared-instructions.md — Cross-cutting concerns.
Play
Opens a Microsoft App in the browser by fetching its cloud play URL and launching it. No local dev server required.
| Mode | Command | What opens |
|---|---|---|
live (default) |
ms app play |
The most recently deployed version. A snapshot — does not update until ms app deploy is run again. |
preview (main) |
ms app play --mode preview |
Built from the main branch on demand — always reflects the latest pushed code, even without a deploy. |
preview (commit) |
ms app play --mode preview --commit <sha> |
App as of a specific commit SHA — useful for code review or regression testing. |
Live vs. preview: Live requires a prior
ms app deploy. Preview builds from source on demand — it works without any deployment and always reflects unpublished code.
Workflow
- Memory Bank → 2. Verify Project + Env → 3. Resolve Mode → 4. Run → 5. Surface URL
Step 1: Check Memory Bank
Read memory-bank.md per shared-instructions.md for the app's environment/app identifiers, if recorded.
Step 2: Verify Project + Env
test -f ms.config.json || { echo "Not in a Microsoft App workspace."; exit 1; }
BIN=ms
$BIN auth status # must report the expected UPN
--app and --environment-id can be passed explicitly to run from outside a project directory — ms.config.json is only needed for the defaults.
Step 3: Resolve Mode
If not already clear from the user's request, ask:
"Do you want to open the live deployed version, a preview of the latest code on main, or a preview of a specific commit?"
Map intent to mode:
| User says | Mode |
|---|---|
| "live", "deployed", no qualifier | live (default — no flag needed) |
| "preview", "latest", "unpublished", "before deploy" | --mode preview |
| "preview at commit X" / specific SHA provided | --mode preview --commit <sha> |
Step 4: Run
Live (default):
$BIN app play
Preview — latest code on main:
$BIN app play --mode preview
Preview — specific commit:
$BIN app play --mode preview --commit <sha>
Full flag reference:
| Flag | Alias | Default | Description |
|---|---|---|---|
--mode |
-m |
live |
live or preview. |
--commit |
-c |
HEAD on main | Preview only. The commit SHA to open. Ignored for live mode (CLI throws if combined). |
--app |
appId from ms.config.json |
App name override for running outside the project directory. | |
--no-browser |
false | Print the URL without opening a browser tab. | |
--json |
Emit { success, appName, mode, url, commitHash } instead of human-readable output. |
Step 5: Surface URL
Present the URL the CLI printed. For live mode, surface the CLI's built-in warning:
Live URL for 'my-app':
https://apps.powerapps.com/play/e/<env-id>/app/<guid>
⚠ Live does not auto-update. Run /deploy to publish new code to the live URL.
For preview:
Preview URL for 'my-app' (main):
https://apps.powerapps.com/play/e/<env-id>/app/<guid>/branch/main
For commit-pinned preview:
Preview URL for 'my-app' (commit abc1234):
https://apps.powerapps.com/play/e/<env-id>/app/<guid>/commit/abc1234
Edge Cases
| Situation | Action |
|---|---|
No live build available — run 'ms app deploy' first |
The app has never been deployed. Tell the user to run /deploy, then retry ms app play. |
--commit passed with --mode live |
Hard UsageError from the CLI. Explain that --commit only works with --mode preview. |
No appPlayUri for preview mode |
App record exists but play URI is missing. Surface the error verbatim and stop. |
| User wants URL without opening a browser | Pass --no-browser; the CLI prints the URL and exits without launching a tab. |
| User is outside a project directory | Pass --app <name> and --environment-id <id> explicitly. |
04 同仓库更多 Skills
Microsoft 托管应用状态与附件管理
state
使用 `ms project state` CLI schema 命令和生成的 TypeScript 客户端,存储与查询 Microsoft 托管应用的内置状态和文件附件。首先,在用户登录 CLI 后运行 `ms feature status --name state --json`;如果 `feature.enabled` 不为 `true`,则推荐替代的连接器或数据源。
Microsoft 应用共享与访问控制
share
通过 `ms app share` / `ms app unshare` 与用户共享(或取消共享)Microsoft 应用。在需要更新应用访问控制时使用。
Microsoft App 共享链接管理
share-link
通过 `ms app share link create`、`ms app share link list` 和 `ms app share link revoke` 管理 Microsoft App 的租户级共享链接。适用于希望通过 URL(而非指定主体)来分发应用访问权限的场景。
可用连接器列表查询
list-connectors
列出当前活动环境中可用的连接器——包括每个连接器是被组织策略允许还是阻止——以及已接入 Microsoft App 的连接绑定数据源。适用于在添加数据源之前发现可用的连接器及其操作。
Microsoft 应用列表查询
list-apps
通过 `ms app list --json` 以及可选的 `ms app show --json` 发现活动环境中的受管理应用。在列出或定位应用时使用。
Microsoft 应用本地运行
dev
通过 `ms app dev` 在本地运行 Microsoft 应用并支持热重载。在开始或重启本地开发、展示 App Player URL 时使用。