Welcome Forums General PowerShell Q&A Method to obtain O365 group membership via PS script for current AAD user.

Viewing 2 reply threads
  • Author
    Posts
    • #170743
      Participant
      Topics: 1
      Replies: 1
      Points: 20
      Rank: Member

      For local AD you can easily obtain your current group memberships via CLI but for Office 365 \ Azure Active Directory, this seems to require Get-MSOL for pretty much everything.

      That requires the MSOnline Azure module to be installed and when the script runs the user will be visually prompted for O365 credentials.

      Not sure if there’s any way around this.
      Ideally, there would be some sort of credential digest that feeds the currently signed in AAD user credential to MSOL allowing the script to bypass the pop-up.

      Any ideas? Thank you!

    • #170836
      Participant
      Topics: 0
      Replies: 45
      Points: 243
      Helping Hand
      Rank: Participant

      Sets the context and credentials to connect to Microsoft Online and to the Active Directory Federation Services 2.0 server.

      1. if AD FS is still running, use the Set-MsolADFSContext the cmdlet to specify the server on which AD FS is running.

      for example: Set-MsolADFSContext –Computer <ServerName>

      For more information about the Set-MsolADFSContext cmdlet, see [Set-MsolADFSContext][1].

      2. If AD FS is not running, use the Set-MsolDomainAuthentication cmdlet to change the domain to a managed domain.

      for example:

      Set-MsolDomainAuthentication -DomainName <DomainName> -Authentication Managed

      For more info about the Set-MsolDomainAuthentication cmdlet, see [Set-MsolDomainAuthentication][1].

      Hope it helps.

    • #170953
      Participant
      Topics: 1
      Replies: 1
      Points: 20
      Rank: Member

      Hello Evila.
      I ran the Set-MsolDomainAuthentication -DomainName < DomainName> -Authentication Managed command but after closing the PS window and performing a Connect-MsolService the credentials popup is shown again.

      I guess I didn’t mention that I’m looking for a way to make it persistent. (After a reboot)

Viewing 2 reply threads
  • The topic ‘Method to obtain O365 group membership via PS script for current AAD user.’ is closed to new replies.