janegilring/PIMTools

Dependency with MSAL.PS and Connect-AzureAD

Opened this issue · 0 comments

Hi @janegilring ,
Thank you for creating this module.

However, there is an existing dependency on the already deprecated AzureAD module:

Get-Process C:\Windows\system32> New-AzureADPIMRequest -RoleName 'Global Administrator'
MSAL.PS module required, installing
No active Azure AD session, calling Connect-AzureAD (the login window often hides in the backgroud, minimize the PowerShell window to check if you do not see it)
New-MsalClientApplication : Cannot convert argument "builder", with value: "Microsoft.Identity.Client.PublicClientApplicationBuilder", for "WithDesktopFeatures" to type
"Microsoft.Identity.Client.PublicClientApplicationBuilder" : "Cannot convert the "Microsoft.Identity.Client.PublicClientApplicationBuilder" value of type "Microsoft.Identity.Client.PublicClientApplicationBuilder" 
to type "Microsoft.Identity.Client.PublicClientApplicationBuilder"."
At C:\Users\administrator\Documents\WindowsPowerShell\Modules\MSAL.PS\4.37.0.0\Select-MsalClientApplication.ps1:56 char:29
+ .. . plication = New-MsalClientApplication -ErrorAction Stop @paramNewMsal ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [New-MsalClientApplication], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument, New-MsalClientApplication

PIM elevation for user  failed: Cannot bind argument to parameter 'ResourceId' because it is null.
AzureADPreview\Get-AzureADUser : You must call the Connect-AzureAD cmdlet before calling any other cmdlets.
At C:\Program Files\WindowsPowerShell\Modules\PIMTools\0.9.0\Functions\New-AzureADPIMRequest.ps1:109 char:16
+ .. .  $subject = AzureADPreview\Get-AzureADUser -Filter ("userPrincipalNam ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-AzureADUser], AadNeedAuthenticationException
    + FullyQualifiedErrorId : Microsoft.Open.Azure.AD.CommonLibrary.AadNeedAuthenticationException,Microsoft.Open.AzureAD16.PowerShell.GetUser
 
AzureADPreview\Get-AzureADMSPrivilegedRoleAssignmentRequest : You must call the Connect-AzureAD cmdlet before calling any other cmdlets.
At C:\Program Files\WindowsPowerShell\Modules\PIMTools\0.9.0\Functions\New-AzureADPIMRequest.ps1:116 char:38
+ ... ntRequest = AzureADPreview\Get-AzureADMSPrivilegedRoleAssignmentReque ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-AzureADMSPr...signmentRequest], AadNeedAuthenticationException
    + FullyQualifiedErrorId : Microsoft.Open.Azure.AD.CommonLibrary.AadNeedAuthenticationException,Microsoft.Open.MSGraphBeta.PowerShell.GetAzureADMSPrivilegedRoleAssignmentRequest
 
PIM elevation for user  failed: Cannot bind argument to parameter 'ResourceId' because it is null.

https://learn.microsoft.com/en-us/microsoft-365/enterprise/connect-to-microsoft-365-powershell?view=o365-worldwide#what-do-you-need-to-know-before-you-begin

Regards,
Al