Public/Resources/New-SIADatabaseStrongAccount.ps1

function New-SIADatabaseStrongAccount {
    <#
    .SYNOPSIS
        Adds a database strong account to SIA.
    .DESCRIPTION
        Calls the Add strong account operation. Adds a new strong account
        (PAM or managed) with account properties based on -StoreType and
        platform. -AccountProperties stays generic because its shape is
        genuinely polymorphic - CyberArk defines a distinct properties schema
        per database platform (PostgreSQL, MySQL, MariaDB, MongoDB, Oracle,
        DB2, WinDomain) plus separate PAM-account and AWS-access-key shapes.
    .PARAMETER StoreType
        Where the strong account is stored: 'pam' for a PAM-vaulted account,
        or 'managed' for an account SIA manages directly.
    .PARAMETER Name
        A display name for the strong account.
    .PARAMETER AccountProperties
        Platform-specific account properties. For a PAM account:
        @{ safe = 'MySafe'; accountName = 'admin@example.com' }.
        For a managed account, the required keys depend on the target
        database platform - see the linked API documentation.
    .EXAMPLE
        New-SIADatabaseStrongAccount -StoreType pam -Name 'MyPAMAccount' `
            -AccountProperties @{ safe = 'MySafe'; accountName = 'admin@example.com' }

        Adds a new database strong account backed by a PAM-vaulted account.
    .INPUTS
        None.
    .OUTPUTS
        psSIA.DatabaseStrongAccount
    .LINK
        https://api-docs.cyberark.com/secure-infra-access/docs/strong-account-apis-for-sia-databases
    #>

    [CmdletBinding(SupportsShouldProcess)]
    [OutputType('psSIA.DatabaseStrongAccount')]
    param(
        [Parameter(Mandatory)]
        [ValidateSet('pam', 'managed')]
        [string]$StoreType,

        [Parameter(Mandatory)]
        [string]$Name,

        [Parameter(Mandatory)]
        [hashtable]$AccountProperties
    )

    if ($PSCmdlet.ShouldProcess($Name, 'Add database strong account')) {
        $body = @{
            storeType         = $StoreType
            name              = $Name
            accountProperties = $AccountProperties
        }
        Invoke-SIARequest -Method POST -Path '/api/database-strong-accounts' -Body $body |
            ConvertFrom-SIAResponse -TypeName 'psSIA.DatabaseStrongAccount'
    }
}