Azure / Microsoft-Defender-for-Cloud

Welcome to the Microsoft Defender for Cloud community repository
https://azure.microsoft.com/en-us/services/security-center/
MIT License
1.7k stars 766 forks source link

D4Storage-PricingEstimation-Per-Storage.ps1 requires az.Storage #830

Open slootsky opened 10 months ago

slootsky commented 10 months ago

Describe the bug script D4Storage-PricingEstimation-Per-Storage.ps1 requires the Az.Storage module, but it isn't listed as a #Requires

To Reproduce try to run the D4Storage-PricingEstimation-Per-Storage.ps1 script without having the az.Storage module installed

receive error

Line | 20 | $storageAccounts = Get-AzStorageAccount -ErrorAction Stop | ~~~~ | The term 'Get-AzStorageAccount' is not recognized as a name of a cmdlet, function, script file, or executable | program. Check the spelling of the name, or if a path was included, verify that the path is correct and try

Expected behavior It should fail earlier with an error that a required module is missing. Similar to how Az.Monitor is warned about

.\D4Storage-PricingEstimation-Per-Storage.ps1 .\D4Storage-PricingEstimation-Per-Storage.ps1: The script 'D4Storage-PricingEstimation-Per-Storage.ps1' cannot be run because the following modules that are specified by the "#requires" statements of the script are missing: Az.Monitor.

Additional context Add any other context about the problem here.

velahuer commented 10 months ago

Edited. @slootsky Can you check if that fixes the issue?