web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Sorry, the current permissions prevented the action. (Codeunit, D365 BC API)

(1) ShareShare
ReportReport
Posted on by 9
Hi,
I tried to publish a webservice. The object is a simple code unit with following content:

codeunit 80004 TutorialAPI

{

    procedure Hello(): Text

    begin

        exit('Hello World');

    end;

}

The Azure Active Directory App has got following user groups and permissions:

A POST to https:/api.businesscentral.dynamics.com/v2.0/{{Tenant-ID}}/{{Env_Name}}/ODataV4/TutorialAPI_Hello  without any json payload will bring up following error with status code 400 bad request and message:

 

{
    /error/: {
        /code//Internal_ServerError/,
        /message//Sorry, the current permissions prevented the action. (CodeUnit TutorialAPI Execute: )  CorrelationId:  d335ed99-1ac4-4029-9815-f9048e8d05d7./
    }
}
 
I can't figure out what the problem might be. Hopefully someone has an idea.
 
Greatings
Jannis
I have the same question (0)
  • Verified answer
    YUN ZHU Profile Picture
    95,329 Super User 2025 Season 2 on at
    Hi, it looks like you didn't generate the permissions file for your extension. More details: https://yzhums.com/29221/
    For exmaple,
     
    Also, this is required in a production environment.
     
    Hope this helps.
    Thanks.
    ZHU
  • j_ha_e Profile Picture
    9 on at
    Hi Yun Zhu,
    thanks for your quick response. I tried it as the article suggest it with the following permission set:

    permissionset 80000 GeneratedPermission

    {

        Assignable = true;

        Permissions =

            codeunit TutorialAPI=X;

           

    }

    And assigned it to the Azure Application:
    Unfortunately the result ist the same:
     
    {
        "error": {
            "code""Internal_ServerError",
            "message""Sorry, the current permissions prevented the action. (CodeUnit TutorialAPI Execute: )  CorrelationId:  2c526749-1586-490a-8331-cfd04f9abae7."
        }
    }
     
    Is there a step I missed out?
  • j_ha_e Profile Picture
    9 on at
    Hi Yun Zhu,
    now it works. I re-added the permission in the permission sets of the app user without a specific company.
    Thanks for your help.
     
    Greetings 
    Jannis

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,229

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,867 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,153 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans