Skip to main content

Microsoft Power Platform Build Tools for Azure DevOps Part 1

 

I am going to write two articles

1st one will be how to use DevOps Pipeline to Export your solution and add it to Code Repository

2nd one will be how to Create a Release to Import your solution to various environments


As a per-requisite for this article its a good idea to familiarize yourself the various parts of DevOps, you will have a more successful implementation if you have a good knowledge of what DevOps:

  1. Repos

  2. Pipeline

    1. Pipeline

    2. Environments

    3. Releases

    4. Library

    5. Task groups

    6. Deployment groups

    7. </> XAML are.

For this article we are going to focus more on how to Create a Pipeline, being familiar with PowerShell Script will be helpful as well.


The following documentation from Microsoft is a good reference

https://docs.microsoft.com/en-us/power-platform/alm/devops-build-tools

To start with Create a Folder under your Repository, in my case I called the folder “D365_Solutions”


New Pipeline



Select “Use the classic editor”



Click “Continue



Click “Enpty Job


We just Created a Pipeline now what is left is

  1. PowerShell Script to read solution Name

  2. Use Power Platform Tool to:

    1. Publish Customization

    2. Increase Version

    3. Export Solutions

    4. Run Solution Checker

    5. Unpack the Solutions

  3. Use Command Line to Check in our Solution to the code Repository




I used a global variable under Library to store the solution Name, you can decide to store it as local variable.

PowerShell 



Code:

$date=$(Get-Date -Format 'yyyyMMdd')

Write-Host "##vso[task.setvariable variable=CurrentDate]$date"

Write-Host "BuildConfiguration is $(ManagedSolName)"

Write-Host "##vso[task.setvariable variable=SolutionName]$(ManagedSolName)"


As you can see you do not need that much knowledge of PowerShell the code is pretty much straight forward and simple


Power Platform Publish Customization



Here you have to make sure to Create your enviroments, you have two ways to do it

  1. Username/password (no MFA support)

  2. Service Principal/client secret (supports MFA)

I have chosen the second one “Service Pricipal/client secrete” I am sure you know how create Application user for your authentication


Power Platform Set Solution Version


Power Platform Export Solution



One note I am exporting the solution as Managed, you have an option to work on as unmanaged too which is not ideal to deploy to upper environments like TEST, UT, PROD


Power Platform Checker


Power Platform Unpack Solution



Command Line Check in Solution to Repository




Comments

  1. Got the error from below when running the pipeline step Command Line Check in Solution to Repository, any thoughs?

    Starting: Command Line Script
    ==============================================================================
    Task : Command line
    Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
    Version : 2.182.0
    Author : Microsoft Corporation
    Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
    ==============================================================================
    Generating script.
    ========================== Starting Command Output ===========================
    "C:\Windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "D:\a\_temp\4fd645ad-ec07-4b1d-8127-cab5a952299f.cmd""
    commit all changes
    error: pathspec 'master' did not match any file(s) known to git
    fatal: pathspec '—' did not match any files
    error: pathspec 'export”' did not match any file(s) known to git
    push code to new repo
    git: 'bearer' is not a git command. See 'git --help'.
    ##[error]Cmd.exe exited with code '1'.
    Finishing: Command Line Script

    ReplyDelete
    Replies
    1. I think the issue is with the path of your git repository,
      make sure you have master branch under your git repository,
      uder your master branch D365_Solutions folder in you replicating the sample I have provided.

      Delete

Post a Comment

Popular posts from this blog

Azure DevOps Fork Repos between two Organization

  Azure DevOps Fork Repos between two Organization This weekend I embarked on a topic a bit foreign to myself, on the surface seemed a bit simple. The idea is to fork my Azure DevOps Repo to a different organization and push changes between them. Bad news DevOps doesn’t allow to fork Repos to a different organization, you have only the capability to fork to a different Projects within the same Organization. I’m pretty much sure there are so many other ways to solve this issue, but this is the one that I found to be easy to implement. Import Repo to the new Organization Remember here you have to generate a personal token to be able to import the Repo you have to be a member of the new organization as well This might take a few minutes depending on the size of your project, once its complete you will receive a confirmation email, or just refresh it after few minutes So far all looks good, you can clone the solution in your new Organization,

Power Platform Tool for Visual Studio 2019/2022

 Power Platform Tool for Visual Studio 2019/2022 We have a new Visual Studio Extension Power Platform Tool.  Creation and deployment of Plugins, Custom Workflows and WebResources is going to be easy and time saving.  This article is going to focus on how to connect to your environment and create your Visual Studio Solution. In a subsequent article I will try to cover on how to Create and deploy your components to your environment. Installation is straight forward go to      Tools→ Manage Extensions→ Search for Power Platform Tools     You will Need Visual Studio 2019 or later version     Subsciption to Pawer App/Dataverse or trial       .Net Framework 4.6.2 Now we will go over how to create a Project and connect it to your Environment Open Visual Studio 2019 →New Project Search for Power Platform Solution Template Add Project Name and Location → Create Click on Start from Dataverse to connect to your environment Enter the following and → Login

How to use Formatted Values in Power Automate Flow Dynamics 365

  How to use Formatted Values in Power Automate Flow Dynamics 365   If you have been working on Power Automate for Dynamics 365 you might have been wandering how you can access a lookup Formatted Value or Option Set formatted values. You can use the following format to access: body(‘{Action Name}’)?[‘{fieldname} @OData.Community.Display.V1. FormattedValue’] You just have to be mindful in Dynamics 365 lookup field name they do not translate to the proper field name, you might have to and an “_” as a prefix and “_value” as a postfix, I will leave that to you.