Hello Everyone,
I know, GIT integration in Power Platform is still somewhat experimental but I got the basics working so I'm trying to set up a DevOps Pipeline now to automate build and deployment.
My basic approach is this one:
- I have 1 to n developer environments where several solutions are connected with a GIT repository which I set up via DevOps.
- I have one "build" environment from where the current version of the solution should be exported.
The steps should be as follows:
1. Developer commits changes to GIT using the integratet Power Platform functionality
2. DevOps starts a pipeline which executes the following process
2.a. Send a pull request to the build environment via REST API to fetch any committed changes.
2.b. Export the solution from the build environment and place in repository.
3. DevOps starts a release pipeline which installs the solutions in the selected target environments.
So far everything works except the part 2.a. with the pull request for the build environment. I tried using this API action:
(A manual pull request on the build environment with a logged in user is possible and also works as expected. )
Here's my inline script which i tried to execute:
# Variablen
$clientId = $(CLIENT_ID)
$clientSecret = $(CLIENT_SECRET)
$tenantId = $(TENANT_ID)
$organizationUri = $(ORGANIZATION_URI)
$solutionUniqueName = "GlobalizationStudioSecurityRole"
# Scope für Dynamics (Beispiel für D365, ggf. anpassen)
$scope = "$organizationUri/.default"
# Token holen
$tokenBody = @{
client_id = $clientId
client_secret = $clientSecret
scope = $scope
grant_type = "client_credentials"
}
$tokenResponse = Invoke-RestMethod -Method Post `
-Uri "https://login.microsoftonline.com/$tenantId/oauth2/v2.0/token" `
-ContentType "application/x-www-form-urlencoded" `
-Body $tokenBody
$token = $tokenResponse.access_token
# REST-Call vorbereiten
$restUrl = "$organizationUri/api/data/v9.2/PullChangesFromGit"
$headers = @{
"Authorization" = "Bearer $token"
"OData-Version" = "4.0"
"If-None-Match" = "null"
"Accept" = "application/json"
"Content-Type" = "application/json"
}
$body = @{
SolutionUniqueName = $solutionUniqueName
} | ConvertTo-Json
# POST ausführen
$response = Invoke-RestMethod -Method POST -Uri $restUrl -Headers $headers -Body $body
# Ergebnis anzeigen (optional)
$response
When this step is executed, I get the following error message:
{
"error":
{
"code":"0x80040216","message":"Unable to retrieve solution components from root folder path FM_PowerPlatform/GlobalizationStudioSecurityRole in the Git."
}
}
Any Ideas as to what could be the issue?