Description
We're automating the linking of an identity to a Power Platform environment with an Azure DevOps Pipeline.
A Service Principal is used for Azure and Power Platform authentication.
While running the provided NewIndentity.ps1 script we get the following error:
https://api.bap.microsoft.com/providers/Microsoft.BusinessAppPlatform/environments/{EnvironmentId}/?&api-version=2016-11-01
Error getting environment with d6d92427-09be-e2fd-a209-2358af41df57 for endpoint prod
Error = @{StatusCode=404; StatusDescription=Not Found; Headers=Strict-Transport-Security: max-age=31536000; includeSubDomains
After some investigation and Postman API calls I found that the error is resolved using this URL for the API call:
https://api.bap.microsoft.com/providers/Microsoft.BusinessAppPlatform/scopes/admin/environments/{EnvironmentId}/?api-version=2016-11-01
The issue seems to be related to the use of a Service Principal because the script works out of the box while using my personal account.
Issue script & Debug output
function GetEnvironmentFromBAP ($environmentId, $ApiVersion, $method, $body)
{
$getEnvironmentUri = "https://{bapEndpoint}/providers/Microsoft.BusinessAppPlatform/environments/{environmentId}/?&api-version={apiVersion}" `
| ReplaceMacro -Macro "{environmentId}" -Value $environmentId
$environmentResult = InvokeApi -Method $method -Route $getEnvironmentUri -ApiVersion $ApiVersion -Body $body
return $environmentResult
}
Environment data
Module versions
Script 15.4.0 Az
Script 1.0.40 Microsoft.PowerApps.PowerShell
Script 2.0.203 Microsoft.PowerApps.Administration…
Description
We're automating the linking of an identity to a Power Platform environment with an Azure DevOps Pipeline.
A Service Principal is used for Azure and Power Platform authentication.
While running the provided NewIndentity.ps1 script we get the following error:
https://api.bap.microsoft.com/providers/Microsoft.BusinessAppPlatform/environments/{EnvironmentId}/?&api-version=2016-11-01
Error getting environment with d6d92427-09be-e2fd-a209-2358af41df57 for endpoint prod
Error = @{StatusCode=404; StatusDescription=Not Found; Headers=Strict-Transport-Security: max-age=31536000; includeSubDomains
After some investigation and Postman API calls I found that the error is resolved using this URL for the API call:
https://api.bap.microsoft.com/providers/Microsoft.BusinessAppPlatform/scopes/admin/environments/{EnvironmentId}/?api-version=2016-11-01
The issue seems to be related to the use of a Service Principal because the script works out of the box while using my personal account.
Issue script & Debug output
Environment data
n/aModule versions