When you try to deploy a PTE (per tenant extension) from VSCode (Visual Studio Code), and you get the following error:
- Your license does not grant you the following permissions on TableData Published Application: IndirectInsert
- The request for path /v2.0/sandbox/dev/apps?SchemaUpdateMode=synchronize&DependencyPublishingOption=default failed with code UnprocessableEntity. Reason: Your licence does not grant you the following permissions on TableData Published Application: IndirectInsert. To view details about your permissions, see the Effective Permissions page. To report a problem, refer to the following server session ID: ‘22933’
Publishing extensions requires access to all companies within the environment (as this is not a per-company operation) and in this case you do not have access to the expired production/trial company. This rule applies to both sandbox and production environments.
Usually, then there’s a simple solution: Delete all non-evaluation companies from all your Business Central environments, for that tenant.
This was actually posted some time ago on the BC support blog, here: Permission error deploying extensions via VS Code – Dynamics 365 Business Central Community
Typically this situation occurs when you have created a Business Central trial. (trials.dynamics.com) At that moment you are assigned a Dynamics 365 Business Central for IWs license, which means it’s a free trial license.
When you then create companies, and they are Cronus demo companies, since Cronus never expires, you can use the free IWs License to develop in Business Central. However, when you create a new, non-Cronus, company, and start to import your own data, then the Business Central trial period starts: Trials and Sign-ups for Business Central online – Business Central | Microsoft Docs
After (30d + 30d + 30d) the trial period, the trial company expires. From that moment you might get the above error when trying to deploy an app from VScode. And the solution is then to delete the expired company.
Be aware that even when your expired company is in your Production environment, that it blocks deployment in all environments: sandboxes and production. So when you get the error, look for expired companies in all your environments and delete them.
That’s is, from the moment you delete the expired companies (or as an alternative buy a license), you can deploy again.
If the error persists after deleting all expired companies, then you might want to check your permissions and entitlements in Business Central.
- The first thing to check is that you have a BC license (our free evaluation IW license counts as well) and you have the right permissions assigned to your user in all companies.
- Secondly you need to ensure that you do not have expired non-evaluation (production) companies in your environment.