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
    Posts
    • #202808
      Participant
      Topics: 4
      Replies: 4
      Points: 56
      Rank: Member

      Hi

      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
      Participant
      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:

       

      Connect-MsolService
      $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
      POC
Viewing 1 reply thread
  • You must be logged in to reply to this topic.