Skip to content

Instantly share code, notes, and snippets.

@secpg
Last active August 7, 2018 17:42
Show Gist options
  • Save secpg/b1ee30e4b832f2a23c53fd3514b716cf to your computer and use it in GitHub Desktop.
Save secpg/b1ee30e4b832f2a23c53fd3514b716cf to your computer and use it in GitHub Desktop.

Revisions

  1. secpg revised this gist Aug 7, 2018. 1 changed file with 9 additions and 11 deletions.
    20 changes: 9 additions & 11 deletions PoSh_CCP_CertAuth_Imported.ps1
    Original file line number Diff line number Diff line change
    @@ -1,19 +1,17 @@
    #### ####
    ## ##
    # This script will call the CCP using client certificate authentication #
    # Pulls the cert from the local machine/personal store. No PW needed #
    # This script will call the CCP using client certificate authentication #
    # Pulls the cert from the local user/personal store. No PW needed #
    ## ##
    #### ####

    # Declare Variables
    $BASEURL="____"
    $APPID="____"
    $SAFE="____"
    $FOLDER="____"
    $OBJECT="____"

    # Retrieve Certificate
    $CERT = Get-ChildItem -Path Cert:\LocalMachine\My\<cert thumbprint>
    $BASEURL="___" #example: "https://pvwa.cyberark.com"
    $SAFE="___" #CyberArk Safe name
    $APPID="___" #CyberArk Application ID
    $FOLDER="Root" #CyberArk Safe Folder - Default=Root
    $OBJECT="___" #CyberArk object "Name"
    $THUMBPRINT="___" #CA certificate "Thumbprint" value in cert details

    # Call the CCP
    Invoke-RestMethod -Uri "$BASEURL/AIMWebService/api/Accounts?AppID=$APPID&Safe=$SAFE&Folder=$FOLDER&Object=$OBJECT" -Method Get -CertificateThumbprint $CERT.Thumbprint
    Invoke-RestMethod -Uri "$BASEURL/AIMWebService/api/Accounts?AppID=$APPID&Safe=$SAFE&Folder=$FOLDER&Object=$OBJECT" -Method Get -CertificateThumbprint $THUMBPRINT
  2. secpg created this gist Aug 6, 2018.
    19 changes: 19 additions & 0 deletions PoSh_CCP_CertAuth_Imported.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    #### ####
    ## ##
    # This script will call the CCP using client certificate authentication #
    # Pulls the cert from the local machine/personal store. No PW needed #
    ## ##
    #### ####

    # Declare Variables
    $BASEURL="____"
    $APPID="____"
    $SAFE="____"
    $FOLDER="____"
    $OBJECT="____"

    # Retrieve Certificate
    $CERT = Get-ChildItem -Path Cert:\LocalMachine\My\<cert thumbprint>

    # Call the CCP
    Invoke-RestMethod -Uri "$BASEURL/AIMWebService/api/Accounts?AppID=$APPID&Safe=$SAFE&Folder=$FOLDER&Object=$OBJECT" -Method Get -CertificateThumbprint $CERT.Thumbprint