When is it better to pass data to a function in a parameter, and when is it better for the function to just fetch the data itself?
Here's some simplified examples in PowerShell:
Option 1 (give the function what it needs)
function Prompt-LicenseToGrant($availableLicenses)
{
    $selection = Prompt-Menu $availableLicenses
    return $selection
}
$availableLicenses = Get-AvailableLicenses
$licenseToGrant = Prompt-LicenseToGrant $availableLicenses
Grant-License -User $user -License $licenseToGrant
function Prompt-LicenseToRevoke($assignedLicenses)
{
    $selection = Prompt-Menu $assignedLicenses
    return $selection
}
$assignedLicenses = Get-UserLicenses $user
$licenseToRevoke = Prompt-LicenseToRevoke $assignedLicenses
Revoke-License -User $user -License $licenseToRevoke
Option 2 (function just gets what it needs)
function Prompt-LicenseToGrant
{
    $availableLicenses = Get-AvailableLicenses
    $selection = Prompt-Menu $availableLicenses
    return $selection
}
$licenseToGrant = Prompt-LicenseToGrant
Grant-License -User $user -License $licenseToGrant
function Prompt-LicenseToRevoke($user)
{
    $assignedLicenses = Get-UserLicenses $user
    $selection = Prompt-Menu $assignedLicenses
    return $selection
}
$licenseToRevoke = Prompt-LicenseToRevoke $assignedLicenses
Revoke-License -User $user -License $licenseToRevoke
Edit: Some people seem a bit confused about "Prompt-Menu". Just ignore that and pretend that Prompt-LicenseToGrant and Prompt-LicenseToRevoke have their own unique implementation of a menu for the user to select from.
 
                