Open weyCC81 opened 1 week ago
Heya, thanks for reporting this issue. The 1.4.21 release should resolve the issue :)
Technically this was not really caused by EntraAuth directly - incorrectly providing a body where none belong is really on the calling module. Which in your case is DefenderAPI, another one of mine, so it was going to land on me to fix anyway ;) That said, I decided to handle this issue centrally within EntraAuth, removing the body in PS5 with the incorrect methods (GET, DEFAULT and HEAD), since this is the PS v5.1 command complaining, rather than some APIs, so it's worth handling centrally.
Oh, I also added another feature I needed for another engagement you may find convenient: You can now directly connect with a RefreshToken! While the DefenderAPI module will not natively support that until the next release, this means you can now already do something like this:
# Ensure the module's entra services are registered
Import-Module DefenderAPI
# Interactive delegate login via Browser
$token = Connect-EntraService -Service DefenderAPI.Endpoint -ClientID $clientID -TenantID $tenantID -PassThru
# Use the same token to log into the second service without having to go through the browser again
Connect-EntraService -Service DefenderAPI.Security -RefreshTokenObject $token
Hi @FriedrichWeinmann
Thanks for the fast fix, I can confirm it works with PowerShell ISE now. Have a nice week!
The sign-in (connect) does work with PowerShell 5, but I am not able to request data, for example with "Get-MdExposureScore" or "Get-MdMachine"...
Apparently
Invoke-RestMethod
can not handle empty body's like {} in the parameters: https://github.com/FriedrichWeinmann/EntraAuth/blob/bfc239c163e6a52bc1e3feb71b0f55f18c758467/EntraAuth/functions/Core/Invoke-EntraRequest.ps1#L152I believe we would have to adjust this section: https://github.com/FriedrichWeinmann/EntraAuth/blob/bfc239c163e6a52bc1e3feb71b0f55f18c758467/EntraAuth/functions/Core/Invoke-EntraRequest.ps1#L139
The following workaround after line 145 works for requesting data:
Functions with the following param would have to be validated