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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…