Office 365 (Microsoft Graph) Office 365 (Microsoft Graph): Users

Summary

This module contains actions for managing users in Office 365.

Actions

microsoft_graph.users.

create

Create a user.

Minimum Plugin Version: 1.0.0

Input
  • client: a GraphClient

  • display_name: a display name for the user

  • mail_nickname: a mail alias for the user

  • user_principal_name: the User's principal name

  • password: a password to set for the user

  • enabled: set to false to create the user in a disabled state (defaults to true)

  • force_password_change: set to true to force password reset on first logon (defaults to false)

  • force_password_change: set to true to force password reset with MFA on first logon (defaults to false)

Output

Nothing is outputted by this action.

Example
1
2
3
4
5
6
7
8
9
- microsoft_graph.users.create:
    display_name: John Smith
    user_principal_name: john.smith@domain.com
    mail: john.smith@domain.com
    mail_nickname: john.smith
    enabled: true
    password: ""
  load:
    client: graph_secrets

microsoft_graph.users.

delete

Delete a user.

Minimum Plugin Version: 1.0.0

Input
Output

Nothing is outputted by this action.

Example
1
2
3
4
- microsoft_graph.users.delete:
    user_principal_name: john.smith@domain.com
  load:
    client: graph_secrets

microsoft_graph.users.

disable

Disable a user.

Minimum Plugin Version: 1.1.0

Input
Output

Nothing is outputted by this action.

Example
1
2
3
4
- microsoft_graph.users.disable:
    user_principal_name: john.smith@domain.com
  load:
    client: graph_secrets

microsoft_graph.users.

display

Display users in a table.

The table will have the following columns:

  • Display Name
  • User Principal Name
  • Email Address
  • Enabled

Minimum Plugin Version: 1.1.0

Input
  • text: the title of the table

  • users: any number of Users

Output

Nothing is outputted by this action.

Example
1
2
3
4
5
6
7
8
9
- microsoft_graph.users.get_all:
  load:
    client: graph_secrets
  save: users

- microsoft_graph.users.display:
    text: All Users
  load:
    users: users

microsoft_graph.users.

enable

Enable a user.

Minimum Plugin Version: 1.1.0

Input
Output

Nothing is outputted by this action.

Example
1
2
3
4
- microsoft_graph.users.enable:
    user_principal_name: john.smith@domain.com
  load:
    client: graph_secrets

microsoft_graph.users.

get_all

Get all users.

Minimum Plugin Version: 1.0.0

Input
Output

A list of Users.

Example
1
2
3
4
- microsoft_graph.users.get_all:
  load:
    client: graph_secrets
  save: users

microsoft_graph.users.

get_by_id

Get the user with the supplied user ID.

Minimum Plugin Version: 1.0.0

Input
Output

A single User.

Example
1
2
3
4
5
- microsoft_graph.users.get_by_id:
  load:
    user_id: group_member.id
    client: graph_secrets
  save: user

microsoft_graph.users.

get_by_principal_name

Get the user with the supplied user principal name.

Minimum Plugin Version: 1.0.0

Input
Output

A single User.

Example
1
2
3
4
5
- microsoft_graph.users.get_by_principal_name:
    user_principal_name: john.smith@domain.com
  load:
    client: graph_secrets
  save: user

microsoft_graph.users.

get_free_principal_name

Takes a list of user principal names & finds the first that is currently available.

Minimum Plugin Version: 1.1.0

Input
  • client: a GraphClient

  • user_principal_names: a list of userPrincipalNames to check

Output

Either the first available user_principal_name or null if they are all in use.

Example
1
2
3
4
5
6
7
8
- microsoft_graph.users.get_free_principal_name:
    user_principal_names:
      - john.smith@domain.com
      - johnsmith@domain.com
      - j.smith@domain.com
  load:
    client: graph_secrets
  save: available_name

microsoft_graph.users.

select

Display users in a table & prompt the task operator to make a selection.

The table will have the following columns:

  • Display Name
  • User Principal Name
  • Email Address
  • Enabled

Minimum Plugin Version: 1.1.0

Input
  • text: the title of the table

  • users: any number of Users

  • minimum: the minimum number of selections

  • maximum: the maximum number of selections

Output

A Selection containing:

  • total: the number of selected Users

  • all: a list of selected Users

  • first: the first selected User

Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
- microsoft_graph.users.get_all:
  load:
    client: graph_secrets
  save: users

- microsoft_graph.users.select:
    text: Select Users
  load:
    users: users
  save: selection

microsoft_graph.users.

select_one

Display users in a table & prompt the task operator to select one.

The table will have the following columns:

  • Display Name
  • User Principal Name
  • Email Address
  • Enabled

Minimum Plugin Version: 1.1.0

Input
  • text: the title of the table

  • users: any number of Users

Output

A single User.

Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
- microsoft_graph.users.get_all:
  load:
    client: graph_secrets
  save: users

- microsoft_graph.users.select_one:
    text: Select a User
  load:
    users: users
  save: user

microsoft_graph.users.

update

Update one or more attributes for a user.

Minimum Plugin Version: 1.1.0

Input
  • client: a GraphClient

  • user_principal_name: the User's principal name

  • attributes: a dictionary of attribute names & values to set

Valid Attributes

See this Microsoft article for a list of user attributes.

This action will fail if any invalid attributes are supplied.

Output

Nothing is outputted by this action.

Example
1
2
3
4
5
6
7
8
- microsoft_graph.users.update:
    user_principal_name: john.smith@domain.com
    attributes:
      givenName: John
      surname: Smith
      companyName: Acme Corporation
  load:
    client: graph_secrets