【问题标题】:Azure Pipelines Modules ConflictAzure 管道模块冲突
【发布时间】:2021-08-26 11:03:02
【问题描述】:

我目前正在尝试通过 Azure Pipelines 运行 powershell 脚本。从 Azure Dev Ops 中的项目运行脚本时,出现以下错误:

WARNING: Both Az and AzureRM modules were detected on this machine. Az and AzureRM modules cannot be imported in the 
same session or used in the same script or runbook. If you are running PowerShell in an environment you control you can
 use the 'Uninstall-AzureRm' cmdlet to remove all AzureRm modules from your machine. If you are running in Azure 
Automation, take care that none of your runbooks import both Az and AzureRM modules. More information can be found 

这是 Azure 托管管道,除了管道定义本身之外,我无法修改加载的模块。在管道定义中,我确实添加了以下内容

- task: PowerShell@2
  inputs:
    targetType: 'inline'
    script: |
      
      Install-Module -Name Az.Accounts 
      
      
      Write-Host "Az Installed"

我仔细检查了我的脚本,它没有使用任何 AzureRM cmdlet,我真的不明白管道从哪里获取 AzureRM 模块,当它不是由管道定义或脚本本身导入时。

谁能解释一下?

BR, 马蒂亚斯

【问题讨论】:

    标签: powershell azure-devops azure-pipelines


    【解决方案1】:

    您需要在 power shell 脚本下运行来安装模块

    Install-Module -Name Az.Accounts -Force -Scope CurrentUser
    

    【讨论】:

      猜你喜欢
      • 2022-10-06
      • 1970-01-01
      • 1970-01-01
      • 2011-01-08
      • 2010-10-24
      • 2012-03-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多