Public/get-AllegisIDNProfileElements.ps1

function get-AllegisIDNProfileElements ($orgname,$profileid,$accesstoken){

    $profileinfo = get-AllegisIDNIdentityProfile -orgName $orgname -profileid $profileid -accessToken $accesstoken

    #$attributename = $identityprofile.attributeConfig.attributeTransform.attributename #name of the IdentityAttribute
    $reference = @()
    $AccountAttribute = @()
    $buildAccountType = @()
    $buildruletype = @()
    $buildreference = @()
    $ruleattribute = @()

    foreach ($identityprofile in $profileinfo.attributeConfig.attributeTransforms)
    {
        $attributename = $null
        $nameoftransform = $null
        $applicationname = $null
        $attributenameSource = $null
        $sourcename = $null
        $typereference = $null
        $applicationId = $null
        $applicationidAccountAttribute = $null

        $attributename = $identityprofile.attributename #name of transform
        $nameoftransform = $identityprofile.attributes.id
        $applicationname = $identityprofile.attributes.input.attributes.applicationName #$source.health.name
        $attributenameSource = $identityprofile.attributes.input.attributes.attributeName
        $sourcename = $identityprofile.attributes.input.attributes.sourceName #$sources.name
        $typereference = $identityprofile.type #reference or accountAttribute
        $applicationId = $identityprofile.attributes.input.attributes.applicationId
        $applicationidAccountAttribute = $identityprofile.attributes.attributes.applicationid
        if ($typereference -eq "reference")
        {
            $reference+= New-Object -TypeName pscustomobject -Property @{
                attributeName = $attributename
                id = $nameoftransform
                applicationName = $applicationname
                attributenameofsource = $attributenameSource
                sourcename = $sourcename
                type = $typereference
                applicationId = $applicationId
            }
        }
        elseif ($typereference -eq "accountAttribute")
        {
            
            $AccountAttribute+= New-Object -TypeName pscustomobject -Property @{
                attributeName = $attributename
                applicationId = $identityprofile.attributes.applicationid
                applicationName = $identityprofile.attributes.applicationname
                attributeNameofsource = $identityprofile.attributes.attributeName
                sourcename = $identityprofile.attributes.sourcename
            }
        }
        elseif ($typereference -eq "rule")
        {
            $ruleattribute+= New-Object -TypeName pscustomobject -Property @{
                attributeName=$identityprofile.attributeName
                id=$identityprofile.attributes.id
                name=$identityprofile.attributes.name
                type=$typereference
            }
        }
    }
    $finalAttributes = $reference + $AccountAttribute + $rule
    return $finalAttributes
}