Description | PowerShell Module to download cloud configuration and push it into version control | |
Legal Agreement | By using this CoLab item, you are agreeing to SailPoint’s Terms of Service for our developer community and open-source CoLab. | |
Repository Link | https://github.com/sailpoint-oss/colab-sailpoint-configuration-manager | |
Supported by | Community Developed |
Overview
Powershell module to download the configurations from the SailPoint Identity Security Cloud and manage them in a version control(git). This module enables you to schedule backups, ensuring the preservation of configuration history. The module incorporates built-in Git commands, facilitating configuration management through PowerShell cmdlets.
Version control enhances productivity, facilitates collaboration, and helps ensure the stability and integrity of Identity Security Cloud projects.
Requirements
As of today(01-Feb-2024), Sailpoint configurations are not version-controlled. Only the current configuration state is stored in the Sailpoint tenant.
- Retrieve the configuration from the Sailpoint tenant and store it on your computer.
- Upload your configurations to version control to manage their history.
Guide
To get started with the SailpointConfigManager
prerequisite
1 Powershell module 6.2 and above
2 Sailpoint clientId and Secret
Download
Follow these steps to manually install the PowerShell module:
-
Download Module
Download the source code zip from the most recent release on GitHub. -
Extract the zip
Extract the ZIP file, then open the folder labeled SailpointConfiguration-Vx.x.x, with the x.x.x representing the version you downloaded. -
Move the SailpointConfigManager module folder inside to one of the following locations:
- To install for the Current user:
C:\Users\<username>\Documents\WindowsPowerShell\Modules\
- To install for All users (requires Administrator privileges):
C:\Program Files\WindowsPowerShell\Modules\
-
Import Run
Import-Module SailpointConfigManager
to import the module into the current session. -
To validate that the module is installed, run
Get-Module -ListAvailable SailpointConfigManager
and verify that the module is listed. Additionally, you can runGet-Command -Module SailpointConfigManager
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
- **Import PowerShell Module
Import-Module SailpointConfigManager
- Sailpoint Configuration
$env:SAIL_BASE_URL="https://<tenant>.api.identitynow.com"
$env:SAIL_CLIENT_ID="<client ID>"
$env:SAIL_CLIENT_SECRET="<client secret>"
- Export configuration from the Sailpoint
This cmdlet downloads the configuration from the sailpoint to your computer.
Export-SpConfig -OutputPath "/path/to/your/sailpoint/configuration/folder"
Version control - One-time setup
There are many version control applications available, but one of the most widely used programs is git. If you are new to git, you can learn more here. Setting up a Git repository involves a series of steps, from initializing a new repository to making the initial commit. Here’s a basic guide to help you set up a Git repository:
-
Install Git:
Ensure that Git is installed on your system. You can download and install Git from the official website: Git Downloads. -
Open a Terminal or Command Prompt:
Open a terminal or command prompt on your computer. -
Navigate to Your Project Directory:
Use thecd
command to navigate to the directory where you want to create your Git repository. For example:cd /path/to/your/sailpoint/configuration/folder
-
Initialize a Git Repository:
Run the following command to initialize a new Git repository:git init
This creates a hidden
.git
directory in your project folder, which is where Git stores its internal data and configuration. -
Add Files to the Repository:
Add the files you want to include in the initial commit using the following command:git add .
This command stages all the files in the current directory for the initial commit. You can also specify individual files if needed.
-
Commit the Changes:
git commit -m "Initial commit"
Replace “Initial commit” with a meaningful message describing the changes made in this commit.
-
Create a Remote Repository:
If you want to store your repository on a remote server (like GitHub, GitLab, or Bitbucket), create a new repository on the platform and follow the instructions to link your local repository to the remote one. -
Push to Remote:
Commit the staged changes to the repository with a commit message:
If you’ve created a remote repository, push your local changes to the remote server:git remote add origin <remote-repository-url> git push -u origin master
Replace
<remote-repository-url>
with the URL of your remote repository.
Now, you’ve successfully set up a Git repository, committed your initial changes, and, if applicable, linked it to a remote repository. Adjust these steps based on your specific needs and workflow.
Example snippet: Extract configuration and git push
#Import module
Import-Module SailpointConfigManager
#Configure connection parameters
$env:SAIL_BASE_URL="https://<tenant>.api.identitynow.com"
$env:SAIL_CLIENT_ID="<client ID>"
$env:SAIL_CLIENT_SECRET="<client secret>"
#Path to store configuration
$Outpath = /path/to/your/sailpoint/configuration/folder
Set-Location $Outpath
#git Pull (prerequisite Version control - One time setup )
Invoke-Gitpull
#Download all the configurations
Export-SpConfig -OutputPath $outputpath
#git add
Invoke-GitAdd .
#git commit
Invoke-Gitcommit -Message "New changes"
#Git push
Invoke-Gitpush
Schedule
Schedule the above snippet to frequently pull from your sailpoint tenant and push to the git to maintain the history of all configuration changes in your tenant.
Version Control cmdlets
-
Add Files:
- Add the files you want to track to the version control system. For Git, use
Invoke-GitAdd -Path <file>
.
- Add the files you want to track to the version control system. For Git, use
-
Commit Changes:
- Commit your changes to the version control system, creating a snapshot of the current state. For Git, use
Invoke-GitCommit -Message "Your commit message"
.
- Commit your changes to the version control system, creating a snapshot of the current state. For Git, use
-
Branching:
- Create branches to work on specific features or fixes without affecting the main codebase. For Git, use
Invoke-GitBranch -Name "Branch Name"
andInvoke-GitCheckout -Name "Branch Name
.
- Create branches to work on specific features or fixes without affecting the main codebase. For Git, use
-
Update and Sync:
- Fetch changes from a remote repository and update your local copy. For Git,
Invoke-GitPull
.
- Fetch changes from a remote repository and update your local copy. For Git,
-
Push Changes:
- Upload your local changes to a remote repository to collaborate with others. For Git, use
Invoke-GitPush
.
- Upload your local changes to a remote repository to collaborate with others. For Git, use
-
Pull Requests:
- If using platforms like GitHub or GitLab, create pull requests to propose changes and discuss them before merging.
Invoke-GitPull
- If using platforms like GitHub or GitLab, create pull requests to propose changes and discuss them before merging.