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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

Authenticating with Business Central using an Azure Managed Identity

(1) ShareShare
ReportReport
Posted on by 8
Hi all,
 
I'm trying to authenticate an Azure Managed Identity with my organization's instance of Business Central. When I call the API using the token retrieved by the Managed Identity I receive the following payload:
 
{"type":"https://tools.ietf.org/html/rfc9110#section-15.5.2","title":"Unauthorized","status":401,"extensions":{"traceId":"00-0e3ad3db6e522d1656f3ede11a40f23f-d4ee9083ed25d510-01"}}
 
On the Business Central side, I've registered the Managed Identity as a Microsoft Entra Application per the documentation, however, the documentation doesn't mention managed identities. Managed identities don't use redirect URIs so I can't use the grant consent feature in Business Central. I am able to successfully call the API using my user credentials. I've tried applying several different permission scopes in Business Central, including the same permissions my user account has, and I still run into the same problem. I've used this same managed identity to authenticate with other apps, including a Dynamics 365 app powered by the Power Apps. 
 
Have any of you had a similar issue or know of any solutions? Thanks!
I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    99,090 Super User 2026 Season 1 on at
  • BF-28011912-0 Profile Picture
    8 on at
    Thanks ZHU,

    However, I'm not trying to authenticate with Business Central using a Power Platform connector. Rather, I'm trying to connect via an HTTPS request in a python script. An example of the code I'm using is below. 
     
    from azure.identity import DefaultAzureCredential
    import requests
    from requests.auth import AuthBase

    class BearerTokenAuth(AuthBase):
        def __init__(self, token):
            self.token = token
        def __call__(self, r):
            r.headers["Authorization"] = f"Bearer {self.token}"
            return r

    # Set up Azure credentials
    credential = DefaultAzureCredential(
        managed_identity_client_id="<client_id>",
        workload_identity_tenant_id="<tenant_id>",
    )
    # Define the required scope for Business Central API
    bc_scope = "https://api.businesscentral.dynamics.com/.default"
     
    # Get the authentication token
    token = credential.get_token(bc_scope).token
     
    # Define the API endpoint
    endpoint = "https://api.businesscentral.dynamics.com/environments/v1.1"
     
    # Initialize authentication handler

    auth = BearerTokenAuth(token)
    # Make the API request

    response = requests.get(endpoint, auth=auth)

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,993 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,116 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 557 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans