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
  • 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
    79,172 Super User 2025 Season 1 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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,274 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,947 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans