force-link-environment

Force-links a Power Platform environment to a new Pipelines host via the ManageEnvironmentStamp Dataverse action.

808|167|Updated Jan 21, 2026
One-click install
npx skills add https://github.com/microsoft/power-platform-skills --skill force-link-environment
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: force-link-environment
Source: https://github.com/microsoft/power-platform-skills/tree/main/plugins/power-pages/skills/force-link-environment
Command: npx skills add https://github.com/microsoft/power-platform-skills --skill force-link-environment

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

When a Power Platform environment is already associated with one Pipelines host, creating a deploymentenvironments record on a new host fails with "this environment is already associated with another pipelines host". This Skill performs the documented Force Link operation to move the environment's host association, which is otherwise a confusing manual remediation.

Core Features & Use Cases

  • Force Link execution: Calls the documented ManageEnvironmentStamp Dataverse action (the API behind the Force Link button) to move an environment's stamp to a new host, then polls validation until it succeeds.
  • Guided safety gates: Resolves the target host and dev environment from arguments, marker files, or PAC CLI, and requires explicit user consent before the destructive cross-host move.
  • Record recovery and auditing: Recovers failed deploymentenvironments records by re-querying Dataverse, and writes a docs/alm/last-force-link.json marker validated by a stop-hook script.
  • Use Case: A maker migrating environments from the Platform Host to a Custom Host hits the "already associated" error; run this Skill to relink the environment to the new host with confirmation and a full audit trail.

Quick Start

Ask the agent to force-link your development environment to the new pipelines host, optionally passing --host and --dev-env values.

Frequently Asked Questions about force-link-environment

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix "environment is already associated with another pipelines host"?

Use the Force Link operation, which calls the ManageEnvironmentStamp Dataverse action on the new host to take over the environment's association. This Skill automates the lookup, consent, execution, and post-link validation polling.

How do I migrate a Power Platform environment between pipelines hosts?

Run Force Link from the target host with the environment's BAP GUID. The previous host's deploymentenvironments record is delinked, and the move is reversible by running Force Link again from the previous host.

What permissions are required for Force Link in Power Platform Pipelines?

The caller needs the Deployment Pipeline Administrator role on the target host, plus Azure CLI and PAC CLI authentication. Without the role, ManageEnvironmentStamp returns 403 Forbidden.

Is Force Link destructive to the previous pipelines host?

Yes. Makers lose access to pipelines in the previous host that used this environment, and the old record keeps a stale validation status. The action is reversible only by running Force Link from the previous host.

Why does Force Link return 404 on the deployment environment record?

A 404 means no deploymentenvironments record exists on the target host yet. The Skill handles this by creating the record first and re-querying by BAP environment ID to recover its GUID before executing Force Link.