You can run the following powershell (this will return all the primary admins of all site collections).

    $sites = Get-SPOSite -Limit All
    $sites | select url,owner


To get all admins Please try below script.

    $spousers = Get-SPOUser -Site https://example.sharepoint.com/sites/training
    
    $spousers | select LoginName, IsSiteAdmin

Read more here: [link][1]


  [1]: https://social.technet.microsoft.com/Forums/sharepoint/en-US/77605167-2c0f-4ec5-81ac-67ead5551ce4/power-shell-script-to-get-primary-site-collection-admin-and-secondary-site-collection-admin-from?forum=onlineservicessharepoint