Giter VIP home page Giter VIP logo

power-platform-alm-starter-kit's Introduction

Power Platform ALM Starter Kit

The goal of this project is to provide to the Power Platform community a kit that will help people start their DevOps journey with the Power Plaform. The content of this repository is mainly for advanced makers with experience with ALM concepts and programming skills. We will try to make this starter kit useful for you.

What does the Power Platform ALM Starter Kit currently covers?

  • Create a Power Platform environment and the corresponding Power Platform service connection in Azure DevOps using a pipeline you can trigger manually
  • Create a Power Platform Power Platform service connection associated to an existing environment using a pipeline you can trigger manually
  • Delete a Power Platform environment and the corresponding Power Platform service connection in Azure DevOps using a pipeline you can trigger manually
  • Delete a Power Platform Power Platform service connection associated to an existing environment using a pipeline you can trigger manually

What can you find in the Power Platform ALM Starter Kit?

Power-Platform-ALM-Starter-Kit
│   README.md
│   LICENSE
|   CODE_OF_CONDUCT.md
└───Pipelines
└───└───Templates
│   │   │   create-powerplatform-environment-template.yml: Pipeline template for the creation of a Dataverse environment
│   │   │   create-powerplatform-service-endpoint-template.yml: Pipeline template for the creation of a Power Platform service connection in Azure DevOps
│   │   │   delete-powerplatform-service-endpoint-template.yml: Pipeline template for the deletion of a Power Platform service connection in Azure DevOps
│   │   │   generate-powerplatform-environment-domainname-template.yml: Pipeline template for the generation of a Power Platform environment DomainName based on the EnvironmentName provided
│   │   │   generate-powerplatform-environment-url-template.yml: Pipeline template for the generation of the URL of a Power Platform environment based on the EnvironmentName provided
│   │   │
└───└───Utils
│   │   │   create-powerplatform-environment-and-service-endpoint.yml: Pipeline used to create of a Dataverse environment if it does not exist (search based on the name provided) and generate the associated Power Platform service connection in Azure DevOps
│   │   │   delete-powerplatform-environment-and-service-endpoint.yml: Pipeline used to delete a Dataverse environment and delete the associated Power Platform service connection in Azure DevOps
│   │   │   delete-powerplatform-service-endpoint.yml: Pipeline used to delete a Power Platform service connection in Azure DevOps
│   │   │   powerplatform-service-connection-test.yml: Pipeline used to test a Power Platform service connection with its name provided
│   │   │  
└───Configuration
│   │   powerplatform-spn-template.json: Body request template for the creation of a Power Platform service connection in Azure DevOps
│   │   DataverseEnvironmentConfiguration.txt: Template for the configuration of the Dataverse environment to create
└───Scripts
└───└───Tests
│   │   │   New-DataverseEnvironment.Tests.ps1: Test script of the New-DataverseEnvironment PowerShell function
│   │   New-DataverseEnvironment.ps1: PowerShell function for the creation of a Dataverse environment if it does not exist (search based on the name provided)

How to set-up the Power Platform ALM Starter Kit?

Prerequisites

To use this starter kit, you will need to have the following components already available:

  • an Azure DevOps organization
  • an Azure DevOps project with a repository
  • the Power Platform Build Tools extension installed in your Azure DevOps organization
  • a PAT (Personal access token) created for the considered Azure DevOps organization with Full access (at the moment, we are not able to clearly identify the access needed to enable a service connection for all pipelines)
  • Add the following permissions to your project Build Service user account in your repository settings (Project Settings > Repositories > Security tab > "YourProjectName Build Service [...]" > Permission > Allow)
    • Contribute
    • Create tag
    • Read
    • Bypass policies when pushing - if you want to create your Dataverse environments from a branch with policies (⚠ not recommended)

Note: In a multi-tenant scenario, you will need to follow the steps below related to the Azure AD app registration for each considered tenant where you want to manage Dataverse environments.

  • an app registration registered in Azure Active Directory with (at least):
    • the following permissions with admin consent granted: Dynamics CRM.user_impersonation
    • a client secret generated and stored somewhere safe
    • the correct account type selected (single tenant or multitenant) depending on your scenario
  • run the New-PowerAppManagementApp PowerShell command of the Microsoft.PowerApps.Administration.PowerShell specifying the Application (client) ID of the app registration you registered previously in Azure AD
> Add-PowerAppsAccount
> New-PowerAppManagementApp -ApplicationId 00000000-0000-0000-0000-000000000000
  • an application user created on one of your existing Dataverse environments (for example a Production Dataverse environment you already have) with the System Administrator security role using the Application (client) ID of the app registration you registered previously in Azure AD
  • a Power Platform service connection created in the considered Azure DevOps project associated to the Dataverse environment we talked about in the previous step using the information (Application (client) ID, Directory (tenant) ID and Client Secret) of the app registration you registered previously in Azure AD

Step-by-step guide

  1. Copy the Pipelines, Configuration and Scripts folders of this repository
  2. Paste it at the root of the repository in the Azure DevOps project you want to use
  3. Update the DataverseEnvironmentConfiguration.txt configuration file in the Configuration folder with the configuration you want for your environments (you can use the content of the Resources section of this page to help you complete this step)
  4. Create pipelines from all YAML pipeline definitions in the Pipelines/Utils folder (Pipelines > New pipeline > Azure Repos Git (YAML) > "NameOfRepositoryWithPipelineDefinitions" > Existing Azure Pipelines YAML File > "BranchWithPipelineDefinitions" > /Pipelines/Utils/...)
  5. Create a variable group in your Azure DevOps project with the following name and with the variables below: power-platform-environment-management-variable-group
    • ApplicationId (secret type variable recommended): Application (client) ID of your app registration in Azure Active Directory
    • AzureDevOpsOrganizationURL: URL of the Azure DevOps organization you are working in (ex: https://dev.azure.com/demonstration/)
    • ClientSecret (⚠ secret type variable strongly recommended): Client secret of your app registration in Azure Active Directory
    • DataverseEnvironmentConfigurationFileName: Full name (with extension) of the file you want to use for the configuration of the Dataverse environments to create (ex: DataverseEnvironmentConfiguration.txt)
    • PatToken (⚠ secret type variable strongly recommended): Value of the PAT (Personal access token) we talked about in the Prerequisites section above
    • PowerPlatformEnvironmentURLBase: Base of the URL (linked to the location) you want to consider for your Dataverse environments to create (ex: crm12.dynamics.com)
    • TenantId (secret type variable recommended): ID of your app registration in Azure Active Directory
  6. Test the pipelines

Resources

You can use the commands below from the Microsoft.PowerApps.Administration.PowerShell PowerShell module to find the information for configuration file for the creation of the Dataverse environments:

For the PowerPlatformEnvironmentURLBase variable in the power-platform-environment-management-variable-group variable group, you can find the available values in the Datacenter regions Microsoft documentation page.

Contributing to the Power Platform ALM Starter Kit project

  1. Fork this repository.
  2. Create a branch: git checkout -b <branch_name>.
  3. Make your changes and commit them: git commit -m '<commit_message>'
  4. Push to the original branch: git push origin <project_name>/<location>
  5. Create a pull request targeting the main branch of this repository

Alternatively see the GitHub documentation on creating a pull request.

Contributors

Thanks to the following people who have contributed to this project:


Benedikt Bergmann

📖

Raphael Pothin

📖

Contact

If needed, you can contact us on twitter:

License

This project is licensed under the MIT license.

power-platform-alm-starter-kit's People

Contributors

benediktbergmann avatar pjlindsay avatar rpothin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

shkouk pjlindsay

power-platform-alm-starter-kit's Issues

[IDEA] Add a tag for the merge of the first milestone

Is your feature request related to a problem? Please describe.
We don't have an easy way to find the merge of the first milestone.

Describe the solution you'd like
Add a tag v0.1 to the following commit 5715d26.

Describe alternatives you've considered
Create a GitHub release, but I don't think it is the good choice because we don't really have artifacts to share.

Additional context
Not applicable.

[IDEA] Create a Power Platform Azure DevOps project template

Based on the idea presented with the Scaffolding example in the GitHub azure-devops-cli-extension project, it could be interesting to initiate a Power Platform Azure DevOps project template.

In a first version I imagine having the things below:

  • creation of a new project in a targeted Azure DevOps organization
  • creation of the repository
  • import basic YAML files for the management of the ALM of Power Platform solutions from a public repository (this one?)
  • create the pipelines based on the YAML files imported
  • generate Power Platform service connections for existing Power Platform environments based on a configuration file to update

[IDEA] Advanced ALM

The ALM Starter Kit could describe possible additions to a basic ALM process to make it more advanced.

Those could for example be

  • automated Tests
    -- Unit
    -- Integration
    -- UI
  • Checks against the Solution Checker

[IDEA] Automate Azure AD App Registration for the creation of a Power Platform Service Connection

For the creation of a Power Platform Service Connection in Azure DevOps, we need the following information from an Azure AD App Registration:

  • Tenant ID
  • Application ID
  • Client Secret

To completely automate the provisioning of a Power Platform environment and the creation of the associated Power Platform Service Connection in Azure DevOps, we need to be able to automatically generate a new App Registration.

[IDEA] YAML Files

The PP ALM Starter Kit should include YAML files to make it easier for users to create a basic ALM process with Azure DevOps pipelines

[IDEA] Automate the installation of several languages for a Power Platform environment

Automate the provisioning of a Power Platform environment is one thing, but by default (with the Create Environment action in the Power Platform Build Tools extension for Azure DevOps) you can only specify one language.

It seems that the following solution (information provided by our friend David Rivard) could help us go further on this part:
https://github.com/seanmcne/Microsoft.Xrm.Data.PowerShell

Function to try: 'Enable-CrmLanguagePack'

----EXAMPLE POWERSHELL SCRIPT---------
Param(
[string]$connectionstring
)

Write-Output "Installing Microsoft.Xrm.Data.PowerShell"
Install-Module -Name Microsoft.Xrm.Data.PowerShell -Scope CurrentUser -Force

#Write-Output "Installing Microsoft.CrmSdk.XrmTooling.CrmConnector.PowerShell"
#Install-Package -Name Microsoft.CrmSdk.XrmTooling.CrmConnector.PowerShell -Scope CurrentUser -Force

Write-Output "Connecting to CRM"
$conn = Get-CrmConnection -Verbose -ConnectionString "$($connectionstring)"

Write-Output "Fetching organizationid"
$organizationid = (Get-CrmRecords -EntityLogicalName organization -conn $conn -Fields organizationid).CrmRecords[0].organizationid

Write-Output "Changing setting on organization: $($organizationid)"

Set-CrmRecord -EntityLogicalName organization -conn $conn -Id $organizationid -Fields @{"isautosaveenabled"= $false; "isexternalsearchindexenabled"= $true; "useskypeprotocol"=$false}

$org = Get-CrmRecord -EntityLogicalName organization -conn $conn -Id $organizationid -Fields isautosaveenabled,isexternalsearchindexenabled,useskypeprotocol

[IDEA] Automate the activation of the early access to a new major release for a Power Platform environment

In some cases you could want to automate the activation of the early access to a new major release for a Power Platform environment.

Below we have some information (gathered by our friend David Rivard) that could help us work on that issue:
Here is the request that is sent when you click on the Enable button:
https://admin.powerplatform.microsoft.com/api/environments/{GUID_OF_ENV}/features/October2020Update/enable?geo=Na
*geo=Na must standfor NorthAmerica
**I guess Each update will have there own url (ex. October2020Update, April2021Update) etc..

The tricky part would be to assess when the upgrade process is finished in order to put it in a release pipeline.

By analyzing the request sent by the admin portal I think this could be achieved.
After enabling the feature, this request is sent at regular interval
https://admin.powerplatform.microsoft.com/api/environments/{GUID_OF_ENV}/features?geo=Na

The response gives the status of the upgrade in the AppsUpgradeState property
Upgrade in progress

Upgrade finished

[IDEA] Use of a JSON template file of the Power Platform environment in the provisioning pipeline

One way to simplify the provisioning of a Power Platform environment could be to reduce the number of input variables needed for the create-powerplatform-environment-and-service-endpoint pipeline.

I think that a template file in JSON could be a good way to manage the properties of the Power Platform environment.
This template file would be then consumed by the create-powerplatform-environment-and-service-endpoint pipeline (path to the file provided as a variable).

[IDEA] App to handle deployments

The Starter Kit should include an ap to handle deployments to all the different environments. The app should trigger pipelines in Azure DevOps

[IDEA] Automate the decommissioning of a Power Platform environment from the Power Platform

Other version of the existing issue #9

When we do not need anymore a Power Platform environment integrated with an Azure DevOps project, we have few things to do:

  • delete the Power Platform environment
  • delete the Power Platform service connection in the Azure DevOps project

Another way to achieve this is by using:

  • existing Power Platform for Admins connector to delete the environment
  • a custom connector using the Azure DevOps REST API for the management of the service connections

[IDEA] Add a CHANGELOG.md

Is your feature request related to a problem? Please describe.
We don't have an easy way to follow what have been done in the different versions of the "solution" in this repository.

Describe the solution you'd like
Add a CHANGELOG.md file based on the following example: CHANGELOG.md

[BUG] Unable to run Install Power Platform Build Tools

Running export solution to git Im getting the following:

This is the task that fails:
task: microsoft-IsvExpTools.PowerPlatform-BuildTools.tool-installer.PowerPlatformToolInstaller@0
displayName: 'Install Power Platform Build Tools'

I think my ALM version is v1.183.0 (from devops-tasks-schema.json)
It is several version behind, but was working fine

Any ideas?

Starting: Install Power Platform Build Tools

Task : Power Platform Tool Installer
Description : Power Platform Tool Installer
Version : 0.0.77
Author : Microsoft
Help : More Info

Name Version Source Summary


nuget 2.8.5.208 https://onege.../ NuGet provider for the OneGet meta-package manager
##[error]The specified module 'PackageManagement' with version '1.4.7' was not loaded because no valid module file was found in any module directory.
Finishing: Install Power Platform Build Tools

[IDEA] Automate the provisioning of a Power Platform environment with creation of the service connection from the Power Platform

Other version of the existing issue #8

To be able to use a Power Platform environment in your ALM process, we need 3 things (if we want to use service principal authentication):

  • a Power Platform environment (obviously)
  • an application user on your Power Platform environment
  • a Power Platform service connection in your Azure DevOps project

Another way to achieve this is by using:

  • existing connectors of the Power Platform (ex: Power Platform for Admins for the creation of the environment)
  • a custom connector using the Azure DevOps REST API for the management of the service connections

I am still looking a good way create an application user in the new Power Platform environment, but it sure can be done using a UI Flow.

[IDEA] Missing elements in the PP Build Tools

The Documentation of the PP ALM Starter Kit should describe missing elements in the Power Platform Build Tools for Azure DevOps as well as describe workarounds.

Those are for example:

  • Applying Solution Upgrades is not possible
  • Installing additional languages to JIT environments
  • Installing early access features to JIT environments

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.