Power Platform ALM – Part 2: Meet the Sample Solution!
January 26, 2023
Accelerate development with the Catalog for Power Platform
May 25, 2023

This article describes the common errors associated with the Power Platform Build Tools for Azure DevOps, and how to fix them.

Turn On Debugging

To see the true error messages associated with a failed DevOps pipeline run, turn on debugging when you run a pipeline by clicking the Enable system diagnostics checkbox.

When you click the checkbox, the following variables are set when the pipeline runs.

When the pipeline runs, the debug messages appear in purple.

For example, without system diagnostics turned on, you get a generic error message like this:

When you turn on the system diagnostics, you can find the real error that will help you fix the issue.

Common Errors

Here are the errors I have encountered the most, and how to resolve them.

AADSTS700016 Error

When using a Service Connection, if you receive an error like this, please double check the Application ID is correct.  If the Application ID is incorrect this error will appear.

##[debug]Microsoft.PowerPlatform.Dataverse.Client.Utils.DataverseConnectionException: Failed to connect to Dataverse ---> System.AggregateException: One or more errors occurred. ---> Microsoft.Identity.Client.MsalServiceException: AADSTS700016: Application with identifier '***' was not found in the directory 'Directory Name'. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You may have sent your authentication request to the wrong tenant.

Insufficient Pipeline Permissions

The following error will appear when attempting to run a pipeline if insufficient permissions have been granted to the Service Connections the pipeline uses.

To fix this error, select the Grant access permission to all pipelines checkbox in the Service Connection edit page and click Save.  You can also grant permissions to individual pipelines.

Flow Errors

If a Flow fails to turn on after it is deployed, you may receive this type of error when running a Power App that calls the Flow.

In this example, this error appeared in the Power App when it tried to call a Flow named CreatePPAItem.

When trying to turn on the Flow, the following error appeared:

This error indicates the account that was used to create the SharePoint Connection used in the CreatePPAItem Flow does not have permissions to the SharePoint environment. 

To solve this issue, grant the account that was used to create the SharePoint Connection access to the SharePoint site, then turn on the Flow.

Missing AAD Application Permissions

Microsoft provides a PowerShell Script to create AAD Applications in the documentation here and shown below.

However, the PowerShell script does not create the user_impersonation permission for the PowerApps Runtime Service.  If this occurs, an error will appear when running the DevOps pipelines with a Service Connection that uses a Service Principal.  The error indicates the user does not have the permissions to log on.

To fix this, add the user_impersonation permission manually.

Incorrect ConnectionId in Settings JSON Files

The following error indicates an incorrect ConnectionId in a settings JSON file.  To fix this error, update the ConnectionId in the Settings JSON file and re-deploy the solution using the Azure DevOps pipelines.

Invalid JSON in Settings JSON Files (During Solution Import)

The following error indicates that there is invalid JSON in the Settings JSON File. Double check the JSON to ensure that everything is formatted properly and there are no invalid characters.

2023-03-09T12:12:22.0650656Z [ ‘Sorry, the app encountered a non recoverable error and will need to terminate. The exception details have been captured and will be forwarded to the development team, if telemetry has been enabled. Exception Id: ece0dbc9-f22a-473b-83dd-02eebe561d71, Exception Type: Newtonsoft.Json.JsonReaderException’ ]
2023-03-09T12:12:22.1505193Z [ ‘The diagnostic logs can be found at: D:\a\_tasks\PowerPlatformToolInstaller_8015465b-f367-4ec4-8215-8edf682574d3\2.0.16\bin\pac\tools\logs\pac-log.txt’ ]
2023-03-09T12:12:22.3330903Z ##[error]error: 1
2023-03-09T12:12:22.3341499Z ##[debug]Processed: ##vso[task.issue type=error;]error: 1
2023-03-09T12:12:22.3344478Z ##[error]failed: Connected to… Production
Connected as ***
Sorry, the app encountered a non recoverable error and will need to terminate. The exception details have been captured and will be forwarded to the development team, if telemetry has been enabled. Exception Id: ece0dbc9-f22a-473b-83dd-02eebe561d71, Exception Type: Newtonsoft.Json.JsonReaderException

You can look at the Settings JSON file code in Azure DevOps to see if anything is wrong. Here is an example where an extra ” caused the error. Notice the red squiggly underline that helps you find the invalid character. In this example, the invalid character is an extra “.