Login Office365 or AzureAD wit Current Credentials.

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? :frowning:

Is there powershell hero who knows how to accomplish this

 

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