【发布时间】:2021-03-04 01:25:24
【问题描述】:
我构建了一个新的 Azure 管道并添加了这个“Azure CLI”任务来尝试运行一些 Azure CLI Powershell 脚本。首先,我想对现有的 AppInsights 资源进行一些检查。 (Azure CLI) https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/AzureCLIV2/Readme.md
在 Azure CLI 任务中运行“Get-AzApplicationInsights”时出现此错误。
'Get-AzApplicationInsights' : The term 'Get-AzApplicationInsights' is not recognized as the name of a cmdlet, function.
整个 yaml 脚本如下所示:
steps:
- task: AzureCLI@2
displayName: 'Azure CLI Powershell'
inputs:
azureSubscription: ####
scriptType: ps
scriptLocation: inlineScript
inlineScript: |
Write-Output "RESULTS:"
az config set extension.use_dynamic_install=yes_without_prompt
Get-AzApplicationInsights -ResourceGroupName ############# -Name ############## Select-String -Pattern "PricingPlan"
关于无法识别 cmdlet 的原因,我是否遗漏了什么?我应该先导入一个模块吗?
【问题讨论】:
-
您好,如果这个答案有帮助,您会接受它作为答案吗?因此,它可以帮助遇到相同问题的其他社区成员,我们可以存档此线程。谢谢。祝你今天过得愉快。 :)
标签: azure-devops azure-pipelines azure-cli azure-yaml-pipelines