functions/Add-CheckmarxFromCSV.ps1

<#
.SYNOPSIS
Create Checkmarx connectors based on a CSV file to be imported.
  
.DESCRIPTION
Used to create projects with Checkmarx connectors, based upon an imported CSV file.
  
.EXAMPLE
Add-CheckmarxFromCSV .\myfile.csv https://samplehostname.checkmarx.net/ username@domainname.com password1234 $true
  
#>


Function Add-CheckmarxFromCSV
{
    [cmdletbinding()]
    param(
        [Parameter(Mandatory=$true)]
        [string]$CSVFilePath ,   
        [Parameter(Mandatory=$true)]
        [string]$ToolHostURL,
        [Parameter(Mandatory=$true)]
        [string]$ToolUserName,   
        [Parameter(Mandatory=$true)]
        [string]$ToolPassword,
        [Parameter(Mandatory=$false)]
        [boolean]$IncludeOSA    
    )
    
    $CSVArray = Import-Csv $CSVFilePath
    
    $CSVArray | ForEach-Object{
        # Keeping these as separate variables in case we'd like to make them independent or add a prefix later
        $ProjectName = $_.ToolProjectName
        $NewConnectorName = $_.ToolProjectName

        Add-Project $ProjectName
        $CreateConnector = Add-CheckmarxConnector $ProjectName $NewConnectorName $_.ToolProjectName $ToolHostURL $ToolUserName $ToolPassword $_.RefreshTime $IncludeOSA
        Write-Verbose ( $CreateConnector | Format-Table | Out-String )
    }

}