Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⭐️ Microsoft 365 user resource improvements incl. authentication methods #4564

Merged
merged 3 commits into from
Aug 16, 2024

Conversation

chris-rock
Copy link
Member

This PR introduces a new fields for the microsoft.user resource job and contact. Those group the information much better. The old fields are going to be removed in future versions.

cnquery> microsoft.user(userPrincipalName: "chris@example.onmicrosoft.com").contact
microsoft.user.contact: {
  BusinessPhones: [
    0: "Business Phone"
  ]
  city: "City"
  country: "Country"
  email: "super@example.com"
  faxNumber: "+491234656"
  mailNickname: "christest"
  mobilePhone: "Mobile Phone"
  otherMails: []
  postalCode: "Postal Code"
  state: "Province"
  streetAddress: "Street"
}

To see information about the users job description:

cnquery> microsoft.user(userPrincipalName: "chris@example.onmicrosoft.com").job
microsoft.user.job: {
  companyName: "Company Name"
  department: "Department"
  employeeHireDate: null
  employeeId: "12345"
  employeeType: null
  jobTitle: "Job Title"
  officeLocation: "Berlin"
}

Authentication Methods

Along with the user information, we also expose the addition authentication methods for a user:

cnquery> microsoft.user(userPrincipalName: "christest@MondooInc.onmicrosoft.com").authMethods
microsoft.user.authMethods: microsoft.user.authenticationMethods count=4

To get more details you can also expand the resource:

cnquery> microsoft.user(userPrincipalName: "christest@MondooInc.onmicrosoft.com").authMethods { * }
microsoft.user.authMethods: {
  passwordMethods: [
    0: {
      id: "28c10230-6103-485e-b985-444c60001490"
    }
  ]
  fido2Methods: []
  count: 4
  emailMethods: [
    0: {
      emailAddress: "john@doe.com"
      id: "3ddfcfc8-9383-446f-83cc-3ab9be4be18f"
    }
  ]
  microsoftAuthenticator: []
  phoneMethods: [
    0: {
      id: "b6332ec1-7057-4abe-9331-3d72feddfe41"
      phoneNumber: "+49 7453425345"
      ssmSignInState: "notSupported"
      type: "alternateMobile"
    }
    1: {
      id: "3179e48a-750b-4051-897c-87b9720928f7"
      phoneNumber: "+49 8233334444"
      ssmSignInState: "notAllowedByPolicy"
      type: "mobile"
    }
  ]
  windowsHelloMethods: []
  temporaryAccessPassMethods: []
  softwareMethods: []
}

And to verify that all users have a specific factor configured:

microsoft.users.none(authMethods.softwareMethods == empty)

This comment has been minimized.

@chris-rock chris-rock force-pushed the chris-rock/ms365-user-resource branch from e1b8fa9 to 2234964 Compare August 16, 2024 17:58
Copy link
Contributor

Test Results

3 097 tests  ±0   3 096 ✅ ±0   1m 29s ⏱️ -2s
  370 suites ±0       1 💤 ±0 
   28 files   ±0       0 ❌ ±0 

Results for commit 2234964. ± Comparison against base commit 8743e96.

Copy link
Contributor

@misterpantz misterpantz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation is beautiful 🌷

@tas50 tas50 merged commit 895c20e into main Aug 16, 2024
15 checks passed
@tas50 tas50 deleted the chris-rock/ms365-user-resource branch August 16, 2024 19:03
@github-actions github-actions bot locked and limited conversation to collaborators Aug 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants