In our PowerApps setup we have four environments:
* Development (Unmanaged)
* Build (Unmanaged)
* Test (Managed)
* Production (Managed)
We change the solution in development. When everything is ready for deployment we export an unmanaged solution to git. When we merge to our main branch, the pipeline takes over:
- Delete the solution from Build.
- Import new solution to Build from git.
- Bump version.
- Export solution from Build as managed.
- Upgrade solution in test.
- Upgrade solution in production.
This has the benefit of keeping the solution and the code in sync as well as verifying that the solution can be imported anew if everything goes sideways.
However, there is an issue: When deleting the solution from Build the Dataverse tables remain. Not only that, when importing the new solution they are somehow incorporated into the solution, so when it is exported in step 4 references to deleted tables reemerge. Step 5 then fails.
Ideally we would prefer to just reset the build environment each time, however this also deletes users and takes much too long.
Is there a way to delete all table definitions belonging to a deleted solution? Doing it via REST calls is fine, as long as it can be done by some automated process.