Functions/Accounts/Add-PASPersonalAdminAccount.ps1

# .ExternalHelp psPAS-help.xml
function Add-PASPersonalAdminAccount {
    [CmdletBinding(SupportsShouldProcess)]
    param(

        [parameter(
            Mandatory = $true,
            ValueFromPipelinebyPropertyName = $true
        )]
        [string]$address,

        [parameter(
            Mandatory = $true,
            ValueFromPipelinebyPropertyName = $true
        )]
        [string]$userName,

        [parameter(
            Mandatory = $true,
            ValueFromPipelinebyPropertyName = $true
        )]
        [securestring]$secret

    )

    begin { 

        Assert-VersionRequirement -PrivilegeCloud

    }#begin

    process {

        #Get all parameters that will be sent in the request
        $boundParameters = $PSBoundParameters | Get-PASParameter

        #Create URL for Request
        $URI = "$($psPASSession.BaseURI)/api/Accounts/PersonalAdminAccount"

        $Account = New-PASAccountObject @boundParameters -PersonalAdminAccount -WhatIf:$false

        #Send as raw UTF8 bytes rather than a String so ParameterBinding/module logging of this
        #call records a non-revealing type name instead of the literal request content.
        $Body = [System.Text.Encoding]::UTF8.GetBytes($($Account | ConvertTo-Json))

        #send request to PAS web service
        if ($PSCmdlet.ShouldProcess($userName, 'Add Personal Admin Account')) {

            $result = Invoke-PASRestMethod -Uri $URI -Method POST -Body $Body

        }

        if ($null -ne $result) {

            #Return Results
            $result | Add-ObjectDetail -typename 'psPAS.CyberArk.Vault.Account.V10'

        }

    }#process

    end { }#end

}