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 :
Finance | Project Operations, Human Resources, ...
Answered

Error occurred when executing Get-D365LcsApiToken on tenants in China

(3) ShareShare
ReportReport
Posted on by 156
Dear experts,
The following settings have been made on tenants in China
Error occurred when executing Get-D365LcsApiToken on tenants in China
The command I used is as follows
Get-D365LcsApiToken -ClientId "2f898d80-*******-******" -Username "******@*****.partner.onmschina.cn" -Password "********" -LcsApiUri "https://lcsapi.lcs.dynamics.cn" | Set-D365LcsApiConfig
Categories:
I have the same question (0)
  • Verified answer
    Sohaib Cheema Profile Picture
    49,664 Super User 2026 Season 1 on at
    Hi 
    China Azure has its own endpoints for login/authentication. here is the reference:  https://learn.microsoft.com/en-us/previous-versions/office/office-365-api/api/o365-china-endpoints#azure-openid-connect-and-oauth
     
    You cannot use the command Get-D365LcsApiToken, as your doing reference: https://www.powershellgallery.com/packages/d365fo.tools/0.5.50/Content/functions%5Cget-d365lcsapitoken.ps1
     
    You need to re-engineer the PS, using:
    AADOAuthEndpoint = "https://login.chinacloudapi.cn"'
     
    $LcsApiUri = "https://lcsapi.lcs.dynamics.cn" (I am not sure if Microsoft has a LCS for China as they do for EU. But if not just use normal LCS: https://lcsapi.lcs.dynamics.com/)
     
     
     
  • Hu, Ethan Profile Picture
    156 on at
    I can use Postman to obtain tokens, but when using D365fo.tools, there will still be errors. This command may not be applicable to China
  • Sohaib Cheema Profile Picture
    49,664 Super User 2026 Season 1 on at
    when you use it from Postman, which URL you pass for authentication?
     
    Is that https://login.chinacloudapi.cn or is that something else? how your URL for the call looks like and what is inside the body
  • Hu, Ethan Profile Picture
    156 on at
    The post URL is https://login.chinacloudapi.cn/{tanentid}/oauth2/v2.0/token.
    The parameters in body are set according to Microsoft documentation.

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 April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 804

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 639 Super User 2026 Season 1

#3
Subra Profile Picture

Subra 528

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans