D365 Business Central : Removing All Web Service Access Keys

Since October 1st 2022, Web Service Access Key is no longer working and you will need to switch to OAuth. If you are still using Web Service Access Key, the following message is displayed when you login to Business Central.

Even if you already switched to OAuth, you can still get the message. This warning notification will still pop up as long as there is at least one user in one of the environments making a successful basic auth call using web service access keys in the last 24 hours. As soon as there’s no more user doing so, the warning will stop. Note that if you have three productions and one is still using basic auth, all users on all environments will still see the warning.

Another way to make sure there is no more call is to just remove all the existing web service access keys from all users. Unfortunately, we will need to do this by going to the user card and remove it one by one.

To make it easy, I have developed an app that will do this. The app basically uses the existing RemoveWebServiceAccessKey procedure on User Card. Here is the source code.

page 60011 "Web Service Key Removal_TNG"
{
    Caption = 'Web Service Access Key Removal';
    PageType = Card;
    ApplicationArea = All;
    UsageCategory = Administration;

    layout
    {
        area(content)
        {
        }
    }

    actions
    {
        area(Processing)
        {
            action(RemovaAllExistingWebServiceKey)
            {
                ApplicationArea = All;
                Caption = 'Remove All Keys';
                ToolTip = 'Remove all existing web service access keys.';
                trigger OnAction()
                var
                    User: Record User;
                    UserCard: Page "User Card";
                    RemoveQst: Label 'This will search all users and remove all existing web service access keys. Do you want to continue ?';
                    RemovedMsg: Label 'All Web Service Access Keys have been removed.';
                begin
                    If not Confirm(RemoveQst, true) then
                        exit;

                    User.FindSet();
                    repeat
                        UserCard.RemoveWebServiceAccessKey(User."User Security ID");
                    until User.Next() = 0;

                    Message(RemovedMsg);
                end;
            }
        }
    }
}

After installing the app, search for Web Service Access Key Removal.

Click Remove All Keys.

Click Yes to Confirm.

That’s it. All web service keys from users are removed.

You can get the app release from the GitHub link.

Source Code available on GitHub as well.

thatnavguy

Experienced NZ-based NAV Developer and Consultant with 15+ years of experience leading multiple IT projects, performing business analyst, developing, implementing, and upgrading Dynamics NAV and Business Central. Passionate to deliver solution that focuses on user-friendly interface while keeping high standard of compliance with the needs.

You may also like...

3 Responses

  1. Gaston says:

    Hi The Nav Guy,

    Thanks for creating this extension! I’ve downloaded it and run it, I got the message confirming the web access keys were removed. Is there any way to verify this process worked? the tool always shows the same message, even after I’ve run it once.

    Thanks in advance

    Gaston

    • thatnavguy says:

      Hi Gaston,

      Unfortunately, there is no way to confirm it because the table data itself is protected in BC SaaS (online).
      The tool runs through every users and remove the key, so it should work (unless you get an error message which is unlikely).

      • Gaston says:

        Hi That Nav Guy,

        I thought I had answered your note, but I see now that I didn’t.
        FYI, the issue persists after I install the extension in all environments and run it. I will let you know what the root cause is once we find it.

        Thanks again.
        Gaston

Leave a Reply

Your email address will not be published. Required fields are marked *