{"title":"Composing permission sets","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/devenv-permissionset-composing/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-permissionset-composing, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-permissionset-composing","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Learn how to create a permission set from one or more existing permission sets in AL code for Business Central.","date":"2024-11-21","meta":{"topic":"concept-article"},"outline":[{"level":1,"title":"Composing permission sets","slug":"composing-permission-sets","at":0,"chars":7697},{"level":2,"title":"Design concepts","slug":"design-concepts","at":713,"chars":2269},{"level":3,"title":"Fundamental permission sets","slug":"fundamental-permission-sets","at":792,"chars":588},{"level":3,"title":"Composite permission sets","slug":"composite-permission-sets","at":1380,"chars":1066},{"level":3,"title":"Bringing approaches together","slug":"bringing-approaches-together","at":2446,"chars":536},{"level":2,"title":"Include permission sets","slug":"include-permission-sets","at":2982,"chars":1835},{"level":2,"title":"Exclude permission sets","slug":"exclude-permission-sets","at":4817,"chars":792},{"level":2,"title":"Rules, guidelines, and tips","slug":"rules-guidelines-and-tips","at":5609,"chars":1648},{"level":2,"title":"Related information","slug":"related-information","at":7257,"chars":440}],"text":"# Composing permission sets\nPermissions define a specific level of access to data and objects<devenv-permissions-on-database-objects> in the application, like read, insert, modify, and delete permission on table data. Permission sets combine these permissions in logical groups that can then be assigned to users. Permission sets in AL are created using the devenv-permissionset-object, and existing permission sets are extended using the permissionset extension object<devenv-permissionset-ext-object>. In the client, administrators can't modify these AL-based permission sets, but they can copy them and modify the copies (learn more in Assign Permissions to Users and Groups</ui-define-granular-permissions>).\n## Design concepts\nThere are different approaches to creating permission sets.\n### Fundamental permission sets\nOne approach is to create a kind of self-contained permission set that includes all the permissions you want to grant to specific data and objects. These permissions are defined explicitly in the properties/devenv-permissions-property of the permission set or permission set extension object. This approach creates a structure considered to be flat structure.\nThe disadvantage with this approach by itself is that if you have to change a permission, like C and D in the figure, you have to make the change in every permission set that uses the permission.\n### Composite permission sets\nAnother approach is to use the properties/devenv-includedpermissionsets-property and ExludedPermissionSets property<properties/devenv-excludedpermissionsets-property> to create permission sets that are composed of the other permission sets. Any changes made to the included or excluded permission sets are automatically propagated to the permission sets that use them. In this manner, you create permission sets that have hierarchical structure, as illustrated in the following figure. In the figure, permission set 5 is composed from all permission sets, minus the permissions in permission set 3.\n![Shows the hierarchy of a permission set that includes several other permission sets.]\nComposite permission sets are easier to maintain and keep up-to-date compared to fundamental permission sets&mdash;especially when building off Microsoft permission sets. This approach enables you to create concise, reusable permission sets that control access to specific features, which act as building blocks for expanding other permission sets.\n### Bringing approaches together\nUltimately, you use a combination of these approaches to meet your permission requirements. Many of the default permission sets from Microsoft follow this approach. The following figure illustrates how different permission sets (in this case, standard Dynamics 365 permission sets) can be used to compose two custom permission sets (EMPLOYEE and HR). The permission sets are simplified for illustration purposes.\n![Shows an example of two custom permission sets based on standard D365 permission sets.]\n## Include permission sets\nYou use the IncludedPermissionSets property to create a permission set that includes permissions from other permission sets. The property is available on permission set and permission set extension objects.\nThe following code example illustrates a permission set `Sales Person` that includes permissions that grant access, at various levels, to data in different tables. The properties/devenv-assignable-property is set to true, which allows the permission set to be assigned to a user. The properties/devenv-permissions-property is set to the list of objects to give permissions to. The RIMD access assigned to data in the Customer table provides full access, whereas, for example, access is limited for data in the Currency table only allowing full read and modify permission.\n```al\npermissionset 50134 \"Sales Person\"\n{\n    Assignable = true;\n    Caption = 'Sales Person';\n\n    Permissions =\n        tabledata Customer = RIMD,\n        tabledata \"Payment Terms\" = RMD,\n        tabledata Currency = RM,\n        tabledata \"Sales Header\" = RIM,\n        tabledata \"Sales Line\" = RIMD;\n}\n```\nWith the IncludedPermissionSets property, you can specify that the permission set `Sales Person` is also included in MyPermissionSet.\n```al\npermissionset 50135 MyPermissionSet\n{\n    Assignable = true;\n    Caption = 'My PermissionSet';\n    IncludedPermissionSets = \"Sales Person\";\n\n    Permissions =\n        tabledata Vendor = RIm,\n        codeunit SomeCode = x,\n        codeunit AccSchedManagement= X;\n}\n```\nThe resultant permissions for the MyPermissionSet permission set are then:\n```al\ntabledata Customer = RIMD,\ntabledata \"Payment Terms\" = RMD,\ntabledata Currency = RM,\ntabledata \"Sales Header\" = RIM,\ntabledata \"Sales Line\" = RIMD;\ntabledata Vendor = RIm,\ncodeunit SomeCode = x,\ncodeunit AccSchedManagement= X;\n```\n## Exclude permission sets\nWith the ExludedPermissionSets property, you can remove permissions that are defined in other permission sets from your permission set. The ExcludePermissionSets property isn't supported on permission set extension objects.\nThe following code example illustrates how to use the ExcludePermissionSets property.\n```al\npermissionset 50136 MyPermissionSet2\n{\n    Assignable = true;\n    Caption = 'My PermissionSet 2';\n    IncludedPermissionSets = \"MyPermissionSet\";\n    ExcludedPermissionSets = \"Sales Person\";\n\n    Permissions =\n        tabledata MyTable  =RIMD,\n}\n```\nThe resultant permissions defined by the MyPermissionSet2 permission set are then:\n```al\ntabledata MyTable  = RIMD,\ntabledata Vendor = RIm,\ncodeunit SomeCode = x,\ncodeunit AccSchedManagement= X;\n```\n## Rules, guidelines, and tips\nThis section explains points that can help you get the resultant permissions that you want.\n Permissions are determined by working up the hierarchy, adding or removing permissions at each level.\n Exclude permissions take precedence over included permissions when applied on the same level. If an excluded permission set and included permission set define the same permissions, the excluded permission set permissions are used, overriding the included permission set permissions.\n Direct permissions override indirect permissions.\n When excluded permission sets are used, only permissions are excluded. Security filters from the excluded permission sets aren't used for the negation.\nThe following table shows how the permissions are determined on a single object when included and excluded permission sets are used:\nPermission Set A|Permission Set B|Result\nPermissions = tabledata Customer = RI<br>IncludedPermissionSets = B|Permissions = tabledata Customer = iMD|tabledata Customer = RIMD\nPermissions = tabledata Customer = Ri<br>IncludedPermissionSets = B|Permissions = tabledata Customer = IMD|tabledata Customer = RIMD\nPermissions = tabledata Customer = RIMD<br>ExcludedPermissionSets = B|Permissions = tabledata Customer = iMD|tabledata Customer = RI\nPermissions = tabledata Customer = RiMD<br>ExcludedPermissionSets = B|Permissions = tabledata Customer = IMD|tabledata Customer = R\n> TIP\n> When including and excluding multiple permission sets, it can be difficult to get an overview of what the resultant permissions will be. To help, use the View all permissions action from the permission set in the client.\n## Related information\nDeveloping extensions<devenv-dev-overview>\nAL development environment<devenv-reference-overview>\nEntitlements and permission set overview<devenv-entitlements-and-permissionsets-overview>\nPermission set extension object<devenv-permissionset-ext-object>\ndevenv-permissions-on-database-objects\nproperties/devenv-assignable-property\nproperties/devenv-includedpermissionsets-property\nproperties/devenv-permissions-property"}