mirror of
https://github.com/LukeHagar/developer.sailpoint.com.git
synced 2025-12-10 04:19:42 +00:00
Refactor docusaurus site for Identity Security Cloud
This commit is contained in:
91
docs/tools/sdk/powershell/creating-resources.md
Normal file
91
docs/tools/sdk/powershell/creating-resources.md
Normal file
@@ -0,0 +1,91 @@
|
||||
---
|
||||
id: powershell-sdk-create
|
||||
title: Creating resources with the PowerShell SDK
|
||||
pagination_label: PowerShell SDK
|
||||
sidebar_label: Create a resource
|
||||
sidebar_position: 2
|
||||
sidebar_class_name: powershellsdk
|
||||
keywords: ['powershell', 'sdk', 'create']
|
||||
description: Learn how to create new resources using the PowerShell SDK in this guide.
|
||||
slug: /tools/sdk/powershell/create
|
||||
tags: ['SDK']
|
||||
---
|
||||
|
||||
You can use the SDK to create new resources. These cmdlets will typically start with the `New` keyword.
|
||||
|
||||
To see a list of available create cmdlets, run this command:
|
||||
|
||||
```powershell
|
||||
Get-Command -Module PSSailpoint | where-object {$_.name -like "*New-*" } | Sort-Object Name | Get-Help | Format-Table Name, Synopsis
|
||||
```
|
||||
|
||||
The SDK returns this output (all beta endpoints are designated by the Beta prefix):
|
||||
|
||||
```powershell
|
||||
Name Synopsis
|
||||
---- --------
|
||||
New-AccessProfile Create an Access Profile
|
||||
New-AccessRequest Submit an Access Request
|
||||
New-Account Create Account
|
||||
New-AuthOrgNetworkConfig Create security network configuration.
|
||||
New-BetaAccessProfile Create an Access Profile
|
||||
New-BetaAccessRequest Submit an Access Request
|
||||
New-BetaAccount Create Account
|
||||
New-BetaCampaign Create a campaign
|
||||
New-BetaCampaignTemplate Create a Campaign Template
|
||||
New-BetaCommonAccess Create common access items
|
||||
New-BetaConnectorRule Create Connector Rule
|
||||
New-BetaCustomPasswordI… Create Custom Password Instructions
|
||||
New-BetaDigitToken Generate a digit token
|
||||
New-BetaDomainDkim Verify domain address via DKIM
|
||||
...
|
||||
```
|
||||
|
||||
Here is an example create workgroup script from the beta APIs you can copy into your PowerShell instance to try it out:
|
||||
|
||||
```powershell showLineNumbers
|
||||
$Identity = Get-PublicIdentities -Limit 1
|
||||
|
||||
$JSON = @"
|
||||
{
|
||||
"owner": {
|
||||
"type": "IDENTITY",
|
||||
"id": "$($Identity.id)",
|
||||
"name": "$($Identity.name)"
|
||||
},
|
||||
"name": "DB Access Governance Group",
|
||||
"description": "Description of the Governance Group"
|
||||
}
|
||||
"@
|
||||
|
||||
$WorkGroup = ConvertFrom-BetaJsonToWorkgroupDto -Json $JSON
|
||||
|
||||
$WorkGroup = Initialize-BetaWorkgroupDto -Name "DB Access Governance Group" -Description "Description of the Governance Group" -Owner @{
|
||||
"type" = "IDENTITY"
|
||||
"id" = $Identity.id
|
||||
"name" = $Identity.name
|
||||
}
|
||||
|
||||
New-BetaWorkgroup -WorkgroupDto $WorkGroup
|
||||
```
|
||||
|
||||
The example uses the `Get-PublicIdentities -Limit` cmdlet to pull an identity needed to be the owner of the Workgroup and shows two ways of creating the new WorkGroup to send with the request.
|
||||
|
||||
The first on lines 3-15 initializes a json string then converts the string into a WorkGroup object with `ConvertFrom-BetaJsonToWorkgroupDto`
|
||||
|
||||
The second on lines 17-21 initializes the WorkGroup object by passing in each property of the WorkGroup.
|
||||
|
||||
The WorkGroup will be returned by the SDK:
|
||||
|
||||
```powershell
|
||||
Name Value
|
||||
---- -----
|
||||
description Description of the Governance Group
|
||||
owner {[displayName, Brian Mendoza], [emailAddress, ], [type, IDENTITY], [id, 0003c25c365e492381d4e557b6159f9b]…}
|
||||
memberCount 0
|
||||
connectionCount 0
|
||||
id a241d625-d948-4c41-839e-869b790837a1
|
||||
name DB Access Governance Group
|
||||
created
|
||||
modified
|
||||
```
|
||||
32
docs/tools/sdk/powershell/deleting-resources.md
Normal file
32
docs/tools/sdk/powershell/deleting-resources.md
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
id: powershell-sdk-delete
|
||||
title: Deleting resources with the PowerShell SDK
|
||||
pagination_label: PowerShell SDK
|
||||
sidebar_label: Delete a resource
|
||||
sidebar_position: 4
|
||||
sidebar_class_name: powershellsdk
|
||||
keywords: ['powershell', 'sdk', 'delete']
|
||||
description: Learn how to delete resources using the PowerShell SDK in this guide.
|
||||
slug: /tools/sdk/powershell/delete
|
||||
tags: ['SDK']
|
||||
---
|
||||
|
||||
You can use the SDK to delete resources. These cmdlets will typically start with the `Remove` keyword.
|
||||
|
||||
Here is an example script that searches for the previously created Workgroup by name and calls the delete cmdlet to remove it from your environment.
|
||||
|
||||
```powershell
|
||||
$WorkGroup = Get-BetaWorkgroups -Filters 'name eq "DB Access Governance Group"'
|
||||
|
||||
Remove-BetaWorkgroup -Id $WorkGroup.id -WithHttpInfo
|
||||
```
|
||||
|
||||
Using the [WithHttpInfo Switch](./getting-started.md#withhttpinfo-switch) in the script above, we can verify the operation completed successfully by the 204 status code.
|
||||
|
||||
```powershell
|
||||
Name Value
|
||||
---- -----
|
||||
Response
|
||||
StatusCode 204
|
||||
Headers {[Date, System.String[]], [Connection, System.String[]], [Server, System.String[]], [Vary, System.String[]]…}
|
||||
```
|
||||
45
docs/tools/sdk/powershell/error-handling.md
Normal file
45
docs/tools/sdk/powershell/error-handling.md
Normal file
@@ -0,0 +1,45 @@
|
||||
---
|
||||
id: powershell-sdk-error-handling
|
||||
title: Error Handling with the PowerShell SDK
|
||||
pagination_label: PowerShell SDK
|
||||
sidebar_label: Error Handling
|
||||
sidebar_position: 7
|
||||
sidebar_class_name: powershellsdk
|
||||
keywords: ['powershell', 'sdk', 'error']
|
||||
description: Learn how to delete resources using the PowerShell SDK in this guide.
|
||||
slug: /tools/sdk/powershell/error-handling
|
||||
tags: ['SDK']
|
||||
---
|
||||
|
||||
The SDK uses the Invoke-WebRequest cmdlet to handle HTTP requests. Invoke-WebRequest will throw a terminating error for any response that falls out of the range of 2xx. A non-2xx response will immediately halt the program and produce a stack trace.
|
||||
|
||||
You can use a `try/catch` function to intercept any non success response and take actions on the results, such as logging the message or performing additional actions before exiting the program:
|
||||
|
||||
```powershell
|
||||
# Catch any non 2xx response and log the status code and error message
|
||||
try {
|
||||
Get-Transforms -Filters "id eq"
|
||||
}
|
||||
catch {
|
||||
Write-Host $_.Exception.Response.StatusCode.value__
|
||||
Write-Host $_.ErrorDetails
|
||||
}
|
||||
```
|
||||
|
||||
The `catch` block will handle the error, and the script execution will continue. If you want to stop the scripts execution, include an `Exit` in the `catch` block:
|
||||
|
||||
This code ensures that the `Get-AccessProfiles` cmdlet will never be called:
|
||||
|
||||
```powershell
|
||||
# Catch any non 2xx response and log the status code and error message. Stop the script with the Exit keyword.
|
||||
try {
|
||||
Get-Transforms -Filters "id eq"
|
||||
}
|
||||
catch {
|
||||
Write-Host $_.Exception.Response.StatusCode.value__
|
||||
Write-Host $_.ErrorDetails
|
||||
Exit
|
||||
}
|
||||
|
||||
Get-AccessProfiles
|
||||
```
|
||||
135
docs/tools/sdk/powershell/getting-started.md
Normal file
135
docs/tools/sdk/powershell/getting-started.md
Normal file
@@ -0,0 +1,135 @@
|
||||
---
|
||||
id: powershell-sdk-getting-started
|
||||
title: Getting started with the PowerShell SDK
|
||||
pagination_label: PowerShell SDK
|
||||
sidebar_label: Getting Started
|
||||
sidebar_position: 1
|
||||
sidebar_class_name: powershellsdk
|
||||
keywords: ['powershell', 'sdk', 'start']
|
||||
description: Learn how to use the PowerShell SDK in this guide.
|
||||
slug: /tools/sdk/powershell/getting-started
|
||||
tags: ['SDK']
|
||||
---
|
||||
|
||||
Once your SDK is installed and configured, you can start accessing the SDK's different functionalities. To learn how to install and configure the PowerShell SDK, refer to [Installation and Configuration](./index.mdx).
|
||||
|
||||
To get an idea of what cmdlets the SDK offers run the following command. This command lists all available Get cmdlets within the SDK:
|
||||
|
||||
```powershell
|
||||
Get-Command -Module PSSailpoint | where-object {$_.name -like "*Get-*" } | Sort-Object Name | Get-Help | Format-Table Name, Synopsis
|
||||
```
|
||||
|
||||
The SDK returns this output:
|
||||
|
||||
```powershell
|
||||
Name Synopsis
|
||||
---- --------
|
||||
Get-AccessProfile Get an Access Profile
|
||||
Get-AccessProfileEntitlements List Access Profile's Entitlements
|
||||
Get-AccessProfiles List Access Profiles
|
||||
Get-AccessRequestApprovalSummary Get the number of access-requests-approvals
|
||||
Get-AccessRequestConfig Get Access Request Configuration
|
||||
Get-AccessRequestStatus Access Request Status
|
||||
Get-Account Account Details
|
||||
Get-AccountActivities List Account Activities
|
||||
Get-AccountActivity Get an Account Activity
|
||||
Get-AccountEntitlements Account Entitlements
|
||||
Get-Accounts Accounts List
|
||||
Get-AccountsSchema Downloads source accounts schema template
|
||||
Get-ActiveCampaigns List Campaigns
|
||||
...
|
||||
```
|
||||
|
||||
## List Transforms
|
||||
|
||||
Let's say that you wanted to see all the transforms available in your tenant. You can search for the cmdlet:
|
||||
|
||||
```powershell
|
||||
Get-Command -Module PSSailpoint | where-object {$_.name -like "Get-*Transform*" } | Sort-Object Name | Get-Help | Format-Table Name, Synopsis
|
||||
```
|
||||
|
||||
The SDK returns this output (all beta endpoints are designated by the Beta prefix):
|
||||
|
||||
```powershell
|
||||
Name Synopsis
|
||||
---- --------
|
||||
Get-BetaTransform Transform by ID
|
||||
Get-BetaTransforms List transforms
|
||||
Get-Transform Transform by ID
|
||||
Get-Transforms List transforms
|
||||
```
|
||||
|
||||
To get syntax, description and parameters for a single cmdlet, run this command:
|
||||
|
||||
```powershell
|
||||
Get-Help Get-Transforms -Detailed
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Cmdlet Response</summary>
|
||||
|
||||
```text
|
||||
NAME
|
||||
Get-Transforms
|
||||
|
||||
SYNOPSIS
|
||||
List transforms
|
||||
|
||||
|
||||
SYNTAX
|
||||
Get-Transforms [[-Offset] <Nullable`1>] [[-Limit] <Nullable`1>] [[-Count] <Nullable`1>] [[-Name] <String>] [[-Filters] <String>] [-WithHttpInfo] [<CommonParameters>]
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
Gets a list of all saved transform objects. A token with 'transforms-list read' authority is required to call this API.
|
||||
|
||||
|
||||
PARAMETERS
|
||||
-Offset <Nullable`1>
|
||||
Offset into the full result set. Usually specified with *limit* to paginate through the results. For more information, refer to [V3 API Standard Collection
|
||||
Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters).
|
||||
|
||||
-Limit <Nullable`1>
|
||||
Max number of results to return. For more information, refer to [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters).
|
||||
|
||||
-Count <Nullable`1>
|
||||
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. For more information, refer to [V3 API Standard Collection
|
||||
Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters).
|
||||
|
||||
-Name <String>
|
||||
Name of the transform to retrieve from the list.
|
||||
|
||||
-Filters <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: **internal**: *eq* **name**: *eq, sw*
|
||||
|
||||
-WithHttpInfo [<SwitchParameter>]
|
||||
A switch that, when enabled, will return a hash table of Response, StatusCode and Headers, instead of just the Response.
|
||||
|
||||
<CommonParameters>
|
||||
This cmdlet supports the common parameters: Verbose, Debug,
|
||||
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
|
||||
OutBuffer, PipelineVariable, and OutVariable. For more information, refer to
|
||||
about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
Running `Get-Transforms` will return a list of all transforms in your tenant.
|
||||
|
||||
Running `Get-Transforms -Limit 10 -Filter 'name sw Test"'` will return a list of no more than 10 transforms whose names start with `Test`.
|
||||
|
||||
## WithHttpInfo Switch
|
||||
|
||||
By default, the cmdlets return just the response from the API without including any information about status code or headers returned. Use the `-WithHttpInfo` switch to return this information with the response.
|
||||
|
||||
```powershell
|
||||
Get-Transforms -WithHttpInfo
|
||||
|
||||
Name Value
|
||||
---- -----
|
||||
Headers {[Date, System.String[]], [Transfer-Encoding, System.String[]], [Connection, System.String[]], [Server, System.String[]]…}
|
||||
StatusCode 200
|
||||
Response {System.Management.Automation.OrderedHashtable, System.Management.Automation.OrderedHashtable, System.Management.Automation.Ordered…
|
||||
```
|
||||
200
docs/tools/sdk/powershell/index.mdx
Normal file
200
docs/tools/sdk/powershell/index.mdx
Normal file
@@ -0,0 +1,200 @@
|
||||
---
|
||||
id: powershell-sdk
|
||||
title: PowerShell SDK
|
||||
pagination_label: PowerShell SDK
|
||||
sidebar_label: PowerShell
|
||||
sidebar_position: 3
|
||||
sidebar_class_name: powershellsdk
|
||||
keywords: ['powershell', 'sdk']
|
||||
description: Learn how to use the PowerShell SDK in this guide.
|
||||
slug: /tools/sdk/powershell
|
||||
tags: ['SDK']
|
||||
---
|
||||
|
||||
Read this guide to learn how to use the PowerShell SDK. The PowerShell SDK has some pre-built code examples you can use to learn how to build tools that can interact with IdentityNow.
|
||||
|
||||
## Requirements
|
||||
|
||||
You need the following to use the PowerShell SDK:
|
||||
|
||||
- PowerShell 6.2 or greater. To learn how to install, refer to [Installing PowerShell](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-7.4).
|
||||
|
||||
- Your tenant name in IdentityNow. To learn how to find it, refer to [Getting Started](/idn/api/getting-started#find-your-tenant-name). The SDK will use this tenant name to connect to your IdentityNow instance.
|
||||
|
||||
- A PAT with a client secret and ID. To learn how to create one in IDN, refer to [Personal Access Tokens](https://documentation.sailpoint.com/saas/help/common/api_keys.html#generating-a-personal-access-token). The SDK will use this PAT to authenticate with the SailPoint APIs.
|
||||
|
||||
## Setup
|
||||
|
||||
<details>
|
||||
<summary>CLI Assisted <em>(Recommended)</em></summary>
|
||||
|
||||
The SailPoint CLI offers a few commands that will allow you to quickly get started with the PowerShell SDK. To learn how to install and use the SailPoint CLI, refer to [SailPoint CLI](https://developer.sailpoint.com/idn/tools/cli#get-the-cli).
|
||||
|
||||
Once the CLI is installed and configured, run this command to create a new PowerShell project with the PowerShell SDK:
|
||||
|
||||
```bash
|
||||
sail sdk init powershell
|
||||
```
|
||||
|
||||
Running the command create the structure for your project:
|
||||
|
||||
```text
|
||||
|-- powershell-template
|
||||
| |-- paginate.ps1
|
||||
| |-- paginateAccounts.ps1
|
||||
| |-- patchEntitlement.ps1
|
||||
| |-- sdk.ps1
|
||||
| |-- search.ps1
|
||||
| |-- transform.ps1
|
||||
```
|
||||
|
||||
Run this command to install the required dependencies:
|
||||
|
||||
```powershell
|
||||
Install-Module -Name PSSailpoint
|
||||
```
|
||||
|
||||
The command installs the SailPoint PowerShell SDK module. You will be prompted to confirm that you want to install the module from 'PSGallery'. Enter "A" to say "Yes to All".
|
||||
|
||||
If you already have a version of the PowerShell SDK installed, you can install a new version side-by-side with it by adding the `-Force` parameter to the end of your `Install-Module` commmand:
|
||||
|
||||
```powershell
|
||||
Install-Module -Name PSSailpoint -Force
|
||||
```
|
||||
|
||||
To validate that the module is installed, run this command, `Get-Module -ListAvailable PSSailpoint`, and verify that the module is listed. Additionally, you can run this command, `Get-Command -Module PSSailpoint`, to see the available commands included in the module.
|
||||
|
||||
The SDK is now installed. To learn how to configure the SDK, refer to the [Configure section](#configure).
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Manual Installation</summary>
|
||||
|
||||
### Manually install the SDK
|
||||
|
||||
If access to the PowerShell Gallery isn't available, you can also install the PowerShell SDK manually.
|
||||
|
||||
:::caution
|
||||
|
||||
If you manually install the module on a machine without access to the PowerShell Gallery, you will also need to manually install updates to the SDK.
|
||||
|
||||
:::
|
||||
|
||||
Follow these steps to manually install the PowerShell module:
|
||||
|
||||
1. Download the source code zip from the most recent release on [GitHub](https://github.com/sailpoint-oss/powershell-sdk/releases).
|
||||
2. Open the ZIP file, then open then folder labeled `powershell-sdk-x.x.x`, with the `x.x.x` representing the version you downloaded.
|
||||
3. Extract the `PSSailpoint` module folder inside to one of the following locations:
|
||||
- To install for the Current user: `C:\Users\<username>\Documents\WindowsPowerShell\Modules\PSSailpoint`
|
||||
- To install for All users (requires Administrator privileges): `C:\Program Files\WindowsPowerShell\Modules\PSSailpoint`
|
||||
4. Run `Import-Module PSSailpoint` to import the module into the current session.
|
||||
5. To validate that the module is installed, run `Get-Module -ListAvailable PSSailpoint` and verify that the module is listed. Additionally, you can run `Get-Command -Module PSSailpoint` to see the module's available commands.
|
||||
|
||||
The SDK is now installed. To learn how to configure the SDK, refer to the [Configure section](#configure).
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
## Configure
|
||||
|
||||
You must provide configuration to the SDK so that it can authenticate to your SailPoint tenant and make API calls. To do so, you can use a configuration file, `config.json`, or environment variables.
|
||||
|
||||
### Configuration File
|
||||
|
||||
The SDK requires a configuration file to be named "config.json". Within the file, provide these key/value pairs: `ClientID`, `ClientSecret`, `BaseUrl`.
|
||||
|
||||
<details>
|
||||
<summary>CLI Assisted <em>(Recommended)</em></summary>
|
||||
The SailPoint CLI offers a command to generate the config.json file with your currently configured CLI credentials.
|
||||
|
||||
```bash
|
||||
sail sdk init config
|
||||
```
|
||||
|
||||
If you have multiple environments configured with the CLI, you can pass an additional parameter to state the environment you wish to create a `config.json` for.
|
||||
|
||||
To pass an additional parameter that states the environment you want to configure, run this command:
|
||||
|
||||
```bash
|
||||
sail sdk init config --env devrel
|
||||
```
|
||||
|
||||
#### Example `config.json`
|
||||
|
||||
```json
|
||||
{
|
||||
"ClientID": "g0567b766b413b22c05c66e75d532f1b",
|
||||
"ClientSecret": "cabd0e950a7230b63c1ff45be33fb22065b382b6251a73c61177a8bb5482fcc7",
|
||||
"BaseUrl": "https://[tenant].api.identitynow.com"
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Manual Configuration</summary>
|
||||
|
||||
Create a file named "config.json", and provide these key/value pairs: `ClientID`, `ClientSecret`, `BaseUrl`.
|
||||
|
||||
#### Example `config.json`
|
||||
|
||||
```json
|
||||
{
|
||||
"ClientID": "g0567b766b413b22c05c66e75d532f1b",
|
||||
"ClientSecret": "cabd0e950a7230b63c1ff45be33fb22065b382b6251a73c61177a8bb5482fcc7",
|
||||
"BaseUrl": "https://[tenant].api.identitynow.com"
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
:::warning
|
||||
Please ensure this file is ignored in your version control system (ex. .gitignore for git)
|
||||
:::
|
||||
|
||||
### Environment variable configuration
|
||||
|
||||
You can also store your configuration in environment variables.
|
||||
|
||||
To get your environment variables to persist across terminal sessions, add these exports to your shell profile, something like `~/.bash_profile`.
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
<Tabs>
|
||||
<TabItem value="linux_mac" label="Linux/Mac" default>
|
||||
|
||||
```bash
|
||||
export SAIL_BASE_URL=https://[tenant].api.identitynow.com
|
||||
export SAIL_CLIENT_ID=[clientID]
|
||||
export SAIL_CLIENT_SECRET=[clientSecret]
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="windows" label="Windows PowerShell">
|
||||
|
||||
```bash
|
||||
$env:SAIL_BASE_URL=https://[tenant].api.identitynow.com
|
||||
$env:SAIL_CLIENT_ID=[clientID]
|
||||
$env:SAIL_CLIENT_SECRET=[clientSecret]
|
||||
```
|
||||
|
||||
To get your environment variables to persist across PowerShell sessions, run these commands instead:
|
||||
|
||||
```powershell
|
||||
[System.Environment]::SetEnvironmentVariable('SAIL_BASE_URL','https://[tenant].api.identitynow.com')
|
||||
[System.Environment]::SetEnvironmentVariable('SAIL_CLIENT_ID','[clientID]')
|
||||
[System.Environment]::SetEnvironmentVariable('SAIL_CLIENT_SECRET','[clientSecret]')
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
## Discuss
|
||||
|
||||
You can use this SDK to build new tools that extend your IDN platform and improve experiences across your organization. Use this guide to get started, and if you have questions, don't hesitate to reach out on the SailPoint Developer Community forum at https://developer.sailpoint.com/discuss!
|
||||
|
||||
## Getting Started
|
||||
|
||||
To get started using the SDK, refer to the [Getting Started Guide](./getting-started.md).
|
||||
48
docs/tools/sdk/powershell/pagination.md
Normal file
48
docs/tools/sdk/powershell/pagination.md
Normal file
@@ -0,0 +1,48 @@
|
||||
---
|
||||
id: powershell-sdk-pagination
|
||||
title: Paginate results with the PowerShell SDK
|
||||
pagination_label: PowerShell SDK
|
||||
sidebar_label: Paginate Results
|
||||
sidebar_position: 5
|
||||
sidebar_class_name: powershellsdk
|
||||
keywords: ['powershell', 'sdk', 'paginate']
|
||||
description: Learn how to paginate results using the PowerShell SDK in this guide.
|
||||
slug: /tools/sdk/powershell/paginate
|
||||
tags: ['SDK']
|
||||
---
|
||||
|
||||
By default, your requests will return a maximum of 250 records. To return more, you must implement pagination. To learn more about pagination, refer to [Paginating Results](/idn/api/standard-collection-parameters/#paginating-results).
|
||||
|
||||
Pagination is implemented with the SDK in the following code block on line 8:
|
||||
|
||||
```powershell showLineNumbers
|
||||
$Parameters = @{
|
||||
"Filters" = 'name co "Andrew"'
|
||||
}
|
||||
|
||||
# Accounts List
|
||||
try {
|
||||
|
||||
Invoke-Paginate -Function "Get-Accounts" -Increment 250 -Limit 1000 -InitialOffset 0 -Parameters $Parameters
|
||||
|
||||
} catch {
|
||||
Write-Host $_
|
||||
Write-Host ("Exception occurred when calling {1}: {0}" -f ($_.ErrorDetails | ConvertFrom-Json), "Get-Accounts")
|
||||
Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
The `Invoke-Paginate` cmdlet takes a few paramters. The first is the cmdlet you wish to call.
|
||||
|
||||
The `-Function` specifies the name of the cmdlet you wish to call. This only works on list endpoints.
|
||||
|
||||
The `-Increment` specifies the number of results returned in each call to the endpoint. Defaults to 250.
|
||||
|
||||
The `-Limit` specifies the total number of results you can return, 1000.
|
||||
|
||||
The `-Parameters` specifies a hashtable of additional values passed to the API endpoint. You would use this for `filters`, `sorters`, and any other query parameters.
|
||||
|
||||
You can also provide an `-InitialOffset` value to specify the record number to start the request on. For example, you can provide add `-InitialOffset 10` to start getting accounts from 11 instead of 0.
|
||||
|
||||
To find out whether an endpoint supports pagination, refer to its documentation. Any API supporting pagination lists the optional query parameters detailed in [Paginating Results](/idn/api/standard-collection-parameters/#paginating-results).
|
||||
24
docs/tools/sdk/powershell/retries.md
Normal file
24
docs/tools/sdk/powershell/retries.md
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
id: powershell-sdk-retries
|
||||
title: Retries with the PowerShell SDK
|
||||
pagination_label: PowerShell SDK
|
||||
sidebar_label: Retries
|
||||
sidebar_position: 6
|
||||
sidebar_class_name: powershellsdk
|
||||
keywords: ['powershell', 'sdk', 'retry']
|
||||
description: Learn how to configure retries using the PowerShell SDK in this guide.
|
||||
slug: /tools/sdk/powershell/retries
|
||||
tags: ['SDK']
|
||||
---
|
||||
|
||||
|
||||
The SDK supports retry logic in the case of an unexpected error. You have these two retry configuration options:
|
||||
|
||||
* MaximumRetryCount - How many times to retry the request. Default is 10 retries.
|
||||
* RetryIntervalSeconds - How many seconds to wait between retries. Default is 5 seconds.
|
||||
|
||||
The following code will tell the SDK to retry 2 times after an unexpected error and wait 3 seconds between retries.
|
||||
|
||||
```powershell
|
||||
Set-DefaultConfiguration -MaximumRetryCount 2 -RetryIntervalSeconds 3
|
||||
```
|
||||
88
docs/tools/sdk/powershell/search.md
Normal file
88
docs/tools/sdk/powershell/search.md
Normal file
@@ -0,0 +1,88 @@
|
||||
---
|
||||
id: powershell-sdk-search
|
||||
title: Search with the PowerShell SDK
|
||||
pagination_label: PowerShell SDK
|
||||
sidebar_label: Search
|
||||
sidebar_position: 5
|
||||
sidebar_class_name: powershellsdk
|
||||
keywords: ['powershell', 'sdk', 'search']
|
||||
description: Learn how to search using the PowerShell SDK in this guide.
|
||||
slug: /tools/sdk/powershell/search
|
||||
tags: ['SDK']
|
||||
---
|
||||
|
||||
The PowerShell SDK provides you access to IdentityNow's [Search](https://documentation.sailpoint.com/saas/help/search/index.html) functionality.
|
||||
|
||||
Here is an example search you can copy into your PowerShell instance to try it out:
|
||||
|
||||
```powershell
|
||||
$Json = @"
|
||||
{
|
||||
"indices": [
|
||||
"identities"
|
||||
],
|
||||
"query": {
|
||||
"query": "\"john.doe\"",
|
||||
"fields": [
|
||||
"name"
|
||||
]
|
||||
}
|
||||
}
|
||||
"@
|
||||
|
||||
$Search = ConvertFrom-JsonToSearch -Json $Json
|
||||
|
||||
try {
|
||||
Search-Post -Search $Search
|
||||
} catch {
|
||||
Write-Host ("Exception occurred when calling Search-Post: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
|
||||
Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
|
||||
}
|
||||
```
|
||||
|
||||
This example request uses the [Perform Search endpoint](/idn/api/v3/search-post) to search your tenant for identities with the name "john.doe".
|
||||
|
||||
### Paginate search results
|
||||
|
||||
You can paginate your search results to get records past the default limit of 10000. With pagination, you can get as many records as you want.
|
||||
|
||||
Use the syntax shown in this example to paginate your search results:
|
||||
|
||||
```powershell
|
||||
$JSON = @"
|
||||
{
|
||||
"indices": [
|
||||
"identities"
|
||||
],
|
||||
"query": {
|
||||
"query": "*",
|
||||
"fields": [
|
||||
"name"
|
||||
]
|
||||
},
|
||||
"sort": [
|
||||
"-displayName"
|
||||
]
|
||||
}
|
||||
"@
|
||||
|
||||
$Search = ConvertFrom-JsonToSearch -Json $JSON
|
||||
|
||||
try {
|
||||
|
||||
Invoke-PaginateSearch -Increment 5000 -Limit 150000 -Search $Search
|
||||
|
||||
} catch {
|
||||
Write-Host $_
|
||||
Write-Host ("Exception occurred when calling {1}: {0}" -f ($_.ErrorDetails | ConvertFrom-Json), "Paginate-Search")
|
||||
Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
|
||||
}
|
||||
```
|
||||
|
||||
This example searches your IdentityNow tenant for all identities and sorts them by their `displayName` in descending order. The search returns a maximum of 150000 records (the `Limit`) and 5000 records per page (the `Increment`).
|
||||
|
||||
To paginate the search results, you can specify these parameters:
|
||||
|
||||
- `-Increment`: The number of records to return per page.
|
||||
- `-Limit`: The maximum number of records to return per request. The default is 10000.
|
||||
- `-Offset`: The number of the first record to return with the request. The default is 0.
|
||||
74
docs/tools/sdk/powershell/updating-resources.md
Normal file
74
docs/tools/sdk/powershell/updating-resources.md
Normal file
@@ -0,0 +1,74 @@
|
||||
---
|
||||
id: powershell-sdk-patch
|
||||
title: Updating resources with the PowerShell SDK
|
||||
pagination_label: PowerShell SDK
|
||||
sidebar_label: Update a resource
|
||||
sidebar_position: 3
|
||||
sidebar_class_name: powershellsdk
|
||||
keywords: ['powershell', 'sdk', 'update']
|
||||
description: Learn how to update resources using the PowerShell SDK in this guide.
|
||||
slug: /tools/sdk/powershell/update
|
||||
tags: ['SDK']
|
||||
---
|
||||
|
||||
You can use the SDK to update resources. These cmdlets will typically start with the `Update` keyword.
|
||||
|
||||
To see a list of available create cmdlets, run this command:
|
||||
|
||||
```powershell
|
||||
Get-Command -Module PSSailpoint | where-object {$_.name -like "*Update-*" } | Sort-Object Name | Get-Help | Format-Table Name, Synopsis
|
||||
```
|
||||
|
||||
The SDK returns this output (all beta endpoints are designated by the Beta prefix):
|
||||
|
||||
```powershell
|
||||
Name Synopsis
|
||||
---- --------
|
||||
Update-AccessProfile Patch a specified Access Profile
|
||||
Update-Account Update Account
|
||||
Update-AuthOrgNetworkConfig Update security network configuration.
|
||||
Update-AuthUser Auth User Update
|
||||
Update-BetaAccessProfile Patch a specified Access Profile
|
||||
Update-BetaAccount Update Account
|
||||
Update-BetaCampaign Update a Campaign
|
||||
Update-BetaCampaignTemplate Update a Campaign Template
|
||||
Update-BetaCommonAccessSta… Bulk update common access status
|
||||
Update-BetaConnectorRule Update a Connector Rule
|
||||
Update-BetaEntitlement Patch an entitlement
|
||||
Update-BetaEntitlementsInB… Bulk update an entitlement list
|
||||
Update-BetaEntitlementsPot… Edit entitlements for a potential rol…
|
||||
Update-BetaFormDefinition Patch a form definition.
|
||||
Update-BetaFormInstance Patch a form instance.
|
||||
Update-BetaIdentityProfile Update the Identity Profile
|
||||
Update-BetaLifecycleStates Update Lifecycle State
|
||||
...
|
||||
```
|
||||
|
||||
Here is an example update WorkGroup script which will update the description for the previously created Workgroup from [Create a Resource](./creating-resources.md):
|
||||
|
||||
```powershell
|
||||
$WorkGroup = Get-BetaWorkgroups -Filters 'name eq "DB Access Governance Group"'
|
||||
|
||||
$WorkGroupUpdate = [PSCustomObject]@{
|
||||
op = "replace"
|
||||
path = "/description"
|
||||
value = "This is an updated description for the workgroup."
|
||||
}
|
||||
|
||||
Update-BetaWorkgroup -Id $WorkGroup.id -JsonPatchOperation $WorkGroupUpdate
|
||||
```
|
||||
|
||||
The updated WorkGroup will be returned by the SDK:
|
||||
|
||||
```powershell
|
||||
Name Value
|
||||
---- -----
|
||||
description This is an updated description for the workgroup.
|
||||
owner {[displayName, Brian Mendoza], [emailAddress, ], [type, IDENTITY], [id, 0003c25c365e492381d4e557b6159f9b]…}
|
||||
memberCount 0
|
||||
connectionCount 0
|
||||
id a241d625-d948-4c41-839e-869b790837a1
|
||||
name DB Access Governance Group
|
||||
created 12/1/2023 5:39:23 PM
|
||||
modified 12/1/2023 5:39:23 PM
|
||||
```
|
||||
Reference in New Issue
Block a user