Hi,
I want to get data from CRM account from external HTML page and JS by Azure Active Directory.
1. Can you please guide me to connect Azure with Dynamics CRM?
2. How to get Client ID from Azure??
3. How to get Tenant (The name of the Azure AD organization) from Azure?
Here I am calling external HTML page.
var organizationURI = "***"; //The URL to connect to CRM (online)
var tenant = "***.onmicrosoft.com"; //The name of the Azure AD organization you use
var clientId = "***"; //The ClientId you got when you registered the application
var pageUrl = "***"; //The URL of this page in your development environment when debugging.
var endpoints = {
orgUri: organizationURI
};
window.config = {
tenant: tenant,
clientId: clientId,
postLogoutRedirectUri: pageUrl,
endpoints: endpoints,
cacheLocation: 'localStorage', // enable this for IE, as sessionStorage does not work for localhost.
};
function authenticate() {
//OAuth context
authContext = new AuthenticationContext(config);
// Check For & Handle Redirect From AAD After Login
var isCallback = authContext.isCallback(window.location.hash);
if (isCallback) {
authContext.handleWindowCallback();
}
var loginError = authContext.getLoginError();
if (isCallback && !loginError) {
window.location = authContext._getItem(authContext.CONSTANTS.STORAGE.LOGIN_REQUEST);
}
else {
errorMessage.textContent = loginError;
}
user = authContext.getCachedUser();
}
function login() {
authContext.login();
}
*This post is locked for comments
Hi Chhaya,
var tenant = "[xxx.onmicrosoft.com]", so in you case if org name is 'org' and your region is 'US' then it will be org.crm.dynamics.com.
Just copy this from your crm url.
var clientId = "[client id]"; //The ClientId you got when you registered the application
In the new portal, the ApplicationID is the same as Client ID. However the URL i mentioned should be following using classic azure portal i.e. https://manage.windowsazure.com
Let me know if you need further clarification.
Thanks,
Prateek
Thanks Prateek!
Actually I'm confuse in "Tenant" and "ClientId". I don't know what should I pass in "tenant" and "ClientId"
Can you please guide me for above 2 parameters?
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156