Public/Configuration/Add-BaselineConfiguration.ps1

function Add-BaselineConfiguration {
    param(
        [Parameter(Mandatory)]
        [string]$TenantId
    )

    try {
        Connect-CustomerGraph -CustomerTenantId $TenantId
        
        $SelectedItems = $script:DefaultConfig.PolicyTypeSettings | Select-Object Type, Name, Description| Out-ConsoleGridView -Title "Select the desired baseline configuration items you want to add" -OutputMode Multiple


        foreach($SelectedItem in $SelectedItems) {
            Write-ModuleLog -Message "Adding baseline configuration item '$($SelectedItem.Name)'.." -Level Info -Component 'BaselineConfiguration'
            Add-BaselinePolicy -TenantId $TenantId -PolicyType $SelectedItem.Type
            Write-ModuleLog -Message "Baseline configuration item '$($SelectedItem.Name)' added." -Level Info -Component 'BaselineConfiguration'
        }
    }
    catch {
        Write-ModuleLog -Message "Failed to create baseline configuration" -ErrorRecord $_ -Level Error -Component 'BaselineConfiguration'
    }
}