functions/Import-AppScanEntFromCSV.ps1
<#
.SYNOPSIS Create AppScan Ent connectors based on a CSV file to be imported. .DESCRIPTION Used to create projects with AppScan Ent connectors, based upon an imported CSV file. .EXAMPLE Import-Import-AppScanEntFromCSV .\myfile.csv #> Function Import-AppScanEntFromCSV { [cmdletbinding()] param( [Parameter(Mandatory=$true)] [string]$CSVFilePath ) $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 = $_.CodeDxProjectName $NewConnectorName = $_.ConfigName $ToolHostURL = $_.ServerURL $APIKey = $_.APIKey $SecretKey = $_.SecretKey $AppID = $_.AppID $ParentProject = $_.ParentProject # Check for Project existence. If not there, create it. $SourcePID = $null $SourcePID = Get-ProjectID $ProjectName If($SourcePID.length -eq 0){ $arrSourcePID = Add-Project $ProjectName $SourcePID = arrSourcePID[0] } #Move Project into parent. Set-ProjectParent $SourcePID $ParentProject $CreateConnector = Add-AppScanConnector $ProjectName $NewConnectorName $ToolHostURL $APIKey $SecretKey $AppID Write-Verbose ( $CreateConnector | Format-Table | Out-String ) } } |