<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D50Z00008G7UpPSAVOkta Classic EngineIntegrationsAnswered2022-10-04T05:31:56.000Z2016-11-09T13:30:18.000Z2018-03-06T14:14:37.000Z

Ravi Kambam (Customer) asked a question.

Creation of user though powershell without password option and active
I am trying to create the user without password option to authenticate with other SAML provider but not able to. JIT causing issues for me, want to create the user locally and and give them access...any suggestions.

  • Tim L (Customer)

    I stated using the PowerShell Modules that Okta had but quickly got to needing to do things not included in their module. I just started to write my own code because it was easy enough and I could do anything I wanted to do.

    Here is powershell code that does what the Okta example does (this is ran on PowerShell version 4 so if you are on lower versions you may get errors about the headers.

     

    $baseUri = "https://YOURSUBDOMAIN.okta.com/api/v1"

    $token = "APITOKENHERE"

    $headers = @{"Accept"="application/json"; "Content-Type"="application/json"; "Authorization"="SSWS ${token}"}

     

    $body = @{}

    $body['profile'] = @{}

    $body.profile['firstName'] = "Isaac"

    $body.profile['lastName'] = "Brock"

    $body.profile['email'] = "isaac.brock@example.com"

    $body.profile['login'] = "isaac.brock@example.com"

    $body.profile['mobilePhone'] = "555-415-1337"

    $body['credentials'] = @{}

    $body.credentials['provider'] = @{}

    $body.credentials.provider['type'] = "FEDERATION"

    $body.credentials.provider['name'] = "FEDERATION"

     

    "Request body: "

    ConvertTo-Json $body -Depth 100

     

    $response = Invoke-RestMethod -Headers $headers -Method Post -Uri ($baseUri + "/users?provider=true") -Body (ConvertTo-Json $body -Depth 100)

     

    "Response: "

    ConvertTo-Json $response -Depth 100
    Expand Post
This question is closed.
Loading
Creation of user though powershell without password option and active