Hi Team,
I have created my domain on Dynamics 365 site with my username as "Sunil@SunilAgrawal.onmicrosoft.com". I also have done all the steps required to register by app on Azure Portal by following the steps given here (
https://www.c-sharpcorner.com/article/generate-access-token-for-dynamics-365-single-tenant-server-to-server-authentica/).
I also have written the below code given on the above URL. But, I cannot figure out what is my "Dynamics 365 Organization URL".
Would someone please send me the steps to get my "Dynamics 365 Organization URL"?
- public static async Task<string> AccessTokenGenerator()
- {
- string clientId = "Given my ID"; // Your Azure AD Application ID
- string clientSecret = "Given my secret"; // Client secret generated in your App
- string authority = "">login.microsoftonline.com/ceb48f70-0000-1111-0000-9170f6a706a6"; // Azure AD App Tenant ID
- string resourceUrl = "">efrig.crm8.dynamics.com"; // Your Dynamics 365 Organization URL
- var credentials = new ClientCredential(clientId, clientSecret);
- var authContext = new Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext(authority);
- var result = await authContext.AcquireTokenAsync(resourceUrl, credentials);
- return result.AccessToken;
- }