强制将 Power Platform 环境改绑到新的 Pipelines 主机
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "force-link-environment" 技能: 1. 下载 https://raw.githubusercontent.com/microsoft/power-platform-skills/main/plugins/power-pages/skills/force-link-environment/SKILL.md 2. 保存为 ~/.claude/skills/force-link-environment/SKILL.md 3. 装好后重载技能,告诉我可以用了
请帮我强制链接这个 Power Platform 环境到新的 Pipelines 主机。当前创建 deploymentenvironments 记录时报错:this environment is already associated with another pipelines host。
执行环境与新主机的强制关联,并说明旧主机上的关联会被解除及其影响。
我要把一个开发环境从 Platform Host 迁移到 Custom Host,请执行 force link,并提醒我这对旧主机中的流水线访问有什么影响。
完成主机关联迁移,并明确提示该操作对旧主机是破坏性的但可通过反向 force link 恢复。
请将目标环境从当前 Custom Host 切换到另一个 Custom Host,并确认验证状态成功。
将环境改绑到新主机,并给出验证成功或后续检查结果的说明。
当创建 deploymentenvironments 记录时出现“环境已关联到另一个主机”错误,开发者或 DevOps 可用此技能把环境强制改绑到目标主机。它适用于恢复 Power Platform Pipelines 配置流程。
当团队要把环境从 Platform Host 迁移到 Custom Host,或在两个 Custom Host 间切换时,此技能可执行主机关联迁移。它适合主机架构调整或接管现有关联的场景。
如果某环境当前已被另一主机占用,但你需要让新主机管理该环境,此技能可以接管该关联。使用前应确认旧主机上的相关流水线访问会受影响。
文档说明了如何使用 force-link-environment 将开发或目标环境从一个 Power Platform Pipelines 主机改绑到另一个主机,适用于 deploymentenvironments 创建失败或主动迁移主机关联的场景。内容涵盖其对新旧主机记录与验证状态的影响、旧主机访问损失的风险、可逆性,以及执行前所需的 Azure CLI 与 PAC CLI 前置条件。
Plugin check: Run
node "${CLAUDE_PLUGIN_ROOT}/scripts/check-version.js"— if it outputs a message, show it to the user before proceeding.
Move a dev or target environment's Power Platform Pipelines host association from one host to another. This is the documented remediation when deploymentenvironments create fails with "this environment is already associated with another pipelines host", and also the right tool when intentionally migrating environments between hosts.
Microsoft Learn (ground truth): Using Force Link to associate an environment with a new host
In the target host (the new host the user wants to use):
deploymentenvironments record as the active stamp for the BAP environment.validationstatus flips to Succeeded (200000001).In the previous host (the host the env was previously linked to):
deploymentenvironments row is delinked. Its validationstatus is left stale until refreshed in the previous host's UI.The action is reversible by running Force Link again from the previous host.
Before any Dataverse call, refresh the agent's grounding by fetching the doc above via mcp__plugin_power-pages_microsoft-learn__microsoft_docs_fetch. If the doc has updated behaviors (e.g., new permission requirements, new warning text), surface them to the user before continuing. See ${CLAUDE_PLUGIN_ROOT}/references/alm-docs-grounding.md for the shared pattern.
| # | Phase | Output |
|---|---|---|
| 1 | Prerequisites | Azure CLI token for the host environment; PAC CLI authenticated |
| 1.5 | MCP Learn grounding | Confirmed current behavior of Force Link / ManageEnvironmentStamp |
| 2 | Identify host + dev env | hostEnvUrl, target host's deploymentEnvironmentId, source BAP env GUID |
| 3 | Resolve deploymentenvironments record | Either an existing record on the new host, or a freshly created one |
| 4 | Confirm destructive action | Explicit user consent via AskUserQuestion |
| 5 | Execute Force Link | 204 from ManageEnvironmentStamp + post-validation Succeeded |
| 6 | Write marker + summary | docs/alm/last-force-link.json + human-readable summary |
Create all tasks at Phase 1 start with TaskCreate. Mark each in_progress when starting and completed when done.
Reuse the shared verifier:
node "${CLAUDE_PLUGIN_ROOT}/scripts/lib/verify-alm-prerequisites.js"
Specifically required:
pac env who must report an authenticated environment (for --dev-env auto-discovery).az account show succeeds.ManageEnvironmentStamp returns 403.Fetch the host token from Azure CLI using the host's Dataverse URL as the resource. Reuse getAuthToken from scripts/lib/validation-helpers.js.
Call:
mcp__plugin_power-pages_microsoft-learn__microsoft_docs_fetch(url=
"https://learn.microsoft.com/en-us/power-platform/alm/custom-host-pipelines")
Confirm the "Using Force Link…" section's current warnings before proceeding. If the section now mentions new prerequisites or rollback constraints not covered in this skill, surface them to the user.
…
它会把开发或目标环境强制关联到新的 Power Platform Pipelines 主机,并覆盖之前的主机关联。底层调用的是文档化的 Dataverse `ManageEnvironmentStamp` 操作。
该操作对旧主机具有破坏性:旧主机中通过该环境运行流水线的制作者会失去访问能力。这个变更可通过从旧主机再次执行 Force Link 来反向恢复。
文档提到需要主机环境的 Azure CLI 令牌,以及已认证的 PAC CLI;其中 `pac env who` 应返回已认证环境。更详细的安装或权限信息见源码仓库。
对已部署的 Power Pages 站点执行安全扫描并生成通俗风险摘要。
帮助你快速搭建 Power Platform 管道,实现 Power Pages 自动化部署。
检查并配置 Power Pages 站点安全响应头,定位风险并指导修复设置。
对 Power Pages 站点执行端到端安全审查,并汇总生成完整 HTML 报告。
用于对已部署的 Power Pages 网站进行运行时浏览、爬取与接口验证测试。
帮助你将 Power Automate 云端流程接入 Power Pages 站点并生成调用代码
自动检查并准备可用的 Power Platform Pipelines 主机环境,确保流水线操作可顺利执行。
触发 Power Platform 管道部署并跟踪 Power Pages 解决方案发布状态
为 Power Pages 站点配置环境变量与部署设置,支持多环境 ALM 发布。
列出当前 Power Platform 环境连接,快速获取连接 ID 以配置代码应用连接器。
为 Power Apps 代码应用接入 Azure DevOps 连接器,便于查询工单、提报缺陷与管理流水线。
将现有 Power Pages 代码站点构建并部署到目标环境,完成认证与上传流程。