Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Required modules for Azure connection should be minimized #397

Open
sassdawe opened this issue Jul 28, 2024 · 3 comments
Open

Required modules for Azure connection should be minimized #397

sassdawe opened this issue Jul 28, 2024 · 3 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@sassdawe
Copy link

When connecting to All or Azure services without the necessary modules being preinstalled the error message is generated too broadly:

if ($Service -contains "Azure" -or $Service -contains "All") {
      Write-Verbose "Connecting to Microsoft Azure"
      try {
         Connect-AzAccount -SkipContextPopulation -UseDeviceAuthentication:$UseDeviceCode -Environment $AzureEnvironment
      } catch [Management.Automation.CommandNotFoundException] {
         Write-Host "`nThe Azure PowerShell module is not installed. Please install the module using the following command. For more information see https://learn.microsoft.com/powershell/azure/install-azure-powershell" -ForegroundColor Red
         Write-Host "`Install-Module Az -Scope CurrentUser`n" -ForegroundColor Yellow
      }
   }

Do we need the full Azure PowerShell package or only Az.Accounts?

@sassdawe
Copy link
Author

This can be my first issue 😊

@Snozzberries
Copy link
Contributor

Currently, I believe the only the only cmdlet using Azure is https://github.com/maester365/maester/blob/main/powershell/public/cisa/entra/Test-MtCisaDiagnosticSettings.ps1.

That does use Invoke-AzRestMethod. Assuming future cmdlets would use that method rather than the submodules Az.Accounts would be sufficient.

@merill
Copy link
Contributor

merill commented Aug 4, 2024

@sassdawe yes please go ahead with a PR. Tx!

@f-bader f-bader added good first issue Good for newcomers help wanted Extra attention is needed labels Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants