Archive

Archive for the ‘DevOps’ Category

Azure DevOps (ADO) | Pipelines | Publish and Access Build Artifacts from Staging Directory

September 23, 2021 Leave a comment

In this article, Lets see how to Publish and Access Build Artifacts using ADO Pipeline.

What are Build Artifacts:

  • Build artifacts are the files generated by your build.
  • In ADO Pipelines, We can use Build.ArtifactStagingDirectory Predefined Variable, on the agent where any artifacts are copied to.

Below are the steps to Publish and Download the Build Artefacts in a ADO Pipeline.

Steps to Publish the Build Artefacts:

  • Lets see how to Publish a file to Build Artifacts folder, using following ‘Power Platform Export Solution’ Task.
  • In the below Task, I am exporting a Solution from CRM Instance and publishing as $(Build.ArtifactStagingDirectory)\$(SolutionName)_managed.zip by using the ‘Solution Output File’ property.
  • In the above the ‘Solution Output File’ property, $(SolutionName) is my custom defined ‘Pipeline Variable’ contains Solution name.
    • ‘ALM_Base’ is my Dynamics Instance Solution name.
  • And $(Build.ArtifactStagingDirectory) is Predefined Variable.
  • Once the pipeline runs successfully, you can download the published artefacts (i.e., Solution folder) as follows.

Steps to Download the Build Artefacts:

  • Go to Pipeline Runs and select the last run.
  • Click on the below highlighted link.
  • Select the folder you want to download.
  • We also have an option to commit these files to Git using ‘Command Line Script’ task.

🙂

Categories: DevOps Tags: , ,

Azure DevOps (ADO) | Pipeline failure | You need the Git ‘GenericContribute’ permission

September 17, 2021 Leave a comment

While pushing the code to Repo using ‘Command Line Script’ task in ADO pipeline, got the following permission issue.

  • Following is the script used in ‘Command Line Script’ task to push the code to main branch.
echo commit all changes
git config user.email "rajeevpentyala@live.com"
git config user.name "Rajeev Pentyala"
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

Reason for the issue:

  • Account under which the ADO pipeline running, does not have required permissions to Push the code.

Fix:

  • Go to Settings -> Repositories
  • Under ‘Security’ tab, select the ‘ALM Build Service(User_Name)‘ and grant highlighted privileges.

🙂

Azure DevOps (ADO) | Pipeline failure | Failed to connect to Dataverse

September 16, 2021 Leave a comment

One of my ADO pipelines ‘Power Platform Publish Customizations’ task failed with “Failed to connect to Dataverse” error.

Reason:

  • ‘Power Platform Publish Customizations’ task’s ‘Authentication type’ was selected as ‘Username/password’ which does not have MFA support.
  • MFA (Multi Factor Authentication) was enabled on the Environment, which I was trying to connect from the Pipeline.
  • Since the ‘Power Platform Publish Customizations’ task’s ‘Authentication type’ was selected as ‘Username/password’ which does not support MFA, pipeline could not connect to the Dataverse environment.

Fix:

  • Create an ‘Application User’ by completing App Registration in Azure Active Directory and grant a Security Role.
  • In the ADO pipeline’s ‘Power Platform Publish Customizations’ task, select ‘Authentication type’ as ‘Service Principal’.
  • Make sure the ‘Service Connection’ configured properly with Azure App Registration details (i.e., Tenant ID, Application ID and Client Secret).
    • My connection name is ‘SP_ExpAugust21’ and details are as follows.
  • Save and run the pipeline and it should work now.

🙂