$users.ForEach{
  Try{
    # Find the user to update
    $ADUser = Get-AzureAdUser -SearchString $_.name
    
    # Update the job title
    Set-AzureAdUser -ObjectId $ADUser.ObjectId -JobTitle $_.jobtitle
  }
  Catch{
    Write-Host ("Failed to update " + $($_.name)) -ForegroundColor Red
  }
}