Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.7k views
in Technique[技术] by (71.8m points)

Windows Cryptography Next Generation (CNG) is not supported on this platform PowerShell from AWS-Lambda

Below is the code that I have been trying to get working from a Linux based AWS Lambda that runs PowerShell and/or C#. The code was adapted from this blog that discusses updating credentials programmatically via PowerShell. Locally, I can run this series of code called from a python script using subprocess.Popen with no issues (from a Windows machine). However, AWS is not the same. Needless to say, I have hit a wall when it comes to trying to encrypt credentials in order to make a patch request to the Power BI API (source here: Power BI Documentation). Since we are working in AWS and our deployments are done through Bamboo, the option to compile via C# and then deploy through the CLI is not available so any documentation about CLI isn't of value in this current process.

$credentialDetails = [Microsoft.PowerBI.Api.Models.CredentialDetails]::new(
        $basicCreds, 
            [Microsoft.PowerBI.Api.Models.PrivacyLevel]::Private, 
            [Microsoft.PowerBI.Api.Models.EncryptedConnection]::Encrypted, 
            $credentialsEncryptor)

Trying to run the above code returns:

    b'
GAC    Version        Location
---    -------        --------
False  v4.0.30319     
opt/layer/modules/Microsoft.Rest.ClientRuntime.2.3.22/lxe2x80xa6
False  v4.0.30319     
opt/layer/powershell/Newtonsoft.Json.dll
False  v4.0.30319     
opt/layer/modules/Microsoft.PowerBI.Api.3.20.0/lib/netsxe2x80xa6
Didn't get past creating the 
credential details
"Exception calling \".ctor\" with \"4\" argument(s): \"Windows Cryptography Next 
Generation (CNG) is not supported on this platform.\""
'

You guys have really helped me out with a few issues, this would be clutch if you could provide any valuable insight on how to effectively encrypt credentials to Windows expectations via Linux.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...