$adminUrl = ‘https://tenant-admin.sharepoint.com’;

if ($credentials -eq $null)
{
$credentials = Get-Credential
}

Connect-SPOService -Url $adminUrl -Credential $credentials -ErrorAction Stop

$siteUrl = ‘https:// tenant .sharepoint.com/sites/marketing

Set-SPOUser -Site $siteUrl -LoginName ‘username@domain.com’ -IsSiteCollectionAdmin $true