sailpoint-oss / powershell-sdk

PowerShell Module for accessing SailPoint IdentityNow APIs
https://developer.sailpoint.com/
MIT License
21 stars 15 forks source link

Get-Accounts call fails on some Sources because the underlying API call is returning two 'immutableID' attributes with different casing #41

Closed bradgrutsch closed 1 year ago

bradgrutsch commented 1 year ago

Setup: Powershell SDK connected to a tenant with Azure AD source

Steps to Reproduce:

Run small sample script that calls Get-Accounts and filters for the Azure AD source: Get-Accounts -Filters "sourceId eq ""5d7baaaaaaaaaaaacdf6008d7d41"""

Expected Results: The cmdlet should run and return accounts from that source ID.

Actual Results: The cmdlet returns an error:

ConvertFrom-Json: ...\PowerShell\Modules\PSSailpoint\1.1.1\cc\src\PSSailpointCC\Private\CCApiClient.ps1:269 Line | 269 | return ConvertFrom-Json $Response | ~~~~~~ | Cannot convert the JSON string because it contains keys with different casing. Please use the -AsHashTable | switch instead. The key that was attempted to be added to the existing key 'ImmutableId' was 'immutableId'.

The properties on powershell objects are case insensitive so the ConvertFrom-Json call fails because Azure AD accounts are returning two different attributes that only differ in casing: immutableId and ImmutableId. This seems like it might be a bug in the underlying API call, I can see both immutableId and ImmutableId being returned in the bare /v3/accounts call in postman, and they both have the same value.

tyler-mairose-sp commented 1 year ago

@bradgrutsch,

This is fixed in https://github.com/sailpoint-oss/powershell-sdk/commit/5df140c64e9dde6f6871643df67f7685f79baa99.

I updated the SDK to use the -AsHashTable switch when calling ConvertFrom-Json. This will allow both casings to be present within the PSObject.

Thank you for bringing this to our attention!