maester365 / maester

The core repository for the Maester module with helper cmdlets that will be called from the Pester tests.
https://maester.dev
MIT License
299 stars 73 forks source link

The Get-SafeLinksPolicy cmdlet uses ExchangePowerShell which isn't installed? #466

Closed NZLostboy closed 2 weeks ago

NZLostboy commented 2 weeks ago

The Get-MtExo function (https://maester.dev/docs/commands/Get-MtExo) has the following command on line 58:

"SafeLinksPolicy" = "Get-SafeLinksPolicy"

Looking at the Get-SafeLinksPolicy cmdlet, it uses the ExchangePowerShell module, and I can't find anywhere where this is installed or referenced currently?

I might be missing something here, but I can't see how this is currently working. I don't think we can use the ExchangePowerShell module as it relies on Windows PowerShell.

This is currently used by Test-MtCisaSafeLink, and I had planned to use it for a new Test-MtCisSafeLink test I am building currently.

Not sure how to proceed here or if I am missing something

Snozzberries commented 2 weeks ago

Connect-ExchangeOnline loads that function.

image

NZLostboy commented 2 weeks ago

Sorry you are right. The issue was the test account I was trying to use didn't have the right license, and I didn't realise.

A shame that it doesn't provide a better error, but its working as intended now thank you.

Snozzberries commented 2 weeks ago

It is a valid point. I would have expected the skipped reason to surface the license gap, did it not?

https://github.com/maester365/maester/blob/main/powershell/public/cisa/exchange/Test-MtCisaSafeLink.ps1#L27

NZLostboy commented 2 weeks ago

It is a valid point. I would have expected the skipped reason to surface the license gap, did it not?

https://github.com/maester365/maester/blob/main/powershell/public/cisa/exchange/Test-MtCisaSafeLink.ps1#L27

It did when I ran the whole function, so the code your talking about is working correctly. The issue was that I was trying the command directly which obviously didn't work, but its not clear that the issue is because of the license and not that the cmdlet doesn't exist.

For reference, if you run Get-SafeLinksPolicy without the right license you get the following error:

Get-SafeLinksPolicy: The term 'Get-SafeLinksPolicy' is not recognized as a name of a cmdlet, function, script file, or executable program.