Login Office365 or AzureAD wit Current Credentials.

Welcome Forums General PowerShell Q&A Login Office365 or AzureAD wit Current Credentials.

Viewing 1 reply thread
  • Author
    • #202808
      Topics: 5
      Replies: 6
      Points: 72
      Rank: Member


      Desperately looking for a way to login to Office365 in a Hybrid environment (with an ADFS server).

      I want to write a script that connects to a sharepoint site depending on group membership,

      So it has to log on to O365 group membership retrieve and close session.

      I will need to use the ADFS server to login to O365 using SSO, only how? ūüôĀ

      Is there powershell hero who knows how to accomplish this


    • #205221
      Topics: 1
      Replies: 4
      Points: 22
      Rank: Member

      we too have that sort of environment, but unfortunately as we are a gold microsoft partner we must have 2fa meaning a prompt at all times when doing this.

      Dont know if it will help, but it may get you started:


      $Users = Get-MsolUser -TenantID xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -All
      $LicensedUsers = $Users.islicensed | where {$_ -match 'true'}
      $UnlicensesUsers = $Users.islicensed | where {$_ -match 'false'}
      Get-MsolUser -All | where {$_.isLicensed -eq $true}
      Write-Host 'Licensed Users: ' $LicensedUsers.Count
      Write-Host 'Unlicensed Users: ' $UnlicensesUsers.Count
      This will simply list users split out by license and unlicensed.
      Disclaimer: This is not my own work
      Many Thanks
Viewing 1 reply thread
  • The topic ‘Login Office365 or AzureAD wit Current Credentials.’ is closed to new replies.