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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Calling an OData endpoint on cloud instance of Dynamics 365 for Operations

(0) ShareShare
ReportReport
Posted on by 205

Hello - I am trying to call an OData service on a cloud instance of D365 for operations through a custom .Net app and it requires to provide AAD tenant in URI format. I do have a tenant ID which is not acceptable by the AuthenticationUtility which I obtained from here. Is it possible to get a tenant ID from Azure portal in this format ? or am I missing anything? Did anybody try that? Any help will be appreciated.

Thanks

Fahad Ahmed

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    237,866 Most Valuable Professional on at

    I'm not sure what you mean. If you want an example, the AAD account I usually use when teaching integration is integration@goshoom2.onmicrosoft.com, therefore my ActiveDirectoryTenant is https://login.windows.net/goshoom2.onmicrosoft.com. That's not something to find on LCS.

    Note that it's not enough to change the last part, because the sample app uses windows-ppe.net instead of windows.net - you have to change that too.

  • FahadAhmed Profile Picture
    205 on at

    Hi Martin - Thanks for this tip. I tried this trick by replacing your ActiveDirectoryTenant with my account and it bypassed this error. I realized I also have to provide an ActiveDirectoryClientAppId so I created a webapp in our active directory and provided its app ID in my code. Now it seems like it doesn't recognized that app as I am getting some exception like "Application with Id <xxxx> wasn't found in the direction <xxxx>". I am wondering what could be an issue here. Is there a way to provision another LCS using my personal live account just like we have some free azure credits in Azure portal? I am thinking to try this with another LCS deployment.

  • Verified answer
    Martin Dráb Profile Picture
    237,866 Most Valuable Professional on at

    Having another account in LCS wouldn't resolve anything, you indeed to use the Azure Active Directory, which is associated with AX license. You said you created an app in your directory, which sounds suspicious. Were you able to assign permissions for Dynamics ERP? You won't, if you're in a wrong directory (without AX license).

  • FahadAhmed Profile Picture
    205 on at

    Hi Martin - I apologize for not responding earlier. Got stuck with other issues. I was in the wrong AAD subscription. This issue hasn't been resolved yet. Let me try to further explain. I am following the blog post here to setup a dot net application to call Dev instance of D365 for Ops on cloud. Here is the blog post. 

    http://us.hitachi-solutions.com/blog/how-to-access-dynamics-365-for-operations-data-entities-using-odata-protocol-and-net/ 

    I am setting the following properties in the client configuration class to provide authentication and authorization. 

    UriString = "https://<machineName>.cloudax.dynamics.com/",
    UserName = "<myuser>@axwipfli.onmicrosoft.com",
    Password = "<pwd>",
    ActiveDirectoryResource = "https://<machineName>.cloudax.dynamics.com",
    ActiveDirectoryTenant = "login.windows.net/axwipfli.onmicrosoft.com",
    ActiveDirectoryClientAppId = "<client app ID from AD web app which I created>",
    ActiveDirectoryClientAppSecret = "<value of the generated key in AAD web app>",

    Now I am getting this exception. May be somebody can help with this. So far I am unable to find any working example online. 

    AADSTS70002: The request body must contain the following parameter: 'client_secret or client_assertion'.

  • Suggested answer
    FahadAhmed Profile Picture
    205 on at

    I was able to bypass this error and read and create data by switching my AAD web app to Native app. Since I am creating a console .net application, I think I should have selected the native app while creating an AAD app. Its working now. Thanks for your help on this issue.

  • Andres Lemus Profile Picture
    75 on at

    Thank you FahadAhmed, its works; switching my AAD web app to Native app.

    Adding Required permissions "Dynamics ERP".

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans