Automate Solution Deployment using DevOps CI CD Pipeline in Dynamics 365 & Power Platform

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone welcome to another video in this video we will discuss how we can automate solution deployment in Power Platform from one environment to another environment using devops continuous integration and continuous deployment uh process right so we just want to automate the deployment that's it right normally your developers can export the solution Import in Target environment right and deposit checking the code in the repository by unpicking and packing things right so how to automate that process in devops and devops CI CD using Power Platform solution we will see this is the most important topic in every project we are using so we will complete in two steps three steps one is some configuration required for Azure portal some configuration required in Power Platform admin Center and rest of the configuration we will do in Azure devops so in Azure portal first we need to create an Azure app and once you create the Azure app you have to provide all necessary uh permissions API permissions and you have to note the client ID tenant ID and secrets so let us complete that so let me go to the Azure portal do you need to create an Azure app how to create an Azure app you have to go to Azure directory and create a application using App registration area click on app registration another app registration click on new registration I want to create a new app let's say I want to give a name let's say CI CD automatic foreign okay now here I want to give the access and click on OK once you click on OK you will find there is a application ID just copy this application ID and note it app ID this is important right and you have to record the tenant ID also here you note down the tenant ID it is a required then once it is done you have to go to the API permission and add necessary permissions so click on ADD permission first you need to add the azure devops permission and use the impersonation and click on delegated permission and click on ADD permission this is the first Azure devops access then you need to add the another permission that is called as Dynamic CRM you can also keep delegated permission here next there is a runtime power button runtime you just scroll down to see that yeah this one powerapps runtime services so you can click this and user impersonation common data service add permission right so all the permission we have added now go to client Secret and in the client secret you have to add a new client secret give a name here let's say CI CD uh Secret and here you provide the expired date it is for six months and you copy the secret and store it here foreign okay now done so app registration is done we have noted all the client ID client secrets and tenant ID and next is you have to record The Source environment URL and Target environment URL but let us Focus this step by step right so we have done all of this right first step is done in Azure portal so you can close this Azure portal but provided before closing you have to record all this information because these are required next step is in Power Platform admin Center we need to do something in Source environment we have to create a solution and add some components okay so let us so go to the source environment I have multiple environment environments here I want to use future Focus default environment as a source environment and future Dev as a Target environment so I will go to the default environment and create a new solution this is how we develop first create Solutions click on new solution and give a name here let's say first demo uh devops then cicd okay and choose a publisher default publisher you can take and click on create okay now once you create the solution you can add components okay let me add a new component College table I can add any component of my choice right let's say I want to create a new table let's say the new table is uh client feedback okay so this is just a table I have created in my solution and I want to create a app for this so in here I want to add a column just some random information so here I want to create a column called as customer email data type I want to use email save it foreign with multi-line text so I have created my entity and created some columns and I want to use use this table in in my app new app I want to create a new app called as canvas app I'll give a name here let's say client feedback app and I can use phone type or tablet whatever you want to use so I have two components one is table component and another is canvasive component right so here I want to display just a gallery to connect so this is a vertical gallery and I want to connect to the table called as client feedback which will display the email ID and click on edit field which will display the email and comment so there is no data right now so that's why it is blank but here I want to display the I want to add another control here on Ctrl to display so this is the form which will act as a new feedback creation form right so here I want to connect to the same data switch screen back and I want to edit the fields to display which pulls I want to display and to display the name of the 50 pack record then email of the customer and then comment right now all the fields are added and I want to use a column one column okay and here I can take a button to submit just a sample app okay now I can test this if you want to also upload images also you can upload image let's say I want to upload an image quickly click on edit field and add image I think the image field is not there we have not added an image tool that's fine so just continue this and in the gallery we just change the layout as title and subtitle we do not need any uh we do not need any image now in the submit button you will write down some Power FX submit form and form one and then on on success write down the message notify [Music] feedback recorded okay so this is just a sample uh notification now let us check this how it works now before that you change the forms display mode as uh [Music] new so that it will create a new form so let us add session J feedback on left email spp Android gmail.com it's a nice product click on submit once you submit it will add the item to the gallery right so it will keep adding the items but when you submit the foreign [Music] go on feedback red gmail.com nice one and submit now as soon as you keep adding the records using the form it will keep adding or displaying the records in the gallery okay that's what we designed is a simple app okay now our app is done now in in our solution you just you need to save and publish just click on publish so that it will publish the latest version of the app and our solution is done so we have a table and we have a app which will be connected to the table to create records and display data in list item now let us deploy this solution to a Target enhance so first step is done in the second uh configuration Source environment we have created the solution and added components next is create app user and SN security so in Power Platform admination Center you have to create a apps app user with a proper security rule right so let us do that so let me go back so this is our solution and but you have to add a app user so go to admin Center or you can directly navigate to The Power Platform admin Center using this power button center link directly then here you have to go to environments in the environments you have to select the source environment first this is my source environment future Focus default and here you have to click on users all users just trying to load the environment data sometimes if it is taking time you can just reload this or you can directly click the more button to navigate to the corresponding settings so click on settings and here you can click on the users so if you click on users click on application users and here you need to add a new app user click on new app user and click on add an app and search your app this is the app we have created in the Azure portal right cicd automate deployment app click on ADD here you need to select a business unit and SN is equal tool for your business unit let's say I want to assign system administrator now let's keep higher privilege because this will this user will be used for deployment purposes so one app user is created in Source environment next create a app user in Target environment right so go to the Target environment click on it this is Source environment I have done so this is my target environment future day and here you need to so do not need to click that you just click the settings directly future depth and settings [Music] then you can search users here application users and add new user select an app select the same save portal user app and here give a business unit list this is my root business unit of the target environment and secret tool I want to give system admin so this app user has now access to both environment for deployment purposes now our step is done so we have created a solution created app user with security and in Target environment also we have done this same thing now we'll navigate to the Azure devops to start with devops project configuration right so go to the azure devops you can close this but before that you need to record The Source environment URL and Target environment URL okay so let me click on environments so this is the source environment you can click on details view now you can copy this this is my source environment so copy this copy link address and store here Source this is the URL like that you have to go to Target environment and click on details view to copy the URL this informations are required for deployment okay now it is done Power Platform uh configurations are done now let's go let's go to schedule devops now what I will do I'll go to Dev dot azure.com which is nothing but the devops here you can login using your credential and you need to create a project first so let us create a new project and to give a project name let's say automate cict power app solution so this is my project name and I want to keep some description here and make it private and click on create you can use the git repository git or person control git or team production server our web type you can check one of the model let's use basic model click on create so I have created a new private project in my devops once the private project is created you need to create service connections okay inside your project so this is our project in this project you have to go to Project setting and create service connections so click on the service connection and create two service connections pointing to the source and Target click on new service connection and search your platform now when you search Power Platform it will display a Power Platform option here in the service connection option but this will not display until unless you install Power Platform build tools so how to install this go to here our platform build tools so this is a Microsoft product Microsoft Power Platform build tools which will help you for digital drivers so here you can go to the marketplace okay you can click on this Azure Marketplace and you have to get it free once you click on Get It Free it will try to install in your uh Azure devops organization and if you have already installed it will ask you that it is already installed otherwise it will install in your organization now you see it is loading the organizations that you have already created I have created one organization so it is created this and this is this is this extension is already installed so I do not need to install again but if you have not installed it will display option to install it once it is installed you can again go back to your devops project and if you search here you will find Power Platform option here so choose this in the service connection and click next here you use application ID and client secret Define the server connection server URL first use the source server URL and give a name here let's say Source sorry give the URL first and you have to provide the tenant ID tenant ID is already captured here and put it here then sorry this is application ID tenant ID you have to copy sorry uh application that is this one so you have to properly configure the IDS the 10 night items application sorry application means client ID then client secret client secret already copied here okay now you can give a name let's say source source connection okay and click on this grant access permission to all pipeline next you have to create a new service connection for Target connection so our second power platform [Music] and click on next and give the target service URL or environment URL and same tenant ID [Music] then application ID [Music] okay then the client secret same setup Secrets the net ID and ID will be used because same app is having both access now here I can use Target connection and give the grant access permission to all Pipelines now connection is done what is the next step just follow step by step it will help you now initialize the repository so you have to store our project details or solution details in a repository so go to the repositories in here click on files and initialize the repository here for git git storage so it will create a main branch and store your project so click on initialize okay now the project is initialized so once it is initialized you have to give the permission for repository as a contribute access so go to your uh Repository in the project setting in the Repository you will find a security tab in the secret tab you will find if you scroll down you'll find the view chart this is the current user which is used for automation now click on this and here in the contribute access click on allow okay this security is required to okay now once the security has been given as allow permission you have to add platform beat tools dot Power Platform beat build tools should be actually used before the service connection so you can take this step before the service connection [Music] right otherwise you cannot find that Power Platform option now once the project setting is security is done you have to install self-hosted for power for parallel pipeline normally when you run a pipeline Microsoft host is automatically used but for Microsoft issue host uh you have to apply for that okay Microsoft has to allow so that you can use the pipeline but for this case I don't want to use Microsoft host I have to install my own self host agent for my parallel pipeline so I have already created a video here in my channel uh first do this self-hosted agent pipeline installation it is very easy to install it will take just five minutes once it is done you can again come back here and your this step is done okay next add app store app to Source control let us create the pipeline first okay so that we can use the uh deployment steps I'll go to the settings and in the settings we'll go to the five times so let us start with a pipeline creation click on new pipeline and the new pipeline choose use classic editor here I can choose Azure repository git because our project is in git and in the team project select the project that you have created this is the project we are going to automate repository is selected already and default branch is Main Branch if you want to create multiple branches also you can create first then select it and click on continue once you continue you can find a amplitude of your click on empty job and in here in this empty job you can start using the task you can define a name here let's say uh or apps agent okay just a name here I am giving now once it is done what you need to do you need to add task so as per the pipeline steps we need to keep adding steps like uh a Power Platform tool installer and all the options like export import all solutions we have to follow so first whenever you create a python just create a variable to store our solution name go to variable and create a variable to keep our solution name foreign name I want to keep the value is the solution name we have created which solution we have created this one this is the solution name right so you can click this and copy the solution name from overview now this is the solution name you can copy this copy the name option not display name okay and here I can put this so this is my solution name so remember I will use the solution name I can take help of this variable so that the value will be picked up I can go to the task and keep adding task the first task I want to add is click on ADD and search here Power Platform build tool installer so when you install Powerpuff bin Power Platform beat build tools it will display all this list you can use in your project so first is a Power Platform tool installer click on ADD this job will install the Power Platform build tools necessary for your agent next click on ADD I want to add another uh another task once the task is installed tool is installed installer installed I want to add you can scroll down export solution I want to export the current environment solution first okay so export this use export just search export you can see here export solution Power Platform export solution click on ADD so in Power Platform export solution you need to Define some information here principle in the service connection Choose The Source service connection you have created source connection okay because source connection will be used for exporting solution an environment URL is build tools dot environment URL this is the default environment URL that is already used for uh default environments a default variable so you do not need to change this and solution name you can consider the solution name using the variable we have declared this is the variable name we have declared right solution name so you have to call the variable name using dollar symbol Dollar in bracket the variable name what is the solution output file you can use the solution output file uh using the default directory of the build this one okay let me copy this so what I have used here I am using build.staging directory this is an inbuilt default directory created by the devops for your project and that directory slash solution name underscore unmanaged dot cheap so this will be the uh solution name or solution that will be created in the output file so this will be my exported file okay if you want to expose export as a managed you just click this export managed but I want to export as on managed solution okay you can give the target person also if you want to give otherwise keep blank okay now once the export solution is done what I want to do the next step is you want to unpack the solution because first thing is we have to unpack export the solution and unpack the solution so that all the components of the solution will be extracted for our source control so add it add another step here on pack so click on unpack Power Platform on pick solution click on ADD then the on pick solution step also you need to define the solution input file what is the solution input file the solution input file will be the same file that we have used so you can use this one same build dot shading directory solution name dot underscore unmanage.zip this is the solution output file from the previous export step what is the target folder to unpick use a Target folder let's say I have to create a tagged folder in the BL dot Source directory this build.source directory is an existing directory created by Microsoft by default for your project so inside this directory I want to create a solution name folder and inside that I want to create a folder called as unmanaged which will store the unpacked version of your solution what is the type of solution the type of solution I want to use on managed you can use both you can use manage to whatever you necessary requirement okay and if you want to use all components separately you can use all components separately okay and the unpack is done once it is unpacked I want to publish the repository right so publish artifact is another step that you need to add so artifact so you can click on this publish artifact pipeline no there is another step let me just remove this you just search Pub publish artifact publish build artifact right so click on this and in the publish artifact dropped you have to use the path to publish where I want to uh which path I want to publish here you have to choose the path the path is build Source directory solution name on managed right so build so this is not the actual path so you just click on this and here you can search okay it's not created click on this uh directory first and you can directly copy the solution you can directly copy the value so no need to choose from the option here so this is the folder that it needs to be published in the artifact now it is done so we have published the artifact and what is the next step once the publish that effect is for artifact means the components of the solution which are unpacked once it is published you can Define some command line to Define some commit commit to the git right so add a command line uh add a command line step or task then the command line task you need to put some script so in the command line strip you have to put this script Eco commit all changes then Z config user email Z config username then git checkout main branch git add all components GID comments on you know text message here then gitc HTTP extra header authorization Bearer system access token variable and post origin man this script will run by git command executor but to run this you have to go to the agent and enable a flag called as allow scripting allow scripts to access the oauth token you have to enable this otherwise your uh command line will not execute now once it is done all this step done you can click on you can click on save and run right what you want to do let's say you want to change the name let's say agent uh devops I want to give a name and save and queue so let us see how it is executing all the tasks so give a comment first core commit and choose Azure pipeline or default pipeline custom self-hosted click on save and run once you click on save and run the powerapps agent devops will run and start executing one by one task that we have assigned for the pipeline that will try to install the tool Power Platform tool then Power Platform export solution step it will execute accordingly it will take some couple of seconds and execute all the steps or tasks that we have done so this is one part of continuous integration we have done right now next is continuous deploy deployment which requires to create religious from this build so let us wait once it is completed successfully we will verify if everything runs successfully or not now artifact is also done common line script is done then post job completion step is done now now the agent completed all its tasks successfully if you go to the repository you will see the project information created here this is our first demo devops CI CD solution the insert solution a folder called as unmanaged and in the unmanaged the unpacked version of the solution the canvas app The Entity is right this is the unpacked solution components that are available that you need this is already checked in in our git Repository right so we have done successfully but we have not imported it we have just exported and created the artifact and published the artifact in our Repository the next important thing is we will create the release out of this so to create the relays out of the out of this we have to go to the Repository and sorry you have to go to the pipeline so this is the pipeline okay and you have to go to religious and create a new pipeline the next stage is to create a release from the build now here you will see it it is telling that here you will find the artifact and the stage so we have to connect the artifact first click on the artifact the artifact is available in our Azure Repository choose the project the project is this one automate cicd power up solution and the source is available here so this is the source which contains the uh solution repository you can choose the dipole Branch triple branches main branch and the default version is latest from the default Branch it will automatically pick up okay and click on ADD once you click on add the artifact will be added here next is you have to add a release stage so click on new stage I want to add empty job again the same way we have to do that okay now this is the stage owner okay and click on this stage job here I want to add the jobs to this task to this job you can rename this let's say release one two okay to production and you can add jobs now the first job is this is the stage let's say stage uh first stage specialist is and you can add tasks the first tag is to add for our release the first stack is first task is to we have already added the artifact now create some variable to store the solution name and to create a variable to store the solution name so go to the variable and create a variable College solution name and put the solution name what is the solution name you can go to the source environment and copy the solution name so go to Solutions and this is the solution that I want to deploy right so go to overview and copy the name and store it here now in the task add the first task the first task is I want to click use Power Platform tool installer same as build that effect right in the first stage we have done that so click on this tool installer Power Platform tool installer then I want to export the solution but before export I want to take the solution which is unpacked in the previous uh step so use this time pack solution so click on this Power Platform back solution unpick we have done now I want to pick it the big solution I want to use the source folder for solution pick I have already created a source folder for the solution now I can copy this we have already defined this or you can copy from the uh you can use from the browse option okay here you will find this is the project build and on managed so this folder I want to use to pack but if you want to change the solution name here you can change the solution name right let's say I want to change the solution name with a variable that we have directed so I can use it here solution name right what is the output file you can decide output file build staging directory then solution name dot chip so this will Create Your solution with this directory and you can depend whether it is unmanaged or managed right then you can go down then import solution now the solution picked and created this on managed pack right next is it will import so add another another action import solution now import solution will ask you to use service principle [Music] and choose the target connection because in the Target environment you want to import it next the environment URL is copied automatically and here you need to use the solution input file where is your solution input file this is your solution input file which is already created the same way you have picked the same path right now it is done now you need to publish the customization add another step publish customization scroll down you will see that publish customization and here you need to use the service connection using service principle option under Target connection because Target connection user will use to publish the customization right now we have done everything successfully now let us create a release save this release created [Music] now you can create a release from this pipeline so click on this create release option okay now you can click on create release Here you can provide some uh option here this is the release stage I want to execute this is that effect connected and description let's say first release okay now click on create now it will try to create a release okay and now you want to deploy this release right in production so just click on the deploy and click on the deployment lower deploy option this is the deploy step or release click on deploy once you click on it will queued and work on in progress mode which will try to release the artifact to the production server or the target server it will take some time so this is how you can automate right just clicking two three buttons everything works fine just configured in internally all the scripts and Power Platform build tools to manage now the religion progress so let us see how it works so five or six task is completed now once all six taxes completed the production is ready and we can recheck the solution that is inputted or not in Target production a Target server you can check also the status it is running Diplomat is in progress yeah it is manually triggered okay you can check the log files here also okay what are the steps already completed and now it is importing the solution and once the import is Success it will publish the solution and all jobs are completed right [Music] so I'm putting text time you have to get because you normally do not need to wait because these are you know jobs agents right they will do their job in background and import the solution from Source environment to Target according to that time span assign now import solution is done it is trying to publish the solution in Target environment now once this step is done the release is completed for production you can create one more release for uat you can create more religious per other servers also or other environments depending on your business requirement [Music] foreign in progress and once it is completed the release will be success and here also you can see the task that is executing currently right if it is currently executing some task it will display here in this card that is telling that for two minutes it is running the release so you know how fast it is within two minutes your release from Sports environment to Target and environment is completed successfully with devops for the initial configuration that you have done all these things you need to configure beforehand so that you can automate this deployment right okay now it is succeeded deploy to production is oxidate okay and if I'll go to the Target environment and refresh this now I can see the solution that is imported here so this is the solution that is imported and published which contains the components like the conversa and the new entity that is imported right so thanks everyone for watching this video this is how you can completely completely automate your devops using solution import export foreign see you guys bye
Info
Channel: Softchief Learn
Views: 5,906
Rating: undefined out of 5
Keywords: Dynamics, CRM, Dynamics 365, Power Apps, d365, power platform, dynamics 365 tutorials, dynamics crm training, Automate Solution Deployment using DevOps CI CD Pipeline in Dynamics 365 & Power Platform, devops power apps, solution devops, devops step by step power plaform, solution deploy devops, devops pipeline
Id: Jwio4ejPVm8
Channel Id: undefined
Length: 47min 41sec (2861 seconds)
Published: Sun Aug 06 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.