<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
0D54z00007D9XnCCAVOkta Classic EngineAdministrationAnswered2024-03-25T13:29:43.000Z2021-09-28T21:07:00.000Z2021-10-02T07:18:17.000Z

0qdxf (0qdxf) asked a question.

Okta Powershell Module to update Proxyaddresses or any other string array profile field

We have made the proxyAddresses AD/O365 attribute sourced from Okta and now I need to bulk add a new email domain to my users. I'm not comfortable with the Okta API but I have some experience with Powershell. I found the Okta Powershell module by Matt Began and with the steps in this Community article (https://support.okta.com/help/s/question/0D50Z00008G7VS5/utilizing-powershell-for-user-reporting-and-modification?language=en_US) I managed to get a list of all my users exported with their proxyAddresses field populated.

 

My challenge is that I can't import that profile field back in. The error makes me think the oktaUpdateUserProfilebyID command doesn't support string arrays.

Image is not available

Is there a trick I'm missing? For my test user the proxyAddresses field in the csv is "SMTP:nicktest.15-x@proddomain.com,smtp:nicktest.15-x@proddomain.agency". Here's my import script which is ripped pretty much wholesale from the article referenced above.

 

$updates = Import-Csv -Path C:\scripts\OktaPSM\testoktaProxyaddresses.csv

foreach ($update in $updates) {

  try {

   $oktauser = oktaGetUserbyID -userName $update.oktaid

  }

  catch {

   Write-Host Get resulted in $_.Exception.Message -BackgroundColor Red

   continue

  }

  $oktauser.profile.proxyAddresses = $update.proxyAddresses

  try {

   $updated = oktaUpdateUserProfilebyID -uid $oktauser.id -Profile $oktauser.profile

  }

  catch {

   Write-Host update resulted in $_.Exception.Message -BackgroundColor Red

   continue

  }

  Write-Host $updated.profile.login proxyAddresses updated to $updated.profile.proxyAddresses

}

 

Appreciate any help and thanks!

-nick


  • User15730008533963521752 (Vendor Management)

    Hi Nick,

     

    Thank you for reaching out in our community portal.

    We would suggest using Okta API for this type of updates, using Postman Runner with our already built in commands.

    You could download and configure postman with Okta as per our documentation bellow:

    https://developer.okta.com/code/rest/

    Import the collection that you would need to use, in this situation it would be users:

    https://developer.okta.com/docs/reference/postman-collections/

    After doing so, just create a new collection with the call that you would need POST > {{url}}/api/v1/users/{{userID}}. Create a csv document containing the variable on the first line, and the values under them, and after that you can load this information in the postman collection runner, selecting both the csv and the collection created, run it and it will query through all the users populated in the csv.

    For more details regarding this you can also check our documentation in the link bellow:

    https://learning.postman.com/docs/running-collections/intro-to-collection-runs/

     

    Thank You,

     

    Andrei Popescu

    Technical Support Engineer

    Okta Global Customer Care

    Expand Post
This question is closed.
Loading
Okta Powershell Module to update Proxyaddresses or any other string array profile field