使用 Powershell 在 Azure 存储中使用 PGP 加密 blob

问题描述

我正在尝试使用 Powershell(项目需要,但不是我的语言)通过 webjob 加密 Azure blob 存储中的一些文件

循环有效,我可以列出以下 blob:

def show_figure(f):
    '''
    Decorator to change fig.show() behavior.
    '''
    def wrapper():
        import matplotlib.pyplot as plt
        f()  # call the original fig.show(),remove this line if there is no need to run fig.show()
        plt.show()

    return wrapper

def plot_foobar():
    # fancy plotting routing in a package
    import matplotlib.pyplot as plt

    fig = plt.figure()
    plt.plot([1,2],[3,4])

    fig.show = show_figure(fig.show)  # assign a decorator

    return fig

# the user invokes the plotting function and gets back the figure object
fig = plot_foobar()
fig.show()

到目前为止的代码..

DIDE HP_Dana_6cb72486-cb9f-4d03-a3c4-0953fd3e2abc.txt
DIDE HP_Dana_c4f9e193-5498-4289-9aae-d76507c2abd7.txt
DIDE/Prime150620210_703b6bcd-179f-40e6-b30b-167ad38eed08.ddi
DIDE/Prime150620211_715f0db1-fb65-4e64-83ed-2a9690ae7c5f.ddi
DIDE/Prime150620212_ebd833c1-aedf-4681-82fd-c4b09dc8da40.ddi
DIDE/Prime150620213_5d88af9d-7d5d-423b-87d8-f6b8c017e2d4.ddi
DIDE/Prime150620215_7f5eed68-b4a1-4b67-b496-f5a0fa7b1156.ddi
DIDE/Prime220620210_75bc1201-7e34-4fe2-8dd7-270ab03526dc.ddi
DIDE/Prime240620210_c48cc859-ebfc-4b2e-858c-3f5cd5764b1a.ddi
DIDE/Prime240620211_9b0373a8-121a-49b6-80e1-19596b1085da.ddi
DIDE/Prime250620210_2ef48e0e-cfeb-413f-a7ec-332706315ce9.ddi
DIDE/Prime260620210_b147f316-2146-4e17-968a-b161282c5b18.ddi
DIDE/Prime290620210_8a978889-643f-47a7-9fc4-b6c58c6fb318.ddi

错误

$context = New-AzureStorageContext -ConnectionString 'DefaultEndpointsProtocol=https;AccountName=stftoscoreyrot001;AccountKey=iSTp3g92fJcmV+FRM4VBxfGsriA9NSIJ2hHpYTQ1idy8mSCfMaqdpb7NdboethfsQzKaT1kcGks9J8wqgOjzrA==;EndpointSuffix=core.windows.net'
$containerName = 'uploadebs'
$Progresspreference = "SilentlyContinue"
$Progresspreference
$blobs = Get-AzureStorageBlob -Container $containerName -Context $context 
$publicKey = $env:Dide_Encryption_Key

 foreach ($blob in $blobs) {     
     if ($blob.Name -match '^DIDE*') {
        $f = $blob.Name
        start-process -FilePath .\GnuPG\bin\gpg.exe "--batch","--quiet","--yes" "-o","d:\home\DIDE\*.gpg","-e","-r",$privateKey,$blob.Name
     }
 }

欢迎任何帮助!

解决方法

在作为参数传递给 "--yes" 的数组中,"-o"Start-Process 之间缺少逗号。如果没有逗号,这将被解释为两个数组而不是一个。

只有第一个数组绑定到参数 -ArgumentList,第二个数组无法绑定并抛出异常。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...