Jump to content

Woodford CLI

From Resco's Wiki

Woodford CLI is a command-line tool that allows you to manipulate app projects on remote Resco Cloud or Power Platform servers. It provides a flexible set of commands that help developers speed up the deployment of Woodford projects:

  • list project/roles
  • create/import/export projects
  • validate/publish projects

Find more details in the npmjs package readme document.

Prerequisites

Minimum version:

  • 15.0
  • 19.1 for client ID and client secret authentication flow

Supported backends:

Installation

To install CLI globally, run the following command:

npm install -g @resconet/woodford-cli

To uninstall CLI, run the following command.

npm uninstall -g @resconet/woodford-cli

Available commands

--help             Show help                                          [boolean]
--version          Show version number                                [boolean]
-u, --url          Organization url                                   [string]
-l, --login        Login                                              [string]
-p, --password     Password                                           [string]
-c, --command      Command:
                    [login | logout | list | export | import |
                    create | publish | delete | roles] project        [string] [required]
-n, --name         Project name                                       [string]
-f, --file         Path to file                                       [string]
-v, --validate     Validate published project                         [boolean]
-r, --properties   Command properties
                   - Create: 'priority;role1,role2,..;appid;version'  [string]
-d, --dynamicscrm  Dynamics CRM backend                               [boolean]
-a, --clientid      Client ID                                         [string]
-s, --clientsecret  Client Secret                                     [string]

Usage

Login (device code flow):

wf-cli -c login -u https://<server>.crm.dynamics.com -l user@example.com

Login (client credentials):

wf-cli -c login -u https://<server>.crm.dynamics.com -a <client_id> -s <client_secret>

Logout:

wf-cli -c logout

List projects:

wf-cli -c list

Create project:

wf-cli -c create -n <project_name> -r "priority;role1,role2,...;appid;version"
wf-cli -c create -n "Best Project" -r "1;System Administrator,Sales Person;My First App;v1.0"

Import project:

wf-cli -c import -n <project_name> -f project.woodford

Export project:

wf-cli -c export -n <project_name> -f project.woodford

Publish project:

wf-cli -c publish -n <project_name> [-v]

Example: Migrate and publish a project with role assignment

The following PowerShell script demonstrates a full deployment workflow: authenticating with client credentials, selecting roles across all business units, conditionally creating a destination project, migrating configuration from a source project, and publishing.

$url = "https://<name>.crm4.dynamics.com"
$clientId = "<client id>"
$clientSecret = "<client secret>"
$srcProjectName = "<source project name>"
$dstProjectName = "<destination project name>"
$appId = "<app id>"
$priority = 100
$version = "<custom version>"
$roles = "Salesperson", "Field Service - Dispatcher", "Customer Service Representative"

# Login using client credentials
wf-cli -c login -u $url -a $clientId -s $clientSecret

# Select roles across all business units
# wf-cli returns roles in the format "RoleName(BusinessUnit)" — filter by known role names
$listRoles = wf-cli -c roles
$selectedRoles = $listRoles | Where-Object {
    foreach ($r in $roles) {
        if ($_ -match "^$r\(.*$") { return $true }
    }
    return $false
}
$projectRoles = $selectedRoles -join ","

# Export source project
wf-cli -c export -n $srcProjectName -f "$srcProjectName.woodford"

# Create destination project if it doesn't exist yet
$list = wf-cli -c list
if (-not ($list | Where-Object { $_ -match "^$dstProjectName$" })) {
    Write-Host "Project $dstProjectName not found. Creating..." -ForegroundColor Red
    wf-cli -c create -n $dstProjectName -r "$priority;$projectRoles;$appId;$version"
}

# Import configuration into destination project
wf-cli -c import -n $dstProjectName -f "$srcProjectName.woodford"

# Clean up exported file
Remove-Item "$srcProjectName.woodford"

# Publish destination project
wf-cli -c publish -n $dstProjectName

# Logout
wf-cli -c logout
Key points
  • The roles command returns entries in RoleName(BusinessUnit) format — the script matches by role name prefix to capture all business units automatically.
  • The create command is skipped if the destination project already exists, making the script safely re-runnable.
  • The -r (properties) parameter for create takes the format priority;role1,role2,...;appid;version.