【发布时间】:2018-05-16 15:57:59
【问题描述】:
我正在通过 Visual Studio Teams Services(在线)使用发布管理。我们使用托管构建代理,我真的想避免管理自定义代理的开销。
我确实需要一个项目是 AzureRM PowerShell 模块。高达 5.1.1 的版本是 available on the agent 但我需要 6.0.0。
我想做的是在我的发布过程 (PowerShell) 中使用一个步骤来获取版本 6.0.0 并改用 tart,但是我不能让它工作。我尝试了几种方法都失败了,目前的方法是:
Write-Output "------------------ Install package provider ------------------"
Find-PackageProvider -Name "NuGet" | Install-PackageProvider -Scope CurrentUser -Force
Write-Output "------------------ Remove Modules ------------------"
Get-Module -ListAvailable | Where-Object {$_.Name -like 'AzureRM*'} | Remove-Module
Write-Output "------------------ Install the AzureRM version we want - 6.0.1! ------------------"
Install-Package AzureRM -RequiredVersion 6.0.1 -Scope CurrentUser -Force
Write-Output "------------------ Import AzureRM 6.0.1 ------------------"
Import-Module AzureRM -RequiredVersion 6.0.1
这一切都很好(即不会崩溃......)但是当我尝试使用 6.0.1 cmdlet 之一时,我得到一个错误。
Get-AzureRmADGroup : Azure PowerShell 会话尚未 正确初始化。请导入模块并重试。
知道我哪里出错了,或者我可以用来部署 AzureRM 6.0.1 并在托管代理上使用它的替代策略吗?
【问题讨论】:
标签: powershell azure-devops azure-powershell