web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Use Powershell command...
Power Apps
Suggested Answer

Use Powershell command to pull changes from GIT Repository - Error

(1) ShareShare
ReportReport
Posted on by 6
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?
I have the same question (0)
  • Suggested answer
    pavanmanideep Profile Picture
    576 Power Up Champ - 2025 on at
     
    Firstly I would like to understand why are you using PowerShell to pull the changes. Please use Git Commands.
     
    Hope this helps. If you need any more information, please do let us know.
     
    Cheers,
    PMDY
    Microsoft MVP(Power Apps)
     
  • Suggested answer
    wolenberg_ Profile Picture
    1,476 Super User 2026 Season 1 on at
    Hello there,

    The error means the API can’t find the solution folder in Git. Double‑check that the solution unique name matches the folder path exactly and that your build environment’s Git integration points to the correct root and branch. If you want a more reliable automation, consider using the Power Platform CLI in DevOps pipelines instead of the REST PullChangesFromGit call.

     

    ✨ If my response helped resolve your issue, please mark it as ✅ Accepted Answer and give it a ❤️ like — it helps others in the community find solutions faster. Thank you!


     
  • Jean_Frederic Profile Picture
    6 on at
    thank you for your thoughts. We are using Power Shell because we are running a Azure DevOps Pipeline and the API call mentioned above is the suggested solution from Microsoft. I don't have an idea how we should use GIT commands to trigger the pull request on a Power Platform environment. If you have an idea or any sources please feel free to share.
     
    Sadly the Power Platform build tools also do not provide the option to start the pull request on the power platform environment, thus the workaround with the REST call.
  • wolenberg_ Profile Picture
    1,476 Super User 2026 Season 1 on at
    Hi , you can’t trigger a Power Platform environment pull with Git commands alone. The only supported automation is via the REST API or by using the Power Platform CLI/Build Tools to handle solution export/import. If you want a fully automated pipeline, PAC commands are usually more reliable than the PullChangesFromGit API.
     

    ✨ If my response helped resolve your issue, please mark it as ✅ Accepted Answer and give it a ❤️ like — it helps others in the community find solutions faster. Thank you!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 424

#2
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#3
11manish Profile Picture

11manish 290

Last 30 days Overall leaderboard