Exporting Permission Sets

Permission sets that exist in Dynamics 365 Business Central can be exported and packaged for your extension directly from the client, instead of defining XML by hand.

To export permission sets from Dynamics 365 Business Central

  1. In Dynamics 365 Business Central, search for Permission Sets, and then choose the relevant link.
  2. On the Permission Sets page, choose the permissions that you want to export, and then choose Export Selected Permissions.
  3. In the Export Permission Sets dialog, choose to export permission sets only for the application, only for the tenant, or for both.
  4. Save the file to your extension folder.
  5. Delete the permission sets from Dynamics 365 Business Central.

You can generate a permission set file which contains permissions to all the files in your extension. This will make it easier to start setting up permissions for your app. You can do this by simply creating an extension with some objects.

To export permission sets using Visual Studio Code

  1. In Visual Studio Code, open your extension.
  2. Create extension with some objects like Page, Report, Table, Query, Codeunit, or XmlPort.  
  3. Open the command palette using the Ctrl+Shift+P keys and select the AL: Generate permission set containing current extension objects command.  

    Note

    If you do this repeatedly, Visual Studio Code will probe for overwriting the file, there is no support for merging manual corrections into newly generated content.

  4. Publish the app. 

Now, you have the XML file with default permissions to all your objects.

See Also

Permissions on Database Objects
Permissions Property
TestPermissions Property