Get-Roles no longer working in powershell sdk

I have a script that was working to update the enabled status of a role. The line of code that stopped working is as follows:

$SailPointRole = get-roles -Filters $filterString>

$filterString is the role name. This was working fine. Now when I run it, I get this error:

Invoke-ApiClient: C:\Program Files\WindowsPowerShell\Modules\PSSailpoint\1.3.0\v3\src\PSSailpoint\Api\RolesApi.ps1:584:27
Line |584 |          $LocalVarResult = Invoke-ApiClient -Method ‘GET’ `
|                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Cannot index into a null array.

Has anyone run into this before?

It looks like you’re running version 1.3.0 which was released in April 2024.

For me on these powershell sdk issues my first instinct is to update to the latest version to see if that fixes my issue then troubleshoot further if not.

1.7.22 was released today actually according to the PS Gallery

Understood, but the script was working. Do you really think that will resolve that issue? I’ll give it a shot.

Not necessarily. Just a good practice.

To expand on this, I will point out that there are circumstances where response bodies in V3 API endpoints have changed. Knowing that, it’s possible there was a change at some point in time that needed to be accounted for, so the PS Module was likely updated to address that.

Found the version I think:

image

It seems I didn’t update successfully. However, the script is working today. I need more coffee.

I had to go through the dance of

Install-Module PSSailpoint -scope currentuser -force
Uninstall-Module -name pssailpoint -requiredversion 1.6.6

I was on an older version (go figure) and once I closed and reopened pwsh I was good to go

That error is likely due to the current / working directory you’re in / not in. It’s not able to find the tenant environment details.

Like this:

Just to add, you should also use Get-EnvConfig or Get-DefaultConfiguration to check for the existence of tenant details at the start of your script.

1 Like

Thanks for the help boys!

Beat me to it! I’ve seen that error happen in that circumstance as well