How to Remove All Users from Specific Okta Groups on a Schedule Using Okta Workflows

In this guide:

Okta Workflows guides offer questions and answers from the Okta Workflows community office hours. They also come from the #okta-workflows channel on the Mac Admins Slack, as well as other places. Read all the other guides.

How do you remove all users from specific Okta groups on a schedule using Okta Workflows?

This guide will teach you how to remove all users from two Okta groups on a schedule using Okta Workflows.

Remove users from groups on a schedule

This automation removes all members from two specific Okta groups on a recurring schedule. The automation has 3 flows:

  1. List groups: builds a list of group IDs to process and calls the List group members helper flow for each. In this example, you are removing users from two groups.
  2. List group members: lists all members of a group and streams each member to the Remove user from group helper flow.
  3. Remove user from group: removes a single user from the group.

List groups flow

The List groups flow runs on a schedule and kicks off member removal for each group.

Creates a list of Okta group IDs to process.
Creates a list of Okta group IDs to process.

How the flow works

  1. The Okta-Scheduled Flow card triggers the flow on a recurring schedule.
  2. The List-Construct card creates a list of the two Okta group IDs to process.
  3. The List-For Each card calls the List group members helper flow for each group ID in the list.

List group members flow

The List group members flow lists all members of a group and streams each one to the removal helper flow.

This flow lists all members of a group and streams each one to the removal helper flow.
This flow lists all members of a group and streams each one to the removal helper flow.

How the flow works

  1. The Helper Flow card sets up the Group ID field, passed in from the List groups flow.
  2. The Okta-List Group Members card lists all group members using the streaming option, passing each member to the Remove user from group helper flow along with the Group ID.

Remove user from group flow

The Remove user from group flow removes a single user from the group.

Remove a user from a group.
Remove a user from a group.

How the flow works

  1. Since the main flow uses streaming, the Helper Flow card sets up the Record and State fields.
    • Record: holds the object streamed โ€” the full user object. Here, setting up the ID key extracts the user’s ID from that object.
    • State: holds the extra field(s) configured on the streaming source card, separate from the record itself. Here, it passes the Group ID into the helper flow.
  2. The Okta-Remove User from Group card removes the user from the group, using the User ID from Record and the Group ID from State.

Okta Workflows resources

Leave a Reply

Discover more from Max Katz

Subscribe now to keep reading and get access to the full archive.

Continue reading