为什么以下powershell-code在我的本地计算机上运行良好,但在Azure自动化Runbook中执行时却失败了?
Get-AzureStorageBlob -Container "workloads" -Prefix "aaa" | Remove-AzureStorageBlob
运行手册-差错消息
Remove-AzureStorageBlob : The input object cannot be bound to any parameters for the command either because the command
does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline
input.
At Remove-CID:116 char:116
+
+ CategoryInfo : InvalidArgument: (Microsoft.Windo...zureStorageBlob:PSObject) [Remove-AzureStorageBlob], ParameterBindingException
+ FullyQualifiedErrorId : InputObjectNotBound,Microsoft.WindowsAzure.Commands.Storage.Blob.RemoveStorageAzureBlobCommand
答案 0 :(得分:0)
笨拙,但它有效
$blobs = Get-AzureStorageBlob -Container $container -Prefix "aaa"
foreach($blob in $blobs)
{
Remove-AzureStorageBlob -Blob $blob.Name -Container $container
}
找到here。