|
| 1 | +--- |
| 2 | +title: "Appendix: Add licensing information to your solution | Microsoft Docs" # Intent and product brand in a unique string of 43-59 chars including spaces |
| 3 | +description: "This article outlines the required steps to take license service IDs created in Partner Center and add them to the table definitions of your Dataverse solution." # 115-145 characters including spaces. This abstract displays in the search result. |
| 4 | +ms.custom: "" |
| 5 | +ms.date: 04/30/2021 |
| 6 | +ms.reviewer: "pehecke" |
| 7 | +ms.service: "powerapps" |
| 8 | +ms.topic: "article" |
| 9 | +author: "nkrb" |
| 10 | +ms.author: "nabuthuk" |
| 11 | +manager: "kvivek" |
| 12 | +search.audienceType: |
| 13 | + - developer |
| 14 | +search.app: |
| 15 | + - PowerApps |
| 16 | + - D365CE |
| 17 | +--- |
| 18 | + |
| 19 | +# Appendix: Add licensing information to your solution |
| 20 | + |
| 21 | +This article is related to the license management capability that Microsoft provides for ISVs to manage and enforce licenses for their products. More information: [Third-party app license management through Microsoft](https://docs.microsoft.com/azure/marketplace/third-party-license) |
| 22 | + |
| 23 | +This article outlines how to add licensing information to a Microsoft Dataverse solution, package it, and upload the solution zip file to Microsoft AppSource. More information: [Create an AppSource package for your app](/powerapps/developer/data-platform/create-package-app-appsource). |
| 24 | + |
| 25 | +The following steps are required to add license information to your solution: |
| 26 | + |
| 27 | +- Clone existing solution. |
| 28 | +- Use the Power Apps CLI tool to add license information to the solution. |
| 29 | +- Build the solution, package it, and upload the zip file to AppSource. |
| 30 | + |
| 31 | +## Download the latest version of the Power Apps CLI |
| 32 | + |
| 33 | +You can download the latest version of Power Apps CLI from [here](/powerapps/developer/data-platform/powerapps-cli). The Power Apps CLI tool includes commands that are required for adding licensing information to the solution. To verify that you have the latest version of the tool: |
| 34 | + |
| 35 | +1. Open a **Developer Command Prompt for VS 2017** or higher window. |
| 36 | +2. Enter the command `pac install latest`. This will install the latest version of the tooling. |
| 37 | +3. Enter the command `pac solution help` and verify that you see the `add-license` option in the list. |
| 38 | + |
| 39 | +## Clone a solution |
| 40 | + |
| 41 | +Use Power Apps CLI commands to clone the solution. To clone a solution: |
| 42 | + |
| 43 | +1. Create an authentication profile for the environment where you want to add your solution by using the command: |
| 44 | + |
| 45 | + ```CLI |
| 46 | + pac auth create --name <name of your choice> --kind Dataverse -–url <your dataverse url> --username <your username> --password <your password>` |
| 47 | + ``` |
| 48 | +1. Clone the existing solution by using the command: |
| 49 | + |
| 50 | + ```CLI |
| 51 | + pac solution clone --name <your solution name> --outputDirectory <your chosen output directory> |
| 52 | + ``` |
| 53 | +
|
| 54 | +## Create licensing files |
| 55 | +
|
| 56 | +To add licensing information to your solution, you need to create two `.CSV` files using the text editor of your choice. The following are the two files that you need to create: |
| 57 | + |
| 58 | +- **Plan definition file**: Define the details of the plans you created in the Partner Center. |
| 59 | +- **Plan mapping file**: Maps those plans to the components of your solution. |
| 60 | + |
| 61 | +In this article, we will create these two CSV files for an example solution called F365. This solution contains several model-driven apps for which we want to restrict access to via license management. We will follow a **Russian doll** licensing model for this solution as shown in the following table: |
| 62 | +
|
| 63 | +|Plan|Gets access to| |
| 64 | +|------|--------| |
| 65 | +|Gold plan|Gold App, Silver App, Bronze App| |
| 66 | +|Silver plan|Silver App, Bronze App| |
| 67 | +|Bronze plan|Bronze App| |
| 68 | +||| |
| 69 | +
|
| 70 | +> [!div class="mx-imgBorder"] |
| 71 | +>  |
| 72 | +
|
| 73 | +To add licensing information to your solution, you need to create plans in the Partner Center. More information: [Create plans in Partner Center](/azure/marketplace/dynamics-365-customer-engage-plans). Once you're finished creating the plans, each plan creates a **Service ID** value which is required while creating [Plan definition file](#plan-definition-file). |
| 74 | +
|
| 75 | +> [!div class="mx-imgBorder"] |
| 76 | +>  |
| 77 | +
|
| 78 | +> [!NOTE] |
| 79 | +> Currently model-driven apps are the only types of solution components that can be mapped to licenses. In future releases, we plan to add support for other component types such as canvas apps and tables. |
| 80 | +
|
| 81 | +### Plan definition file |
| 82 | + |
| 83 | +The plan definition file must include the following columns laid out in the format shown in the example below: |
| 84 | +
|
| 85 | +> [!div class="mx-imgBorder"] |
| 86 | +>  |
| 87 | +
|
| 88 | +**Service ID:** This is created automatically when you create a plan in the Partner Center as part of the offer creation. Copy it from partner center into the plan definition file. More information: [Create plans in Partner Center](/azure/marketplace/dynamics-365-customer-engage-plans). |
| 89 | +
|
| 90 | +**Display Name:** This is a descriptive name for your plan which you can choose. It will be show to users on license check error screens so it should be easily recognizable to your customers. |
| 91 | +
|
| 92 | +**More info URL:** This is a URL where you would like to direct users to get more information about your solution, in the event they run into a license check error. |
| 93 | +
|
| 94 | +
|
| 95 | +### Plan mapping file |
| 96 | + |
| 97 | +The plan mapping file must include the following columns laid out in the format shown in the example below: |
| 98 | +
|
| 99 | +> [!div class="mx-imgBorder"] |
| 100 | +>  |
| 101 | +
|
| 102 | +**Service ID:** This is created automatically when you create a plan in the Partner Center as part of the offer creation. Copy it from partner center into the plan definition file. More information: [Create plans in Partner Center](/azure/marketplace/dynamics-365-customer-engage-plans). |
| 103 | +
|
| 104 | +**Component name:** The solution component that you would like to restrict access to using license management. This name must match the name of the component in the **Name** column in the Power Apps solution viewer (image above). |
| 105 | +
|
| 106 | +
|
| 107 | +
|
| 108 | +Once you have created your own licensing CSV files, the next step is to add the information from these files to your solution. |
| 109 | +
|
| 110 | +## Add licensing information |
| 111 | +
|
| 112 | +To add the license information from the CSV files (created above) to the solution: |
| 113 | + |
| 114 | +1. Open a **Developer Command Prompt for VS 2017** or higher window. Navigate to the ___location where you have cloned solution. Enter the following command: |
| 115 | +
|
| 116 | + ```CLI |
| 117 | + pac solution add-license -pd <path to plan definition file> -pm <path to plan mapping file> |
| 118 | + ``` |
| 119 | +1. To check whether the licensing information is added, navigate to the ___location where you have cloned your solution zip file, you should see a new folder **ServicePlans** is created with two XML files. |
| 120 | +1. Optional: To determine how the license information from the CSV files was captured, open the XML files in your favorite editor. |
| 121 | + - The **ServicePlans.xml** file contains the plan definition information from the plan definition file. |
| 122 | + - The **ServicePlansAppModules.xml** file contains the plan mapping information from the plan mapping file. |
| 123 | + |
| 124 | +## Build the solution and create an AppSource package |
| 125 | + |
| 126 | +1. To build a solution, see [Create a managed solution for your app](/powerapps/developer/data-platform/create-solution-app-appsource). |
| 127 | + |
| 128 | +1. To validate whether the licensing information is included, after the solution is built, look for the licensing information in your solution `customizations.xml` file. |
| 129 | +1. To create the AppSource package, see [Create an AppSource package for your app](/powerapps/developer/data-platform/create-package-app-appsource). |
| 130 | + |
| 131 | +## See also |
| 132 | + |
| 133 | +[Appendix: App certification checklist](appendix-app-certification-checklist.md) |
0 commit comments