web
You’re offline. This is a read only version of the page.
close
Skip to main content
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)
  • j_ha_e Profile Picture
    9 on at
    Sorry, the current permissions prevented the action. (Codeunit, D365 BC API)
    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
  • j_ha_e Profile Picture
    9 on at
    Sorry, the current permissions prevented the action. (Codeunit, D365 BC API)
    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?
  • Verified answer
    YUN ZHU Profile Picture
    92,292 Super User 2025 Season 2 on at
    Sorry, the current permissions prevented the action. (Codeunit, D365 BC API)
    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

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 4,220

#2
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 3,958

#3
Sumit Singh Profile Picture

Sumit Singh 2,961

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans