Powershell module add users to application

Hi,

I am trying to figure out how to use the official powershell module to assign a bunch of users to an application.

In our organization, Okta users are added by an integration and sync from Active Directory. The users are already in place, and they are identified by their mail addresses.

I use this code to initialize the script:

$Configuration = Get-OktaConfiguration
$Configuration.BaseUrl = $env:OKTA_PS_ORG_URL
$Configuration.ClientId = $env:OKTA_PS_CLIENT_ID
$Configuration.Scope = “okta.groups.manage okta.apps.manage okta.users.manage”

Then I enable it:

Invoke-OktaEstablishAccessToken

Then I get the list of applications with their ID’s to localize the application I want to assign users to:

Get-OktaApplication -limit 200

Then I have a list with all the users (email addresses) that I want to assign the application to, but I can’t figure out how to do it. Documentation of module is very small, most commands just tell what they are used to, but no examples or instructions, so I am completely lost.

This is very important to me, because I have to assign hundreds of users to dozens of applications, and my company doesn’t want to use groups for this, so it takes me hours and even days and weeks do this work manually.

Thanks

Interesting that they don’t want to use groups to manage these assignments, it would definitely be less of a headache for you to complete them that way!

Can you take a look at Set-OktaUserToApplication and see if that does the trick?

Thanks for the response. Yes, the company has 2 OKTA portals, one in production, which makes use of groups, and one in preview, which is managed in a per user basis.
The Set-OktaUserToApplication has the same problem of all: lack of documentation/examples on how to use, so I am not able to figure how how to use it to assign a user ‘user@domain.com’ to an application which ID is 2345678assrt, to say something.