I need the AWS module, which is available from the PS-Gallery but when I try to run the install step inside an Azure Function, it doesn\'t work. The -verbose argument flag i
I suspect the reason is that you're not specifying a location for the modules to be loaded from. The current $env:PSModulePath is listed as
WindowsPowerShell\Modules;
D:\Program Files (x86)\WindowsPowerShell\Modules; D:\Windows\system32\WindowsPowerShell\v1.0\Modules\;
d:\Program Files\Microsoft Security Client\MpProvider\;
D:\Program Files\Microsoft Message Analyzer\PowerShell\;
D:\Program Files\WindowsPowerShell\Modules\;
D:\Program Files (x86)\MicrosoftSDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\;
D:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\;
D:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\Storage\
I can't entirely figure out where it is referencing the first from, so I couldn't put them there. So I put this together instead
$env:PSModulePath = $env:PSModulePath + ";d:\home\modules\"
import-module azured
$out = Deploy-Template
[Console]::WriteLine($out)
Out-File -Encoding Ascii $Env:res -inputObject $out
This loads the module (located at d:\home\modules) and works as expected
The reason that Get-PackageProvider -Name nuget -ForceBootstrap doesn't work, is that the PackageManagement module isn't installed. However nuget is already installed. You would need to interact with kudu directly to install packages that way.
I'm glad to see I'm not the only one being driven slightly nuts by functions though ;)