Private/Initialize-Dependencies.ps1
function Global:Initialize-Dependencies { [CmdletBinding()] <# .SYNOPSIS Prompts for login-dialog if not already logged in. .DESCRIPTION The Login-IfNotLoggedIn cmdlet checks if there is already an established Azure-session, otherwise it'll prompt for login. #> param( [array] $NeededModules ) foreach ($module in $NeededModules) { if (-not(Get-Module -Name $module -ListAvailable)) { Write-Host "Installing Module $module..." Install-Module $module -Force -AllowClobber Write-Host "Module $module installed." } } } |