gpt4 book ai didi

powershell - Invoke-WebRequest 在 Azure 自动化中不起作用

转载 作者:行者123 更新时间:2023-12-02 03:27:40 24 4
gpt4 key购买 nike

Invoke-WebRequest 在 Azure 中不起作用。我已在 Powershell ISE 中测试了相同的代码并且它有效。

这是错误:

4/8/2015 9:24:14 AM, Error: Microsoft.PowerShell.Utility\Write-Error : aa00-csmo-t2 - Could not download https://nage1.blob.core.w
indows.net/application/applicationcertificates.7z?sv=2014-02-14&sr=c&sig=ke1lxWQM%3D&se=2016-04-07T06%3A04%3A49Z&sp=r -
At Install-Certificates:168 char:168
+
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId :
Microsoft.PowerShell.Commands.WriteErrorException,Microsoft.PowerShell.Commands.WriteErrorCommand

这是我在 Powershell ISE 中使用的有效代码:

workflow test
{
$ApplicationCertsBlobUrl = 'https://nage1.blob.core.w
indows.net/application/applicationcertificates.7z?sv=2014-02-14&sr=c&sig=ke1lxWQM%3D&se=2016-04-07T06%3A04%3A49Z&sp=r'

$applicationCertsZipFileSource = 'C:\Temp\test.7z'

Invoke-WebRequest $ApplicationCertsBlobUrl -OutFile $applicationCertsZipFileSource
}

我也尝试过:

InlineScript
{
$client = New-Object System.Net.WebClient
$client.DownloadFile($using:ApplicationCertsBlobUrl, $using:applicationCertsZipFileSource)
}

但是我得到了这个异常:

4/8/2015 9:40:14 AM, Error: Exception calling "DownloadFile" with "2" argument(s): "An exception occurred during a WebClient request."
At Install-Certificates:164 char:164
+
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : WebException

最佳答案

我必须将 Invoke-WebRequest 包装在 InlineScript 中。

关于powershell - Invoke-WebRequest 在 Azure 自动化中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29503574/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com