skill-permissions
Skill115 starsChanged 10 days agoMITView on GitHub
AL permission set design for Business Central. Use when creating PermissionSets, implementing least-privilege access, or designing security models for extensions.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- guo-yu/skillstheir own version, first seen Jan 23, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- guo-yu/skills★ 239same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository55 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- claude-plugin/CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- instructions/copilot-instructions.mdCopilot instructions
- agent-builderSkill
- al-agent-build-instructionsSkill
- al-agent-createSkill
- al-agent-instructionsSkill
- al-agent-taskSkill
- al-agent-testSkill
- al-buildSkill
- al-context-createSkill
- al-initializeSkill
- al-memory-createSkill
- al-pr-prepareSkill
- al-spec-createSkill
- architectSkill
- auditSkill
- conductSkill
- developSkill
- presalesSkill
- reviewSkill
- skill-agent-instructionsSkill
- skill-agent-task-patternsSkill
- skill-agent-toolkitSkill
- skill-al-review-pipelineSkill
- skill-apiSkill
- skill-contribution-assistantSkill
- skill-copilotSkill
- skill-debugSkill
- skill-estimationSkill
- skill-eventsSkill
- skill-migrateSkill
- skill-pagesSkill
- skill-performanceSkill
- skill-permissionsSkill
- skill-testingSkill
- skill-translateSkill
- specSkill
- triageSkill
- skill-agent-instructionsSkill
- skill-agent-task-patternsSkill
- skill-agent-toolkitSkill
- skill-al-review-pipelineSkill
- skill-apiSkill
- skill-contribution-assistantSkill
- skill-copilotSkill
- skill-debugSkill
- skill-estimationSkill
- skill-eventsSkill
- skill-migrateSkill
- skill-pagesSkill
- skill-performanceSkill
- skill-testingSkill
- skill-translateSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 7 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 139
Always limit to what that role level logically needs (read-only for D365 READ, full for D365 SALES)
- Distinctive: line 145
Import via BC admin UI is required
- Very specific: line 237
Create permissionsetextension for standard BC roles if needed (Pattern 3)
- Distinctive: line 238
Add indirect permissions to codeunits (Pattern 5)
- Distinctive: line 244
Run tests simulating each role
- Very specific: line 245
Verify: users with "Base" CANNOT create/modify/delete
- Distinctive: line 246
Verify: users with "User" CAN operate but NOT delete setup data
- Distinctive: line 247
Verify: users with "Admin" have full access
- Distinctive: line 248
Document any runtime permission errors and adjust sets
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Skill: AL Permission Management
Purpose
Generate and manage permission sets for AL Business Central extensions following the principle of least privilege: role-based permission design, AL vs XML formats, permission set extensions, and security validation.
When to Load
This skill should be loaded when:
- A new extension needs its permission sets generated
- Permission errors surface at runtime ("You do not have permission to…")
- Role-based access control is being designed for an extension
- A security or compliance review requires permission documentation
- Permission set extensions need to be created for base-app objects
Core Patterns
Pattern 1: AL Permission Set Object (Preferred)
Generate with the VS Code permission-set generation command (not an agent tool), then refine:
permissionset 50100 "Contoso Sales"
{
Assignable = true;
Caption = 'Contoso Sales Permissions';
Permissions =
// Tables — object-level execute
table "Contoso Sales Setup" = X,
table "Contoso Discount Rule" = X,
// Table data — RIMD granularity
tabledata "Contoso Sales Setup" = R, // read-only for most users
tabledata "Contoso Discount Rule" = RIMD, // full CRUD
// Executable objects
codeunit "Contoso Sales Management" = X,
page "Contoso Sales Setup Card" = X,
page "Contoso Discount Rules List" = X,
report "Contoso Sales Summary" = X,
xmlport "Contoso Sales Import" = X;
}Permission letters for tabledata:
| Letter | Meaning | Grant when… |
R | Read | User needs to view data |
I | Insert | User needs to create records |
M | Modify | User needs to edit existing records |
D | Delete | User needs to remove records (grant sparingly) |
For non-tabledata objects (table, codeunit, page, report, xmlport, query):
X= Execute / Run0= No permission (omit the line instead)
Pattern 2: Role-Based Hierarchy (Least Privilege)
Design a layered permission structure — each role includes only what it needs:
// Layer 1: Base — read-only access shared by all roles
permissionset 50100 "Contoso Base"
{
Assignable = false; // not directly assignable to users
Caption = 'Contoso Base (Read)';
Permissions =
tabledata "Contoso Sales Setup" = R,
tabledata "Contoso Discount Rule" = R,
page "Contoso Sales Setup Card" = X,
page "Contoso Discount Rules List" = X;
}
// Layer 2: User — standard operations (includes Base)
permissionset 50101 "Contoso User"
{
Assignable = true;
Caption = 'Contoso User';
IncludedPermissionSets = "Contoso Base";
Permissions =
tabledata "Contoso Discount Rule" = IM, // create + edit (no delete)
codeunit "Contoso Sales Management" = X,
report "Contoso Sales Summary" = X;
}
// Layer 3: Admin — full control (includes User)
permissionset 50102 "Contoso Admin"
{
Assignable = true;
Caption = 'Contoso Admin';
IncludedPermissionSets = "Contoso User";
Permissions =
tabledata "Contoso Sales Setup" = RIMD, // full CRUD on setup
tabledata "Contoso Discount Rule" = D, // adds Delete
xmlport "Contoso Sales Import" = X; // data import only for admin
}Design rules:
Assignable = falsefor base/internal layers — only assign leaf-level sets to usersIncludedPermissionSetsbuilds hierarchy — no need to repeat parent permissions- Separate functional areas into distinct sets when the extension covers multiple domains
Pattern 3: Permission Set Extension
Extend existing BC permission sets to include your extension's objects — so users with standard roles automatically get access:
permissionsetextension 50100 "Contoso D365 Sales Ext" extends "D365 SALES"
{
Permissions =
tabledata "Contoso Discount Rule" = RIMD,
codeunit "Contoso Sales Management" = X,
page "Contoso Discount Rules List" = X;
}
permissionsetextension 50101 "Contoso D365 Read Ext" extends "D365 READ"
{
Permissions =
tabledata "Contoso Sales Setup" = R,
tabledata "Contoso Discount Rule" = R,
page "Contoso Sales Setup Card" = X;
}When to use permissionsetextension:
- Your objects should be accessible to users who already have a standard BC role
- Avoids requiring admins to manually assign a new permission set to every user
- Always limit to what that role level logically needs (read-only for D365 READ, full for D365 SALES)
Pattern 4: XML Permission Set (Legacy Format)
Generate the XML format via the VS Code permission-set command (not an agent tool) when:
- Targeting older BC versions (< BC 20)
- Import via BC admin UI is required
- Customer tooling only supports XML format
<?xml version="1.0" encoding="utf-8"?>
<PermissionSets>
<PermissionSet RoleID="CONTOSO-SALES" RoleName="Contoso Sales Permissions">
<Permission>
<ObjectType>0</ObjectType> <!-- TableData -->
<ObjectID>50100</ObjectID>
<ReadPermission>1</ReadPermission>
<InsertPermission>1</InsertPermission>
<ModifyPermission>1</ModifyPermission>
<DeletePermission>0</DeletePermission>
</Permission>
<Permission>
<ObjectType>5</ObjectType> <!-- Codeunit -->
<ObjectID>50100</ObjectID>
<ExecutePermission>1</ExecutePermission>
</Permission>
</PermissionSet>
</PermissionSets>XML ObjectType codes: 0 = TableData, 1 = Table, 3 = Report, 5 = Codeunit, 6 = XMLport, 8 = Page, 9 = Query.
Prefer AL format for new development — it lives in source control, participates in build, and supports IncludedPermissionSets.
Pattern 5: Indirect Permissions and TestPermissions
Some objects are accessed indirectly (via codeunit calls) and need indirect permission:
// In the codeunit that accesses data on behalf of the user
codeunit 50100 "Contoso Sales Management"
{
Permissions =
tabledata "Contoso Internal Log" = RIMD; // indirect — user doesn't access directly
}For test codeunits, set the permission level to validate security:
codeunit 50200 "Contoso Sales Test"
{
Subtype = Test;
TestPermissions = Restrictive; // NonRestrictive | Restrictive | Disabled
[Test]
procedure TestUserCanCreateDiscount()
var
PermissionsMock: Codeunit "Library - Lower Permissions";
begin
// Simulate a user with only "Contoso User" permissions
PermissionsMock.SetOutsidePermissionSet("Contoso User");
// Test that user CAN create discount rule
// ...
end;
}Workflow
Step 1: Analyze Required Permissions
- List all custom objects in the extension (tables, pages, codeunits, reports, xmlports)
- For each object, determine the minimum access level needed per role
- Identify base-app objects accessed indirectly (need
Permissionsproperty on codeunit) - Map roles to permission layers: Base (read) → User (operate) → Admin (configure + delete)
Step 2: HITL Security Gate (MANDATORY)
STOP — present the permission matrix to the user before generating:
| Object | Type | Base (R) | User | Admin |
|---|---|---|---|---|
| Contoso Sales Setup | tabledata | R | R | RIMD |
| Contoso Discount Rule | tabledata | R | RIM | RIMD |
| Contoso Sales Mgmt | codeunit | — | X | X |
| Contoso Sales Import | xmlport | — | — | X |Justify each permission and confirm the principle of least privilege is respected. Wait for explicit approval before generating permission sets.
Step 3: Generate and Refine
- Generate the initial full set via the VS Code permission-set command (not an agent tool)
- Split into role-based layers (Pattern 2)
- Create
permissionsetextensionfor standard BC roles if needed (Pattern 3) - Add indirect permissions to codeunits (Pattern 5)
- Build:
al_build— verify no errors
Step 4: Test with Restrictive Permissions
- Set
TestPermissions = Restrictiveon test codeunits - Run tests simulating each role
- Verify: users with "Base" CANNOT create/modify/delete
- Verify: users with "User" CAN operate but NOT delete setup data
- Verify: users with "Admin" have full access
- Document any runtime permission errors and adjust sets
Step 5: Document Permission Model
Include in the extension's documentation or architecture file:
- Role matrix (object × role × RIMD)
- Rationale for elevated permissions (Delete, setup tables)
- Permission set extension mappings to standard BC roles
- Indirect permissions declared on codeunits
References
- Permission Set Object — Microsoft Docs
- Permission Set Extension Object
- Permissions on AL Objects
- TestPermissions Property
- Assign Permissions to Users
Constraints
- NEVER generate permission sets without HITL security gate approval (Step 2)
- NEVER grant
D(Delete) on setup/configuration tables unless explicitly justified - NEVER grant permissions on system tables — use appropriate APIs instead
- NEVER set
Assignable = trueon intermediate/base layers (only leaf-level sets) - Permission errors at runtime → load
skill-debug.mdfor investigation - Data sensitivity classification and GDPR → outside this skill scope
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

