Can't get Azure Enhanced Profile Microsoft Graph Data

I’ve been trying to access Microsoft Graph data from an Azure enterpise connection. I can access the openid email and profile just fine, I’ve managed to get the groups through use of a rule, but can’t seem to access any Microsoft Graph data.

I’m assuming I need a rule to do this, but I just can’t work it out.

My Rule is as follows:

function (user, context, callback) {
 const namespace1 = '';
  const ns2 = '';
  const namespace = 'myconnection';
		context.idToken[namespace + 'department'] = user.department;
		context.idToken[namespace + 'roles'] = namespace1.roles;
		context.idToken[namespace + 'jobTitle'] = user.jobTitle;
		context.idToken[namespace + 'groups'] = user.groups; // this will add groups to the token
  const assignedRoles = (context.authorization || {}).roles;

  let idTokenClaims = context.idToken || {};
  let accessTokenClaims = context.accessToken || {};

  idTokenClaims[`${namespace1}/role`] = assignedRoles;
  accessTokenClaims[`${namespace1}/role`] = assignedRoles;

  context.idToken = idTokenClaims;
  context.accessToken = accessTokenClaims;
  return callback(null, user, context);

Can anyone point me in the right direction?

Hi andy.chapman

Please check this previous post on getting graph data,
Access Microsoft graph resources with an auth0 login hope this helps!