Category Archives: PowerPlatform

ALM For Power Platform/CDS In Azure-Devops/VSTS Using Power Platform Build Tools – Part 2

In the previous post, I showed you how to setup the Azure DevOps and install Power Platform Build Tools to Azure DevOps. In this blog post, I will show you how we can export from the Dynamics 365 CE instance and commit to VSTS/Azure DevOps.

Below is the VSTS Build-pipeline and will include the following steps

How to setup VSTS Build Definition

In Build Pipeline, we will be exporting the CRM solution, unpack it using the Power Platform Build Tools and store the solution file in Artifacts. You can create a build definition directly from Visual Studio Online (VSTS/Azure-DevOps) or from within Visual Studio. Firstly, I will show you how to create a build definition from within Visual Studio, navigate to the Builds tab in the Team Explorer:

Once there, you can click New Build Definition to be taken directly to Visual Studio Online. This is where you would start if you had decided to create the build definition directly from Visual Studio Online instead of starting in Visual Studio.

On the dialog box that pops up in the browser, we’ll select Visual Studio as our build template, but you can see there are other templates for use, such as Xamarin for Android or iOS and the Universal Windows Platform. The default settings for your build definition should be correct for the most part, but you will need to check the Continuous Integration checkbox. Here is what they look like for this example:

Because this is a simple example and we don’t need the additional flexibility the Default queue provides, we can leave the default Hosted option selected in the Default agent queue field. For more information on the restrictions on the Hosted pool.

 
You can see the checkbox for CI at the bottom of the dialog. This is enabled so that Visual Studio Online will execute the defined build definition for each check-in. The build definition will define whether this build code is published to an environment. Since we want to continually build and deploy to our web environment, we will check this box.

We can create the build definition from Azure Dev Ops too by following the below steps.

Navigate to Pipelines -> Builds -> Click New Pipeline

Click the Visual Designer, which will allow you to perform using GUI.

Select the Team Project, Repository, Branch and click on the continue button. For Demo purpose, I have given the name of the build definition as ALM – PowerApps and Dynamics 365-CI

In the next step, select an empty job as shown below:

After selecting an empty job, you can see the empty Agent Job and Select the Agent Pool as Hosted

Next step is we need to configure the VSTS build definition as shown in the below diagram.

1. PowerPlatform Tools Installer

Every pipeline that uses the PowerPlatform Build Tools must install them as a first step. This ensures that they are really installed on the Agent.

2. PowerPlatform Publish Customizations

As a second step, we need to publish all customizations. In this step, you only must choose your connection.

Please refer my previous blog or video to understand how we need to create the service connection for the Power Platform Build Tools.

Blog post Reference: https://d365dotblog.com/2020/06/01/alm-how-to-create-service-connection-for-the-powerapps-build-tools/

Video Reference: https://d365dotblog.com/2020/06/16/alm-power-platform-tips-tricks-create-service-connection-for-the-powerapps-build-tools-in-azure-devops-vsts/

3. PowerPlatform Export Solution

As a next step, we need to export the solution from the Power Platform source instance. We are using “Export Solution” to export the solution from the Power platform instance.

Note: Please update the solution name and solution output file in the Power Platform Export solution task

Solution Name: $(SolutionName)

Solution Output File: $(Build.ArtifactsStagingDirectory)\$(SolutionName).zip

4. PowerPlatform Unpack Solution

As a next step, we are going to unpack the solution using Power Platform Unpack solution ask as below:

Solution Input File should be the same as the output in the last step. In our case:

$(Build.ArtifactsStagingDirectory)\$(SolutionName).zip

Target Folder to Unpack Solution should be the folder where you would like to store your unpacked solution in the repo. In our case, we will have a folder in the root which has the name of the solution.

$(Build.ArtifactsStagingDirectory)\$(SolutionName)

5 – Commit solution to repo

Final step is to add the extracted solution to our repo. To do this we will add a standard “Command Line” step. There you will add the following code to “Script” field:

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

You must replace “<email>” with the email of the user you would like to use to push your changes.

6 – General Pipeline configuration

Below are the some of the general configurations you need to enable in this pipeline.

For the agent, we need to allow scripts to use the OAuth token. If this is not configured our command-line script will not be able to connect to the repo and push our solution. The configuration should look like this

In our PowerPlatform Export Solution steps, we have used a variable called “SolutionName”.  We need to make sure we are updating the solution name before running the VSTS Build pipeline. Now you can test the pipeline by running it. This can either be done via the “Queue” text if you are still in the edit mode or by using the “Run pipeline” button.

In my next blog, we will see how to pack the solution and deploy it in the Target instance using Power Platform Build Tools.

If you are interested in this topic and would like to do some further self-study, I encourage you to check out my blog on this.

ALM – Power Platform – Tips & Tricks – Create Service Connection for the PowerApps Build Tools in Azure DevOps/VSTS

Here is my next video on “Tips & Tricks in ALM with PowerApps Build Tools”.

Please do subscribe my channel.

In this video, I have explained how to Create Service Connection for the PowerApps Build Tools in Azure DevOps/VSTS.

Here is the link for my course on Power Platform – ALM Fundamentals https://powerspark.newzenler.com/

ALM – Power Platform – Copy Azure DevOps Build/Release to New Project

Here is my next video on “Tips & Tricks in ALM with PowerApps Build Tools”.

Please do subscribe my channel.

In this video, I have explained how to Copy Azure DevOps Build/Release Pipeline to New Project.

Here is the link for my course on Power Platform – ALM Fundamentals https://powerspark.newzenler.com/

ALM- How to create Service Connection for the PowerApps Build Tools

In this blog, we will see how to create the service connection for PowerApps Build Tools.

Pre-requisite: Azure DevOps

The service endpoint for the source and the target environment that you want to export and import the solution to. For example, https://powerappsbuildtools.crm.dynamics.com. Service endpoints can be defined under Service Connections -> Generic Service Connection in Project Settings.

Navigate to Project Settings -> Service connections -> Click on New service connection.

Select Generic in Service connection

Provide the below details for the generic service connection as follows:

  • Username – Username for connecting to the endpoint
  • Server URL – example. https://powerappsbuildtools.crm.dynamics.com
  • Password – Password/Token Key for connecting to the endpoint
  • Service connection name  – Give the service connection as meaningful name.
  • Description (optional)
  • Security – Grant access permission to all pipelines – Enable

NOTE: MFA is not yet available. May be in the upcoming release Microsoft will add MFA to the service connection.

Once the above step is done, you will see your service connection in the list. You could add multiple other connections to various other environments.

Once the connection is established, you will be able to see this service connection in the PowerApps Build tools task like exporting and importing the solution as follows:

I hope this helps. If you have any challenges in creating “service connection”then please feel free to reach me out to me I am also always happy to assist you on your queries.

If you are interested in this topic and would like to do some further self-study, I encourage you to check out my blog on this.

PCF Control- Video Attachment Control

In this blog, we will see how we can upload the video attachments into D365 using the Video Attachment Control – PCF Control.

The VideoAttachmentControl is used to upload any kind of video file which is of mp4 format as of now. It also lets you have a live preview of the video file uploaded and the files are stored in D365 as notes (Annotation).

Scenario – Once the field technician completes his work in the field, he can capture and upload the completed work as video. Without visiting the site inspector can play the video and review it.

Here is the reference link for the solution files and the source code.

Solution –https://github.com/DharanidharanBalasubramaniam/Video-Attachment-Control/tree/master/Solution

Source Code – https://github.com/DharanidharanBalasubramaniam/Video-Attachment-Control

How to configure:

  1. Import the solution “Solution_managed.zip” into your D365 instance.
  2. If you wanted to add “Video Uploader” to Case, open the Case entity’s, Main form in edit mode.
  3. Create a new field or choose any field which is of type Single Line of Text. For demo, I have created a new field called, description and I will be using this field.
  4. Open the field and click on the “Controls” link.

. Click on “Add Control”, select “Video Uploader”.

6. Check Web, Phone and Tablet radio buttons to get it loaded in all the three devices.

Once the above step is done then you can save and publish the case form. Now, you will be able to see the Video attachment control in your case form as below:

I hope this helps. If you have any challenges in adding “Video Uploader” then please feel free to reach me out to me I am also always happy to assist you on your queries.

If you are interested in this topic and would like to do some further self-study I encourage you to check out my blog on this.