MSBA-352 · Lesson 10 of 12 · 19 min
Permissions in extensions
▶ Video coming soon A video version of this lesson is on the way.
The first time Dovrin Mwangi-Ross, the warehouse lead, posted a shipment of two grinders in UPDATE-TEST, posting failed. The error said that Dovrin did not have permission to insert data into the CNF Warranty Registration table. Joss had tested everything as a user with the SUPER permission set, which can do anything, so the problem had never appeared. Noor was not surprised. "Every developer finds this out once," she said. "Better in UPDATE-TEST in November than in production on January 4." This lesson covers how extensions declare permissions, how users get them, and the indirect and inherent permissions that let code do things users cannot do directly.
How permissions work in Business Central
A user can do something in Business Central only if two things allow it: their license, which sets the outer limit of what their user type may do, and their permissions, which grant access to specific objects and data within that limit. Permissions come in permission sets, and permission sets reach users directly or, at Corbel & Finch, through security groups linked to Microsoft Entra groups, as Callum set up in the foundations course: BC-Finance, BC-Sales, BC-Purchasing, BC-Warehouse and BC-Cafe.
A permission set is a list of entries. For each table's data, it can grant Read, Insert, Modify and Delete, written R, I, M and D. For objects such as pages, reports, codeunits, queries and the tables themselves, it grants Execute, written X. Each permission can be direct, written in capitals, or indirect, written in lower case, which is explained below.
Permission sets in AL
An extension declares its own permission sets as permissionset objects. Microsoft's guidance, and PerTenantExtensionCop, expects every object an extension adds to be covered by at least one permission set in that extension. Joss had skipped that step, which is why only SUPER users could use the app.
namespace Quarrystone.CorbelFinch.Warranty;
permissionset 50100 "CNF WARRANTY VIEW"
{
Assignable = true;
Caption = 'Warranty - view';
Permissions =
tabledata "CNF Warranty Registration" = R,
tabledata "CNF Warranty Claim" = R,
tabledata "CNF Warranty Setup" = R,
table "CNF Warranty Registration" = X,
table "CNF Warranty Claim" = X,
table "CNF Warranty Setup" = X,
page "CNF Warranty Registrations" = X,
page "CNF Warranty Registration" = X,
page "CNF Customer Warranties" = X,
page "CNF Warranty Claims Part" = X,
report "CNF Warranty Certificate" = X,
report "CNF Warranties Ending" = X,
query "CNF Claims by Item and Month" = X;
}
permissionset 50101 "CNF WARRANTY EDIT"
{
Assignable = true;
Caption = 'Warranty - edit claims and registrations';
IncludedPermissionSets = "CNF WARRANTY VIEW";
Permissions =
tabledata "CNF Warranty Registration" = RM,
tabledata "CNF Warranty Claim" = RIMD,
codeunit "CNF Warranty Mgt." = X;
}
permissionset 50102 "CNF WARRANTY SETUP"
{
Assignable = true;
Caption = 'Warranty - setup';
IncludedPermissionSets = "CNF WARRANTY EDIT";
Permissions =
tabledata "CNF Warranty Setup" = RIMD;
}The three sets are layered. VIEW lets someone look at warranties and print certificates. EDIT includes VIEW and adds the right to log and change claims and to correct registration dates, but not to insert or delete registrations, which only posting creates. SETUP includes EDIT and adds the setup table. Assignable = true means administrators can assign the set to users and groups; a non-assignable set can only be included in others.
Who gets what
Callum mapped the sets onto the security groups he already had.
| Group | Warranty permission set | Why |
|---|---|---|
| BC-Sales | CNF WARRANTY EDIT | The sales team takes calls from cafés and logs claims |
| BC-Warehouse | CNF WARRANTY VIEW | Dovrin's team needs to see warranties when machines come back |
| BC-Finance | CNF WARRANTY SETUP (Callum only via a personal assignment) | Callum maintains setup and corrects dates |
| BC-Cafe | None | Café managers have no reason to see wholesale warranties |
| Web shop integration app | CNF WARRANTY VIEW | Read-only status lookups through the API |
Callum had built his own permission sets in the client during the foundations course: CF-SALES, CF-PURCH, CF-WHSE and CF-CAFE. These are tenant permission sets, stored as data in the tenant, not code. Joss asked whether the warranty app could simply add its objects to CF-SALES. It cannot: an extension can only extend permission sets that exist as AL objects, and CF-SALES exists only in Corbel & Finch's data. There are two clean options. Administrators can assign the CNF sets to the security groups next to the CF sets, which is what Callum did. Or Callum can open CF-SALES in the client and add CNF WARRANTY EDIT as an included permission set, so the tenant set picks up future changes to the app's set automatically.
Extending existing permission sets
When an extension adds fields to a standard table, users who can read that table can read the new fields; no extra permission is needed for fields in a table extension. When an extension adds new objects that users of a standard area always need, it can add them to an existing AL permission set with a permissionsetextension.
permissionsetextension 50100 "CNF D365 BASIC Ext" extends "D365 BASIC"
{
Permissions =
tabledata "CNF Warranty Setup" = R;
}Joss used this sparingly. Extending a broad standard set grants the permission to everyone who has that set, which is most users. Reading a setup table is harmless, and every page that checks setup needs it, so it qualified. Anything more stayed in the CNF sets.
Indirect permissions: why Dovrin's posting failed
Dovrin is in BC-Warehouse, which gets CNF WARRANTY VIEW: read only. When he posted the shipment, the warranty subscriber from lesson 6 tried to insert a registration under Dovrin's identity, and Business Central rightly refused. The fix is not to give the warehouse insert rights on the registration table. A warehouse user should never be able to type in a registration by hand. The fix is to let the code insert on Dovrin's behalf.
That is what indirect permissions do. A codeunit can declare in its Permissions property that it needs certain permissions on certain tables. A user with an indirect permission (lower case) on that table can then perform the operation, but only through objects that declare it. The pattern is two-sided: the codeunit declares the permissions it needs in its Permissions property, and the user's permission set grants the same operations in lower case. Neither half works alone.
codeunit 50103 "CNF Warranty Subscribers"
{
Access = Internal;
Permissions = tabledata "CNF Warranty Registration" = rim;
// ... subscriber as in lesson 6 ...
}
codeunit 50100 "CNF Warranty Mgt."
{
Permissions = tabledata "CNF Warranty Registration" = rim;
// ... procedures as in lesson 5 ...
}
permissionset 50103 "CNF WARRANTY POST"
{
Assignable = false;
Caption = 'Warranty - registration from posting';
Permissions =
tabledata "CNF Warranty Registration" = rim,
codeunit "CNF Warranty Subscribers" = X,
codeunit "CNF Warranty Mgt." = X;
}Callum then included CNF WARRANTY POST in the CF-WHSE and CF-SALES tenant sets, since both groups post shipments. Now Dovrin can post, the subscriber creates registrations through the codeunits that declare the permissions, and Dovrin still cannot open the registrations list and insert one himself.
Inherent permissions
Some access should not depend on any permission set at all. A setup table that every page reads, or a small log that the code always writes, would otherwise have to be added to every user's sets. Inherent permissions are granted by the code itself. The InherentPermissions property on an object, or the [InherentPermissions] attribute on a procedure, grants a permission to anyone who runs that object or procedure, regardless of their permission sets. InherentEntitlements does the same for license entitlements and matters mostly to marketplace apps.
table 50102 "CNF Warranty Setup"
{
InherentPermissions = R;
InherentEntitlements = R;
// ...
}Inherent permissions are convenient and easy to overuse. Noor's rule was that they are for data every user of the app must read for the app to work at all, such as setup, and never for business data. Registrations and claims stay behind permission sets, because who can see a customer's warranties is a business decision Callum controls, not a developer's.
Testing permissions
After Dovrin's failure, Joss changed how testing worked. Every feature is now tested by a user who has only the permission sets a real user in that role will have. In UPDATE-TEST, Callum created test users matching the security groups, and Joss signed in as each before calling a feature done.
Business Central has tools that help.
- The Effective Permissions page shows, for a user and an object, exactly which permissions the user has and which permission sets grant them, including indirect ones.
- The permission recorder on a permission set records every object and table a user touches while performing a task, and turns the recording into permission entries. Joss used it while posting a shipment and logging a claim, then compared the recording with the sets.
- Error messages for missing permissions name the object and the permission, and the Copy details option on the error includes the user and session information a developer needs.
Data classification and personal data
Permissions decide who sees data; data classification describes what the data is. Lesson 3 set DataClassification on every field. Registrations contain customer numbers and serial numbers, which is business data about companies, classified CustomerContent. If the app stored a café contact person's mobile number on a claim, that field would be EndUserIdentifiableInformation, and Business Central's privacy tools would include it when a person asked for their data or asked to be forgotten. Joss kept personal contact details on the standard contact card and stored only the contact number on the claim.
Licenses and the Team Member limit
Permissions cannot grant what a license does not allow. Corbel & Finch's three Team Member users, the café managers, can read most data and edit a limited set of documents, but cannot post shipments or create most records. If BC-Cafe were ever given CNF WARRANTY EDIT, the Team Member license would still limit what café managers could actually do. Extension tables follow the same license rules as standard ones unless the app declares otherwise with entitlements, which only marketplace apps normally ship.
Worked problem
Diagnosing a permission error
After go-live, a new salesperson reports that printing a warranty certificate fails with an error about the Company Information table. She is in BC-Sales. What should Callum check?
Show solution
- Read the error with Copy details: it names the object (the Company Information table data) and the permission (Read).
- Open Effective Permissions for the user and that table. Her sets come from BC-Sales: CF-SALES and CNF WARRANTY EDIT.
- CNF WARRANTY EDIT includes VIEW, which grants Execute on the report but says nothing about Company Information. Most users get read access to it from a standard set; CF-SALES may have been built without it.
- Fix the data, not the code: add read on Company Information to CF-SALES, or add the standard basic set to BC-Sales. Then ask her to try again.
Answer: A report needs read permission on every table it reads, including standard ones; check effective permissions and fix the sets.
Security filters
Permission sets control which tables a user can reach. Security filters go one step further and control which rows. A permission entry for table data can carry a filter, such as Customer No. limited to a set of customers or a Location Code limited to one location, and Business Central then hides every other row from users whose permission comes from that entry. Corbel & Finch does not need them for warranties, since the sales team serves every café. Callum noted them for a possible future in which café managers see warranties only for machines at their own café, and Joss recorded that the registration table would then need a location or café field to filter on. Security filters add a cost to every query on the table, so they are worth using only when the business needs them.
Integrations and agents are users too
Every caller in Business Central runs as some identity with permissions. The web shop's Entra ID app registration from lesson 8 appears in Business Central as an application user, and Callum assigns it permission sets exactly as he would a person: CNF WARRANTY VIEW and nothing else. The job queue runs entries under the user who scheduled them, so the nightly expiry job needs someone with modify rights on registrations, which Callum provides through his own setup set. Agents, such as the Payables Agent that Corbel & Finch plans to review in March 2027, also run with their own permissions and licenses, and an agent can only touch warranty data if someone grants it a warranty permission set. Joss wrote these identities into the app's documentation, next to the human roles, so that nobody later wonders why the web shop can read registrations.
Common mistakes
MistakeTesting only as a SUPER user.
InsteadTest as users with only the sets their role will have.
MistakeGiving warehouse users direct insert on registrations so posting works.
InsteadDeclare permissions on the codeunits and grant indirect permission.
MistakeTrying to extend a tenant permission set such as CF-SALES from AL.
InsteadAssign the app's sets to security groups or include them in the tenant set in the client.
MistakeUsing inherent permissions on business data.
InsteadReserve inherent permissions for data the app needs to function, such as setup.
MistakeShipping objects that no permission set covers.
InsteadCover every object in at least one of the app's permission sets.
Summary and key terms
- Licenses set the outer limit; permission sets grant access to objects and data within it.
- Extensions declare permission sets as AL objects that cover every object they add.
- Layered sets with IncludedPermissionSets keep view, edit and setup roles clear.
- Tenant permission sets made in the client cannot be extended from AL; include or assign the app's sets instead.
- Indirect permissions let code perform operations users cannot do directly.
- Inherent permissions grant access through code itself and should be reserved for setup-like data.
- Permission set
- A named list of permissions on objects and table data.
- Security group
- A group linked to Microsoft Entra ID that assigns permission sets to its members.
- Direct permission
- A permission a user can use anywhere, written in capitals.
- Indirect permission
- A permission usable only through objects that declare it, written in lower case.
- Inherent permission
- A permission granted by an object or procedure to anyone who runs it.
- Effective Permissions
- A page that shows a user's actual permissions on an object and their source.
- Permission recorder
- A tool that records objects a user touches and turns them into permission entries.
Practice problems
Work each problem on paper first, then reveal the answer to check.
Why did posting fail for Dovrin but not for Joss?
Show answer
Joss tested as SUPER; Dovrin had only read permission on registrations, so the subscriber could not insert under his identity.
What does tabledata "CNF Warranty Registration" = rim mean?
Show answer
Indirect read, insert and modify: usable only through objects that declare those permissions.
Why can the warranty app not add its objects to CF-SALES directly?
Show answer
CF-SALES is a tenant permission set stored as data; extensions can only extend permission sets that exist as AL objects.
Lesson quiz · 5 questions
Score 60% or more to complete this lesson.
Create a free account to save your progress, take quizzes and earn a certificate.