| name | power-platform-admin-v2 |
| description | Use when: building or debugging Power Platform for Admins V2 connector operations in a Power Apps Code App, including environments, backups, disaster recovery, environment groups, governance policies, capacity, billing, cloud flows, Copilot agents, Power Pages, or tenant administration. |
Power Platform for Admins V2 Connector Guide
Do not use CLI PAC commands to rediscover connector models or services. Use codeApp/dist/connectors/powerplatformadminv2.js as the repo source of truth for exported operation names, positional argument order, parameter casing, and response handling.
The connector file is generated by CAP. Do not edit it directly when implementing an app feature.
power.config.json
Always read the current power.config.json before editing it.
Ensure "id": "/providers/Microsoft.PowerApps/apis/shared_powerplatformadminv2" exists and the data source is exactly powerplatformadminv2.
"connectionReferences": {
"<connection-reference-id>": {
"id": "/providers/Microsoft.PowerApps/apis/shared_powerplatformadminv2",
"displayName": "Power Platform for Admins V2",
"dataSources": [
"powerplatformadminv2"
],
"authenticationType": "oauth2-auth",
"dataSets": {}
}
}
Rules for editing power.config.json:
- Preserve the existing connection-reference key and working metadata.
- Preserve
sharedConnectionId when it is present.
- Do not rename the data source or substitute the display name.
- If the app uses Dataverse environment variables, also load the environment-variables skill.
- Load the connections skill for shared connector rules.
Core Rules
- Import named helpers or
Powerplatformadminv2Service from ./connectors/powerplatformadminv2.js.
- Prefer a generated helper over constructing
client.executeAsync(...) in app code.
- Pass arguments in the exact generated order. Most operations require
api_version; do not guess or silently default it.
- Preserve case-sensitive names such as
EnvironmentId, BotId, ValidateOnly, and Operation_Location where the generated signature uses them.
- Preserve generated spellings, including
CreateEnviornmentGroupRuleBasedAssignment.
- Pass request payloads through the generated
body argument. Do not add MSAL, tokens, or manual Authorization headers.
- Treat destructive tenant operations as high impact. Prefer validation flags when offered and require clear user intent before invoking delete, disable, failover, restore, quarantine, or capacity-allocation actions.
Operation Families
The file exports 176 operations. Inspect the generated signature before using one; the main families are:
- Recommendations and packages:
GetRecommendations, GetRecommendationScenarios, ExecuteRecommendationAction, GetEnvironmentApplicationPackage, InstallApplicationPackage, GetApplicationPackageInstallStatus.
- Roles and connector inventory:
ListRoleDefinitions, role-assignment helpers, ListConnections, ListConnectors, GetConnectorById.
- Copilot administration and evaluation: agent delete/reassign/quarantine helpers and maker evaluation test-set/test-run helpers.
- Environment lifecycle: provisioning, Dataverse linking, enable/disable, managed-environment changes, SKU changes, copy, restore, recovery, backups, disaster recovery, and operation-status helpers.
- Environment groups and governance: group CRUD/membership, rule-based policies, assignments, and rule sets.
- Billing and capacity: billing policies, currency allocations, ISV contracts, storage warnings, tenant capacity, currency reports, and per-flow capacity reports.
- Apps and flows:
Get_AdminApps, Get_AdminApp, ListCloudFlows, ListFlowActions, and ListFlowRuns.
- Power Pages: website CRUD/lifecycle, WAF, allowed IP addresses, security scans, site visibility, portal data model, and AFD routing.
- Data-subject and tenant resources: approvals, connections, conversation transcripts, flows, run history, prompts, and delete helpers.
- Natural-language admin operations:
mcp_EnvironmentManagement(queryRequest, sessionId) and mcp_Governance(queryRequest, sessionId).
To locate an exact helper quickly:
rg -n '^const .* = async' codeApp/dist/connectors/powerplatformadminv2.js
rg -n -C 4 'const <OperationName> = async' codeApp/dist/connectors/powerplatformadminv2.js
Read the operation's embedded parameters and responseInfo metadata when the body or response shape is unclear.
Runtime Usage
Use a named import when only a few operations are needed:
import {
ListEnvironmentsForUser,
GetEnvironmentByIdForUser,
} from './connectors/powerplatformadminv2.js';
const API_VERSION = '<version-required-by-the-operation>';
const environments = await ListEnvironmentsForUser(API_VERSION);
const environment = await GetEnvironmentByIdForUser(environmentId, API_VERSION);
Use the service object when selecting operations from one connector namespace:
import { Powerplatformadminv2Service } from './connectors/powerplatformadminv2.js';
const result = await Powerplatformadminv2Service.GetOperationsForEnvironment(
environmentId,
API_VERSION,
50,
continuationToken,
);
Optional arguments remain positional. Supply undefined for an earlier optional argument when a later one is required.
Results and Long-Running Operations
- Helpers return the unwrapped connector data, not the SDK
{ success, data, error } envelope.
- Failed operations throw
Connector <OperationName> failed: <message>.
- Helpers are wrapped by
_dbgWrap, so the repository debugger can show arguments, results, failures, and duration.
- Preserve continuation values such as
$skipToken, $skiptoken, or continuationToken exactly as required by the chosen helper.
- For asynchronous administration actions, retain the returned operation identifier and poll the matching status helper, such as
GetOperationByID, GetEnvironmentGroupOperation, or GetApplicationPackageInstallStatus.
Debugging
- If an operation is not found, verify both the exported helper name and the connector operation name in the generated file.
- If parameters are rejected, compare the call against the generated positional signature and embedded parameter mapping; do not normalize casing by intuition.
- If authentication or connection lookup fails, verify the
shared_powerplatformadminv2 connection reference and powerplatformadminv2 data source.
- If pagination stalls, pass the returned token to the exact token parameter exposed by that operation.
- If an operation returns no visible payload, inspect its
responseInfo; successful delete or action operations may intentionally return no body.