-
Notifications
You must be signed in to change notification settings - Fork 479
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
Can't import Az modules in AWS PowerShell Lambda #1085
Comments
Hi @techthoughts2, Good afternoon. Could you please share the output of Thanks, |
Sure thing. Attached you can reference the full output log of the Publish command. publish_awspowershelllambda_logs.txt The Lambda publishes to the AWS account without issue. The |
I wanted to add that I updated the Lambda deployment today to the new release of: .NET 6 runtime for AWS Lambda This issue persists with the same behavior with the new configuration: Environment
|
Reproducible using the below minimal code (followed instructions at Deploy PowerShell Lambda functions with .zip file archives): # PowerShell script file to be executed as a AWS Lambda function.
#
# When executing in Lambda the following variables will be predefined.
# $LambdaInput - A PSObject that contains the Lambda function input data.
# $LambdaContext - An Amazon.Lambda.Core.ILambdaContext object that contains information about the currently running Lambda environment.
#
# The last item in the PowerShell pipeline will be returned as the result of the Lambda function.
#
# To include PowerShell modules with your Lambda function, like the AWS.Tools.S3 module, add a "#Requires" statement
# indicating the module and version. If using an AWS.Tools.* module the AWS.Tools.Common module is also required.
##Requires -Modules @{ModuleName='AWS.Tools.Common';ModuleVersion='4.1.15.0'}
#Requires -Modules @{ModuleName='Az.Accounts';ModuleVersion='2.7.2'}
# Uncomment to send the input event to CloudWatch Logs
Write-Host (ConvertTo-Json -InputObject $LambdaInput -Compress -Depth 5)
$PSVersionTable This produces the below error in CloudWatch:
Appears to be a dependency issue |
A workaround is to set the HOME environment variable to /tmp in the lambda configuration |
@jeremybeavon that saved me! However, I also had to set |
We can't do specific work for all available PS modules. Users that run into this issue should rely on the workaround @jeremybeavon and @per-oestergaard mentioned. |
Comments on closed issues are hard for our team to see. |
Description
AWS PowerShell Lambda does not currently permit the use of any cmdlets/functions from an Azure Az module.
Expectation
With an Az module added to a PowerShell Lambda - the module should be able to be successfully imported and functions engaged.
Actual Behavior
Reproduction Steps
#Requires -Modules @{ModuleName='Az.Accounts';ModuleVersion='2.7.2'}
Logs
When adding the Az module to the
#Requires
:As a troubleshooting step I also attempted the following from within the Lambda logic code:
Save-Module
and download an Az module directly from the PSGallery.Import-Module
. This also does not work and results in the following log entries:Environment
7.0.8
dotnetcore3.1
LambdaResolution
I think the issue is something with the
System.IO.IsolatedStorage
as that's the only place I see the "Path1" parameter.Additional mentions of this issue
This is a 🐛 bug-report
The text was updated successfully, but these errors were encountered: