Manage Permission Set Licenses (PSLs) in your scratch orgs. This plugin lets you provision PSL seats into a target scratch org — either one at a time via command line flags, or in bulk using a JSON definition file.
- Install and authenticate the Salesforce CLI.
- Ensure you have the appropriate permissions to manage Permission Set Licenses in the target org.
sf plugins install @salesforce/plugin-license-management@x.y.zPlease report any issues at https://github.com/forcedotcom/cli/issues
- Please read our Code of Conduct
- Create a new issue before starting your project so that we can keep track of what you are trying to add/fix. That way, we can also offer suggestions or let you know if there is already an effort in progress.
- Fork this repository.
- Build the plugin locally
- Create a topic branch in your fork. Note, this step is recommended but technically not required if contributing using a fork.
- Edit the code in your fork.
- Write appropriate tests for your changes. Try to achieve at least 95% code coverage on any new code. No pull request will be accepted without unit tests.
- Sign CLA (see CLA below).
- Send us a pull request when you are done. We'll review your code, suggest any needed changes, and merge it in.
External contributors will be required to sign a Contributor's License Agreement. You can do so by going to https://cla.salesforce.com/sign-cla.
To build the plugin locally, make sure to have yarn installed and run the following commands:
# Clone the repository
git clone git@github.com:salesforcecli/plugin-license-management
# Install the dependencies and compile
yarn && yarn buildTo use your plugin, run using the local ./bin/dev or ./bin/dev.cmd file.
# Run using local run file.
./bin/dev license provisionThere should be no differences when running via the Salesforce CLI or using the local run file. However, it can be useful to link the plugin to do some additional testing or run your commands from anywhere on your machine.
# Link your plugin to the sf cli
sf plugins link .
# To verify
sf pluginsProvision Permission Set Licenses (PSL) into a target org.
USAGE
$ sf license provision -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-n <value> | -f <value>]
[-l <value> | ] [-q <value> | ]
FLAGS
-f, --definition-file=<value> Path to a JSON file that contains the PSL provisioning request information.
-l, --license=<value> Permission Set License name.
-n, --namespace=<value> License package namespace.
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
configuration variable is already set.
-q, --quantity=<value> Number of licenses to provision.
--api-version=<value> Override the api version used for api requests made by this command
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Provision Permission Set Licenses (PSL) into a target org.
Provision Permission Set Licenses (PSL) into the target org. Successful execution sets the quantity of seats for the
given PSL in the indicated org.
There are two ways to run this command. You can provide the information to identify a single PSL via command line
flags, or provision multiple PSLs in a single call by supplying a JSON formatted file.
See https://github.com/salesforcecli/plugin-license-management#sf-license-provision for the format and options
contained within the JSON file.
EXAMPLES
Provision a single Permission Set License into an org:
$ sf license provision --target-org myScratchOrg --namespace demo --license newLicense --quantity 5
Use a JSON formatted input file to provision one or more Permission Set Licenses into an org:
$ sf license provision --target-org myScratchOrg --definition-file test/config/provisionPSLs.json
See code: src/commands/license/provision.ts
sf org login web --set-default-dev-hub --instance-url <dev-hub-url>Before creating the scratch org, update test/config/scratch-org-def.json with your values:
| Field | Description |
|---|---|
orgName |
Display name for the scratch org |
namespace |
Your package namespace (e.g. myNS) |
sf org create scratch --definition-file test/config/scratch-org-def.json --alias <scratch-org-alias>Make the package available in the scratch org. Some ways to do this include:
Install a released package version
sf package install --package <package-version-id> --target-org <scratch-org-alias>Push source directly
sf project deploy start --target-org <scratch-org-alias>sf org open --target-org <scratch-org-alias># Provision a single PSL
sf license provision --target-org <scratch-org-alias> --namespace <namespace> --license <license-name> --quantity <number>
# Provision multiple PSLs using a definition file
sf license provision --target-org <scratch-org-alias> --definition-file <path-to-definition-file>