Hi,
LS Migration Tools v1.0.0.30 has been released.
LS Migration Tools is a Powershell module developed by LS Retail to help partners migrating from older LS NAV/LS Central versions to the latest LS Central version, following Microsoft guidelines. This tool is part of the LS Migration Process, which includes documentation provided to partners that includes step-by-step instructions and tips on how to tackle some challenges, like the objects renaming introduced in LS Central 17.5, on our journey to SaaS, and other known issues.
In this new release, a new feature has been added to clean up Permission Set AL files, removing obsoleted and on-prem scoped objects.
If you’re migrating your existing permission sets from older versions, you might get some errors reporting that some objects are obsoleted or marked as On-Prem and therefore cannot be included in a Permission Set AL file.
You don’t need to remove them one by one. That’s a chore task. And it’s even more tedious if actually you have to do it for multiple permission sets. This new feature will do all the work for you!
Understanding the permission sets conversion
To give some context, on Dynamics 365 Business Central Launch Event 2021 release wave 1 (BC 18), Microsoft provided a tool to convert existing permission sets from older versions.
Follow these links for more info:
Some key information about Dynamics 365 Business Central Launch Event 2021 release wave 1 #MSDyn365BCLaunchEvent | Dynamics 365 Lab (yzhums.com) -> Check LE21-09 Permissions and entitlements.pdf link.
BCTech/samples/PermissionSetConversion at master · microsoft/BCTech (github.com)
This tool reads the Permission Set table from the database and for each Permission Set it creates a AL file of type Permission Set that you need to copy into your extension.
Another possible approach to create the AL file for the Permission Sets is to convert the permission sets from the “older” XML format by using the NAB AL Tools extension for Visual Studio Code (link here: NAB AL Tools – Visual Studio Marketplace).
This extension includes a feature to do this conversion (more info about this specific feature here: NAB AL Tools – Visual Studio Marketplace).
Kudos to Johannes Wikman and all the contributors for creating and keeping this extension updated (https://github.com/jwikman/nab-al-tools).
Why is the new feature needed?
The “problem” is that the existing permissions set might include some objects that are now obsoleted or marked with Scope = OnPrem and you will get an error on VSCode if your extension is targeting SaaS (Cloud). To fix it you need to remove the objects from the Permission Set AL file but the error is thrown object by object, so you’re not able to identify all the objects and delete them all at once.
Take a look at this example. In the Problems window you can see that, according to the error, the table Data Sensitivity is marked as On-Prem:
You have to delete the object from the Permissions property for this permission set AL file:
Once you remove the Data Sensitivity table, Visual Studio Code will complain about the next object with similar issue:
That’s when LS Migration Tools comes into play. The new Clear-PermissionSetsDefinitions cmdlet will parse all the Permissions Set AL files included in your AL project/extension and automatically update the Permissions property on the Permission Set AL File, removing from it all the objects (handling standard objects only, for now) that have been obsoleted or are marked with Scope = OnPrem.
On this first release the objects I’ve included are based on some existing permission sets that were previously converted so there might be some objects missing that will need to be included later.
On Business Central 2022 wave 1 (BC20) and Business Central 2022 wave 2 (BC21), Microsoft introduced a lot of nice features that will make Permission Set handling a lot more easier in latest versions so don’t miss those features and try to use them as much as possible, even though you might start by converting and reusing existing Permission Sets from older versions.
Permission set handling enhancements | Microsoft Learn
Exclude permissions from wildcard permission sets | Microsoft Learn
Dynamics 365 Business Central: Permission Exclusion (Exclude in Permission Set) | Dynamics 365 Lab (yzhums.com)
Dynamics 365 Business Central: New ExcludedPermissionSets Property in permission set objects | Dynamics 365 Lab (yzhums.com)
Conclusion
If you are a LS Retail partner, working on migrating customers from older versions to latest LS Central (or Business Central) and if you’re having the issues described before, give this feature a try and let me hear your thoughts on this feature.
I hope you enjoyed this article and found it useful.