Closed vikashdaya closed 7 years ago
Oy, i should pull that cmdlet out (along with a few others) there is a good deal of overlapping functionality.
if you are trying to perform an update on a user there are 2 things to keep in mind. Are you performing a partial profile update or full profile update. The consequences of the full profile update is that the attributes that you are sending are treated as authoritative and attributes not specified in the update are nullified.
With that said i have a single function that I use to perform user profile updates with a flag to specific if it is a partial or full update.
oktaUpdateUserProfilebyID
a few examples of usage
oktaUpdateUserProfilebyID -partial -uid 00u9olxnq8R71mG1L0h7 -Profile @{mobilePhone='+1 415 321 9876'; state = 'California'}
#Get the current user
$user = oktaGetUserbyID -userName test1
#change the Mobile and state attributes
$user.profile.mobilePhone = '+1 801 321 9876'
$user.profile.state = 'Utah'
#perform updates of attributes
oktaUpdateUserProfilebyID -uid $user.id -Profile $user.profile
oktaUpdateUserProfilebyID -partial -uid 00u9olxnq8R71mG1L0h7 -Profile @{mobilePhone = $null; state = $null}
#Get the current user
$user = oktaGetUserbyID -userName test1
#clear the Mobile and state attributes
$user.profile.mobilePhone = $null
$user.profile.state = $null
#perform updates of attributes
oktaUpdateUserProfilebyID -uid $user.id -Profile $user.profile
Thanks Matt
Unable to use this cmdlet. Can you provide an example of how to use this when multiple profile attributes need to be updated please?