After installing a managed package I want to modify the SetupEntityAccess records for a PermissionSet to grant access to an App that was installed as part of the package. Ideally this would have been done as part of the package definition, but that doesn't appear to be possible:
Permission sets include assigned apps and tab settings, but these settings can’t be packaged as permission set components.
From About Permission Sets and Profile Settings in Packages
The PermissionSet (0PS) that was installed as part of the managed package can be found with SOQL using the PermissionSet.NamespacePrefix field.
How can I find the TabSet (App) Id in Apex?
It will have an Id with the key prefix 02u.
I can find the metadata for the TabSet by using
Schema.describeTabs() and searching the results until getNamespace() returns the expected value. However, the
Schema.DescribeTabSetResult doesn't expose the ID of the TabSet.