Guide to Preparing setting files for Power Platform managed solution deployment
Guide to Preparing setting files for Power Platform managed solution deployment
This guide will walk you through the process of creating a settings file for Power Platform managed solution deployment. Refer to the posts for more details to set up Application Lifecycle Management (ALM) for power platform: Power Platform ALM & Pipelines w/ Matt Devaney and Converting to Modern YAML Pipeline: Application Lifecycle Management in Azure DevOps for Power Platform for detailed steps for ALM for power platform solutions. The settings file will be created referring to an exported solution, one of several methods described in the official documentation using Power Platform CLI (pac)
Make sure you have the latest version of pac installed by executing pac install latest
first.
Export Solution
Start by exporting the solution as managed to a local location on your machine.
pac solution export --path E:\Settings\test_managed.zip --name test --managed
Run Power Platform CLI (pac)
Next, open a Command Prompt or PowerShell in the folder containing the solution zip file. We will use the Power Platform CLI (pac) to create a settings file based on the exported solution.
# connect to the power platform environment
pac auth create --environment "dev (contoso.co.uk)"
# ensure the correct environment is selected
pac auth list
# select the environment by specifying the index
pac auth select --index 1
pac solution create-settings --solution-zip ./DevToolsTest_1_0_0_1.zip --settings-file ./settings-test.json
The settings file generated will look something like this with two main sections for EnvironmentVariables and ConnectionReferences
{
"EnvironmentVariables": [
{
"SchemaName": "ppf_contosoSPSitePrefix",
"Value": "",
"DefaultValue": "Dev - ",
"Name": {
"Default": "contoso - SP Site Prefix",
"ByLcid": {
"1033": "contoso - SP Site Prefix"
}
}
},
{
"SchemaName": "ppf_contosoSPSiteUrl",
"Value": "",
"Name": {
"Default": "contoso - SP SiteUrl",
"ByLcid": {
"1033": "contoso - SP SiteUrl"
}
}
}
],
"ConnectionReferences": [
{
"LogicalName": "ppf_contoso",
"ConnectionId": "",
"ConnectorId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline"
},
{
"LogicalName": "ppf_contosoApprovals",
"ConnectionId": "",
"ConnectorId": "/providers/Microsoft.PowerApps/apis/shared_approvals"
}
]
}
Each environment variable and connection reference will need to be filled out according. A separate settings file for each target environment : test, UAT and Prod needs to be prepared.
{
"EnvironmentVariables": [
{
"SchemaName": "contoso_SPSitePrefix",
"Value": "Test - ",
"DefaultValue": "Test - ",
"Name": {
"Default": "test - SP Site Prefix",
"ByLcid": {
"1033": "test - SP Site Prefix"
}
}
},
{
"SchemaName": "contoso_SPSiteUrl",
"Value": "https://contoso.sharepoint.com/teams/t-app-test",
"Name": {
"Default": "test - SP SiteUrl",
"ByLcid": {
"1033": "test - SP SiteUrl"
}
}
}
],
"ConnectionReferences": [
{
"LogicalName": "contoso_test",
"ConnectionId": "0ba02acefbfc464f870b6d421f633e82",
"ConnectorId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline"
},
{
"LogicalName": "ppf_testApprovals",
"ConnectionId": "429957a759e3460badcd197b746afb4a",
"ConnectorId": "/providers/Microsoft.PowerApps/apis/shared_approvals"
}
]
}
An errors in the deploymemt settings file will result in an error.
Environment variable missing value
In case the value of an environment variable is left empty, attempt to deploy the solution using the settings file will result in
Wrong connection reference
In case the connection referece connectionid or connectorid is incorrect the error An error unexpected occurred. can be thrown.
Ensure the connection has been created and correct id populated in the settings file. Also shared the connection with the identity used for deployment of the managed solution.
Navigate to the Power Platform environment, click on connections, select the connection (for example SharePoint) and copy the Id from the Url into the connectionid property
Successful deployment
If the environment variables and connection reference have been populated correctly, the managed solution will be successfuly deployed.