We are an OEM provider and therefore control both the package and the destination orgs. Our packaging org has 3 profiles and we add permissions to those 3 profiles when creating new components (fields, page layouts, etc.). When the customer org upgrades the package, there are three options available:
If we select the "Install for Specific Profiles..." and map the Access Level of the package's profiles to the destination org, this lets us control a bit what new components are granted and what permissions during the upgrade process.
Is there a way to automate this process from SFDX or some other CLI/API? As far as I can tell, SFDX only allows you to upgrade for All Users in a push upgrade, or you can use a pull upgrade and pick which option to install. But I can't find any documentation about how to do a pull upgrade from a command line while matching profiles. There must be some method since Salesforce allows it from this screen, but the only solution we've come up with is some UIFlow or process that logs into each org, navigates to the specific page and performs the mapping.
Anyone with any brilliant ideas out there?