Issues with AzureADPreview Module and PowerShell 7

Welcome Forums General PowerShell Q&A Issues with AzureADPreview Module and PowerShell 7

Viewing 0 reply threads
  • Author
    Posts
    • #263028
      Participant
      Topics: 1
      Replies: 0
      Points: 14
      Rank: Member

      I started using the AzureADPreview module because I wanted a faster way to activate my Privileged Identity Management Azure AD roles. This module has all of the Microsoft Graph support for me to activate and schedule my roles, but I’ve found that I still need to leverage Windows PowerShell for it to work.

      Problem 1: Installing the module with PowerShell 7

      If I try to just simply install the module and load it with PowerShell 7, there are no obvious issues. However, when I try to run Connect-AzureAD, I get this error:

      Problem 2: Importing the module with WinPSCompat

      If I try to import the module using Import-Module -Name AzureADPreview -UseWindowsPowerShell, this seems to resolve the issue for problem 1 (i.e., I can successfully run Connect-AzureAD). However, now I cannot actually create the schedule object required to activate the role. When I try to run New-Object -TypeName Microsoft.Open.MSGraph.Model.AzureADMSPrivilegedSchedule I get this error:

      Here’s a reference to this object and why I’m trying to use it: Open-AzureADMSPrivilegedRoleAssignmentRequest – Example 1

      Problem 3: I cannot solve problem 1 and problem 2 simultaneously

      After encountering problem 2, I went back to problem 1 and found that I can successfully create a schedule object when importing the module without WinPSCompat. So this is ultimately where I’m stuck. I know how I can work around connecting to Azure AD and I know how I can work around the scheduled object, but I don’t know how to handle both and be successful.

      With the release of version 2.0.4-Preview2 of the ExchangeOnlineManagement module that introduces PowerShell 7 support, I’ve been very interested in trying to solve this last problem with Azure AD so that I can leave Windows PowerShell behind for the majority of my daily work. Thank you in advance for your help and support!

      • This topic was modified 1 week, 5 days ago by bmkaiser.
Viewing 0 reply threads
  • You must be logged in to reply to this topic.