This PowerShell script will disable access to SharePoint online services for all HR department staff
Import-Module MSOnline
$cred = Get-Credential
Connect-MsolOnline -Cred $cred
$licence = New -MsolUserLicenceOptions -AccountSkuID “techshizz:STANDARDPACK”
Get-MsolUser -All -Department “HR” | Set-MsolUserLicence -LicenceOptions $Licence