azure cli 脚本中的通配符
Wild cards in azure cli script
如何在 azure cli 中使用通配符?
我想在我的 azure cli 脚本中包含以下内容:
$(System.DefaultWorkingDirectory)/**/*.zip
就像现在一样,我的 azure cli 中有以下路径:
$artifactfolder = '$(System.DefaultWorkingDirectory)' + '\_TestApi\drop\TestApi.zip'
那么我怎样才能改用通配符的方法呢?
这是我的 CLI 脚本:
$resourceGroup = "Test"
$appServicePlan = "brajzoreappserviceplan"
$appServiceName = "brajzoreappservice2"
$artifactFolder = Get-ChildItem -Path "$(System.DefaultWorkingDirectory)" + "\**\*.zip"
az webapp deployment source config-zip --resource-group $resourceGroup --name $appServiceName --src $artifactfolder
当我 运行 脚本时出现以下错误:
2021-03-12T07:47:10.5624737Z Get-ChildItem : A positional parameter cannot be found that accepts argument '\**\*.zip'.
2021-03-12T07:47:10.5627860Z At D:\a\_temp\azureclitaskscript1615535200528_inlinescript.ps1:9 char:19
2021-03-12T07:47:10.5629171Z + $artifactFolder = Get-ChildItem -Path "D:\a\r1\a" + "\**\*.zip"
2021-03-12T07:47:10.5630150Z + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-03-12T07:47:10.5630966Z + CategoryInfo : InvalidArgument: (:) [Get-ChildItem], ParentContainsErrorRecordException
2021-03-12T07:47:10.5632192Z + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
2021-03-12T07:47:10.5633181Z
2021-03-12T07:47:10.6016965Z ##[error]Script failed with exit code: 1
如错误所示,它不是可接受的参数“***.zip”。而根据这里的description命令Get-ChildItem
,应该是这样的:
$artifactFolder = Get-ChildItem -Path "$(System.DefaultWorkingDirectory)\*\*\*.zip"
如何在 azure cli 中使用通配符?
我想在我的 azure cli 脚本中包含以下内容:
$(System.DefaultWorkingDirectory)/**/*.zip
就像现在一样,我的 azure cli 中有以下路径:
$artifactfolder = '$(System.DefaultWorkingDirectory)' + '\_TestApi\drop\TestApi.zip'
那么我怎样才能改用通配符的方法呢?
这是我的 CLI 脚本:
$resourceGroup = "Test"
$appServicePlan = "brajzoreappserviceplan"
$appServiceName = "brajzoreappservice2"
$artifactFolder = Get-ChildItem -Path "$(System.DefaultWorkingDirectory)" + "\**\*.zip"
az webapp deployment source config-zip --resource-group $resourceGroup --name $appServiceName --src $artifactfolder
当我 运行 脚本时出现以下错误:
2021-03-12T07:47:10.5624737Z Get-ChildItem : A positional parameter cannot be found that accepts argument '\**\*.zip'.
2021-03-12T07:47:10.5627860Z At D:\a\_temp\azureclitaskscript1615535200528_inlinescript.ps1:9 char:19
2021-03-12T07:47:10.5629171Z + $artifactFolder = Get-ChildItem -Path "D:\a\r1\a" + "\**\*.zip"
2021-03-12T07:47:10.5630150Z + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-03-12T07:47:10.5630966Z + CategoryInfo : InvalidArgument: (:) [Get-ChildItem], ParentContainsErrorRecordException
2021-03-12T07:47:10.5632192Z + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
2021-03-12T07:47:10.5633181Z
2021-03-12T07:47:10.6016965Z ##[error]Script failed with exit code: 1
如错误所示,它不是可接受的参数“***.zip”。而根据这里的description命令Get-ChildItem
,应该是这样的:
$artifactFolder = Get-ChildItem -Path "$(System.DefaultWorkingDirectory)\*\*\*.zip"