PS C:\Users\Testuser.sailpoint> sail set pat
Personal Access Token Client ID:
Personal Access Token Client Secret:
PS C:\Users\Testuser.sailpoint> Get-DefaultConfiguration
System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry
No clientid set for environment: mytestenv
No clientsecret set for environment: mytestenv
PS C:\Users\Testuser.sailpoint> sail set pat
Personal Access Token Client ID:
Personal Access Token Client Secret:
PS C:\Users\Testuser.sailpoint> Get-DefaultConfiguration
System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry
No clientid set for environment: mytestenv
No clientsecret set for environment: mytestenv
If you’re just wanting to use the PowerShell SDK, you can create a config.json file directly in the directory you’re working in without having to use the CLI to generate a file. If you’re wanting to use the CLI, then you will need to reference: CLI | SailPoint Developer Community which describes the manual configuration of the environment variables.
Considering I work with many different tenants, I utilize the config.json file and have separate sub-directories each with a specific tenant specific configuration file.
Example config.json file (local directory option noted above)
I am very confused here. I have placed config.json file under folder C:\Program Files\PowerShell\6 → config.json but still when I run powershell command I am getting below message:
PS C:\Users\hranjan> Get-DefaultConfiguration
System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry
No clientid set for environment: spdev
No clientsecret set for environment: spdev
I have these folders:
C:\Program Files\PowerShell\6 → config.json
C:\Users\hranjan\Documents\PowerShell\Modules\PSSailpoint\1.1.3
C:\Users\hranjan \ .sailpoint → config.yaml
Could you please help on this issue, I am not able to run any powershell command of Sailpoint
I have Sailpoint CLI installed, some CLI commands are giving output (like sail workflow list) but not all.
Looks like you are missing items from your configuration.
Specifically clientid and client secret. Have you configured a Personal Access Token and put the values into your configuration?
C:\Users\hranjan>sail set pat
Personal Access Token Client ID:
Personal Access Token Client Secret:
C:\Users\hranjan>sail set auth pat
2023/11/25 16:54:56 INFO Authentication method set to PAT
PS C:\Users\hranjan> Get-DefaultConfiguration
Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are
you sure you want to install the modules from ‘PSGallery’?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is “N”): A
WARNING: Version ‘1.0.2’ of module ‘PSYaml’ is already installed at ‘C:\Users\hranjan\Documents\PowerShell\Modules\PSYaml\1.0.2’. To reinstall this version ‘1.0.2’, run Install-Module or Updated-Module cmdlet with the -Force parameter.
System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry
No clientid set for environment: devenv
No clientsecret set for environment: devenv
I tried to use other powershell command like:
PS C:\Users\hranjan> Get-BetaConnectorList
System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry
No clientid set for environment: devenv
No clientsecret set for environment: devenv
ClientId, ClientSecret or TokenUrl Missing. Please provide values in the environment or in ~/.sailpoint/config.yaml
Did you try if after configuration your CLI works? just try to execute sail connectors list - if no exception then you have correctly configured your connection and problem is on powershell side.
You can also use CLI to generate templates for Powershell scripts just execute “sail sdk init powershell” it will create few sample scripts - maybe that would be usefull.
Let me know if the CLI works properly - if yes then we need to search for issues somwhere else.
Thanks Kamil for your response. I tried to run command as per your suggestion and here is the output:
C:\Users\hranjan>sail connectors list
±—±------+
| ID | ALIAS |
±—±------+
±—±------+
ID and ALIAS both are blank.
but some of the sail commands displaying output like
C:\Users\hranjan>sail transform list
±---------------------------------------------------±-------------------------------------+
| NAME | ID |
±---------------------------------------------------±-------------------------------------+
| Demo Transform | 06ee6983-bcb6-4720-a861-0b2ce02f095c |
I’ve just checked how the Get-DefaultConfiguration is checking config and it seems it’s not really compatible with the way how it’s created by the CLI.
Sure, I updated config.yaml file as per your input and when I try ps command Get-DefaultConfiguration I am getting below message:
PS C:\Users\hranjan> Get-DefaultConfiguration
Exception calling “Load” with “1” argument(s): “(Line: 11, Col: 6, Idx: 301) - (Line: 11, Col: 6, Idx: 301): While parsing a block mapping, did not find expected key.”
At C:\Users\hranjan\Documents\PowerShell\Modules\PSYaml\1.0.2\Public\ConvertFrom-Yaml.ps1:13 char:5
$yamlStream.Load([System.IO.TextReader]$stringReader)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : NotSpecified: ( : ) , MethodInvocationException
FullyQualifiedErrorId : SemanticErrorException
You cannot call a method on a null-valued expression.
At C:\Users\hranjan\Documents\PowerShell\Modules\PSYaml\1.0.2\Private\ConvertFrom-YAMLDocument.ps1:43 char:5
$TheTypeOfNode = $TheNode.GetType().Name # determine this
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : InvalidOperation: ( : ) [ ], RuntimeException
FullyQualifiedErrorId : InvokeMethodOnNull
No environments specified in config file
Cannot index into a null array.
At C:\Users\hranjan\Documents\PowerShell\Modules\PSSailpoint\1.1.3\Configuration.ps1:27 char:9
if (!($Configuration.BaseUrl[-1] -eq “/”)) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : InvalidOperation: ( : ) , ParentContainsErrorRecordException
FullyQualifiedErrorId : NullArray
Hi Darren @darrenjrobinson Thanks for your input. I am able to run ps commands for our IDN! I need few inputs on running Sailpoint PS command as I am very new to use API using PS. Here is one use case for me:
I am using one API from Postman which is to fetch one particular workflow execution where status was failed
---> https://mytenant.api.identitynow.com/beta/workflows/{workflowid}/executions?filters=status eq "Failed"
I am looking to use similar API from powershell like → PS C:\Program Files\WindowsPowerShell\Modules\PSSailpoint\1.1.3\beta\src\PSSailpointBeta\Api> Get-BetaWorkflowExecutions {workflowid}
This is giving me complete workflow execution history like I get from postman api, but I am not sure how to apply filter in powershell. Could you please suggest me how can I apply filter in PS command for above case- (like show only status eq failed)
id xxxxxxxxxxxxxxxxxxxxxxxxx
workflowId {workflowid}
requestId xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
startTime 2023-11-27T07:38:40.156508799Z
closeTime 2023-11-27T07:38:41.253593783Z
status Completed
id xxxxxxxxxxxxxxxxxxxxxxxxx
workflowId {workflowid}
requestId xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
startTime 2023-11-27T07:38:40.156508799Z
closeTime 2023-11-27T07:38:41.253593783Z
status Failed
PS C:\Program Files\WindowsPowerShell\Modules\PSSailpoint\1.1.3\beta\src\PSSailpointBeta\Api> Get-BetaWorkflows -status "failed"
Get-BetaWorkflows: A parameter cannot be found that matches parameter name 'status'.
PS C:\Program Files\WindowsPowerShell\Modules\PSSailpoint\1.1.3\beta\src\PSSailpointBeta\Api> Get-BetaWorkflowExecutions {workflowid} filters=status eq "Failed"
Get-BetaWorkflowExecutions: Cannot process argument transformation on parameter 'Limit'. Cannot convert value "filters=status" to type "System.Int32". Error: "The input string 'filters=status' was not in a correct format."
I tried like above but its not working. May be I am not sure how to apply filter in powershell api call
# general setting of the PowerShell module, e.g. base URL, authentication, etc
$Configuration = Get-Configuration
# Configure OAuth2 access token for authorization: UserContextAuth
$Configuration.AccessToken = "YOUR_ACCESS_TOKEN"
# Configure OAuth2 access token for authorization: UserContextAuth
$Configuration.AccessToken = "YOUR_ACCESS_TOKEN"
$Id = "c17bea3a-574d-453c-9e04-4365fbf5af0b" # String | Id of the workflow
$Limit = 250 # Int32 | Max number of results to return. See [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters) for more information. (optional) (default to 250)
$Offset = 0 # Int32 | Offset into the full result set. Usually specified with *limit* to paginate through the results. See [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters) for more information. (optional) (default to 0)
$Count = $true # Boolean | If *true* it will populate the *X-Total-Count* response header with the number of results that would be returned if *limit* and *offset* were ignored. Since requesting a total count can have a performance impact, it is recommended not to send **count=true** if that value will not be used. See [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters) for more information. (optional) (default to $false)
$Filters = "status eq "Failed"" # String | Filter results using the standard syntax described in [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters#filtering-results) Filtering is supported for the following fields and operators: **startTime**: *eq, lt, le, gt, ge* **status**: *eq* (optional)
# List Workflow Executions
try {
$Result = Get-BetaWorkflowExecutions -Id $Id -Limit $Limit -Offset $Offset -Count $Count -Filters $Filters
} catch {
Write-Host ("Exception occurred when calling Get-BetaWorkflowExecutions: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}
This is example from SDK documentation which seems to do exactly what you need with correct syntax
I don’t have any workflows in this environment so here is the commands working against Connectors. And an extra pipe to just return Connector name and status.