I am trying to retrieve the user object by ID using Node.js. Here is my code:
const MsRest = require('ms-rest-azure');
const credentials = await MsRest.loginWithServicePrincipalSecret(keys.appId, keys.pass, keys.tenantId, { tokenAudience: 'graph' });
const GraphkManagementClient = require('azure-graph');
const client = new GraphkManagementClient(credentials, subscriptionId);
return client.users.get(principalID);
But client.users.get(principalID)
produces a request that returns:
Request_BadRequest: Invalid domain name in the request url
This is the url it produces (with the true values instead of {tenant id} and {user id}):
https://graph.windows.net/{tenant id}/users/{user id}?api-version=1.6