maester
maester copied to clipboard
Required modules for Azure connection should be minimized
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
?