Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This article provides troubleshooting steps for when the PAC CLI (Power Apps Command Line Interface) pac code add-data-source command fails.
Symptoms
Failures usually happen because something on your computer or network is blocking the connection or disrupting authentication.
| Symptom | Example Message |
|---|---|
| Fetch Failed | Fetch Failed (no additional stack) |
| Timeout / network errors | ETIMEDOUT, ENOTFOUND, ECONNRESET |
| Environment mismatch | Data source not found / unexpected schema |
Prerequisites
- Verify you have the latest Power Platform CLI installed. Update it if you aren't sure.
- Verify you are authenticated to the correct environment. Use
pac auth createandpac auth listcommands. - Verify your network allows outbound HTTPS calls to Power Platform endpoints.
Troubleshooting steps
To diagnose the root cause, follow these steps:
Step 1: Validate configuration
Open power.config.json file and confirm:
environmentIdmatches the environment you intend to target.regionis set toprod, unless you are intentionally targeting another region. Add it if missing.
Step 2: Cross-check environment context
Run the pac env who command.
Compare the Environment ID in the output with the environmentId value in power.config.json.
Example output (annotated):
Connected as user@domain.com
Organization Information
Org ID: 00aa00aa-bb11-cc22-dd33-44ee44ee44ee
Unique Name: unq2889ab2be728ef118406000d3a33f
Friendly Name: User Name
Org URL: https://myorg.crm.dynamics.com/
User Email: user@domain.com
User ID: aaaaaaaa-bbbb-cccc-1111-222222222222
Environment ID: aaaabbbb-0000-cccc-1111-dddd2222eeee <-- Ensure this matches
Corresponding power.config.json example snippet:
{
"environmentId": "aaaabbbb-0000-cccc-1111-dddd2222eeee",
"region": "prod"
}
Step 3: Re-run command
Run the pac code add-data-source command again. For example:
pac code add-data-source -a dataverse -t account
Look for HTTP status codes or error messages in the output.
Step 4: Network & security validation
If still failing:
- Confirm no corporate proxy/firewall blocks CLI processes (non-browser traffic).
- Approve required Power Platform endpoints. Review Power Platform connectivity requirements
Verify browser connectivity
This step helps confirm that your user account has the correct permissions and that the data source is reachable from your computer.
- Open a web browser on the same computer where you're using the PAC CLI.
- Navigate directly to the data source you're trying to add. For example, the SharePoint site or the Dataverse environment URL.
- Sign in with the same credentials you used to authenticate with the PAC CLI pac auth create command
- If you can't access the resource, a permissions issue with your user account is the likely root cause.
- If you can access it, move to Analyze network traffic.
Analyze network traffic
This is the most effective way to see the raw network communication data between the PAC CLI and the data source endpoint.
Download and install Fiddler Classic. Fiddler is tool to monitor network traffic.
Start Fiddler and ensure it's capturing traffic. Go to File > Capture Traffic.
In a command prompt, run the failing
pac code add-data-sourcecommand.In the Fiddler session list, look for requests made to your data source endpoint. For example:
yourorg.crm.dynamics.comoryourtenant.sharepoint.com.Analyze the response information:
- A
200status code indicates success. - A
401(Unauthorized) or403(Forbidden) status code points to an authentication or permission issue. - Other error codes or a complete lack of response can indicate that a firewall or proxy is blocking the request.
- A
Step 5: Clear/Reset auth context
If a mismatch is detected, you should clear or reset the auth context using the following PAC CLI commands.
pac auth list
pac auth select --index <n>
pac env who
If incorrect, re-authenticate:
pac auth create --environment <yourEnvironmentId>
Escalation data
Before you contact technical support to file an issue, collect the following data.
Provide:
- CLI version. Use the
pac --versioncommand - OS and shell (Windows cmd / PowerShell / WSL)
- The full command used
- Sanitized debug output excerpt
power.config.jsonafter you redact secrets