cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
priyeshwagh777
Kudo Collector
Kudo Collector

Command Line failing with error "Cmd.exe exited with code 1" after Unpack in Command Line in Pipeline

Hi,

I've been trying to export Solution from an environment and trying to import in another on in same tenant. In the first half of the process where we usually go with - Tool Installer -> Export Solution -> Unpack Solution -> Command Line Script.

My Job is failing in Command Line Script which looks like this

echo Write your commands here

echo commit all changes
git config user.email "crmadmin@cft146.onmicrosoft.com"
git config user.name "Joe Danny"
git checkout master
git add --all
git commit -m "solution export"
echo push code to new repo
push origin master

 

I also don't see if my solution was actually exported. The Export Step though was successful.

I'm not using MFA, but I'm not sure if this is correct and where I can find documentation on this. I simply tried to do referring other's articles. Please point me in the correct direction.

Thanks.

8 REPLIES 8
rimatos
Community Support
Community Support

Hi @priyeshwagh777 ,

 

could you let me know from where you are attempting to export your solution from? If you are attempting to export a solution from Power Platform and are using PowerApps, you can simply go to make.powerapps.com, and you can import it directly from the solutions tab:

 

 

image.png

 

Hope this helps!

 

Regards,

Ricardo

,

I'm doing this by using Power App Build Tools in Azure DevOps under PipeLines to automate my CI/CD process.

Greetings, sorry this thread has been quiet - can you pls. try and remove the following line from your script: "echo Write your commands here"

 

MFA is unrelated to this as your solution exports correctly, i.e. you are connected to the environment. Let me know if that helps

 

Thanks

 

prik20
New Member

Hi, 

Was anybody able to solve this issue? I am getting the same error, tried removing the echo statements, then too failing

DianaBirkelbach
Super User
Super User

Hi @prik20 , 

I have the feeling that this is an error caused if in the agent job properties, the "Allow scripts to access the OAuth token" is missing.

DianaBirkelbach_1-1613583124517.png

 

DianaBirkelbach_0-1613583024523.png

Hope this helps!

Kind regards,

Diana

Kind regards,
Diana
----------
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
taclinard
Frequent Visitor

Ok I had the exact same problem as stated above, and not sure if you figured it out already, but this is what worked for me.

First- Verify the name of your primary repository branch, code from elsewhere calls it "master" but mine was actually called "main".
So I changed the code to :


echo commit all changes
git config user.email "email@comany.com"
git config user.name "<username>"
git checkout main
git add --all
git commit -m "solution init"
echo push code to new repo
git -c http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" push origin main

 

Then I also had to make sure that the repository had the right permissions.

 

So I went to Project Settings>Repositories Clicked on my repository for settings

 

Then I went to Security and updated the Build Service User as well as my own login with permissions to write, push, and create in the repository.

 

I also updated the permissions on all other repositories for future pipelines.

taclinard_2-1617123119185.png

 

taclinard_3-1617123119200.png

 

After that, it worked.

 

 

Wanted to say thank you and much appreciated! This resolved the problem for me. 👍👍

Thanks for sharing the solution, I also had the same problem and was able to solve it!

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (3,709)