title: Add-AzureADUser Powershell
body: <p>Having issues trying to get my loop grab each member's ObjectID then adding those members into an AD group using the Add-AzureADGroupMember cmdlet. Any help would be great. Thank you</p>
  <pre><code>Import-Module MSOnline
  Import-Module AzureAD
  
  #2Checks for users with admin roles
  
  $RolesCollection = @()
  $Roles = Get-MsolRole
  ForEach ($Role In $Roles){
    $Members = Get-MsolRoleMember -RoleObjectId $Role.ObjectId
    ForEach ($Member In $Members) {
      $data = New-Object PSObject -Property @{
        RoleName = $Role.Name
        MemberName = $Member.DisplayName
        MemberObjectID = $Member.ObjectId
      }
      $RolesCollection += $data
    }
  #Adds users with admin roles into PIM group via member object ID
    forEach ($objectID in $RolesCollection){
  Add-AzureADGroupMember -ObjectId 'removed ObjectID for security concerns' -RefObjectId $($Member.ObjectId)
  }
  }
  </code></pre>