【发布时间】:2019-05-30 14:40:12
【问题描述】:
我正在尝试从 AzureRM 升级到用于 powershell 的新 Az 模块。我们仍然有多种“遗留”服务管理 API 资源的使用,例如经典的 Azure 云服务,而这些(据我所知)仍然需要使用旧的 Azure powershell 模块。
我已卸载所有 AzureRM 模块,然后安装了新的 Az 模块。但这样做似乎破坏了旧的 Azure 模块。 Azure 模块和 AzureRM 之间似乎存在依赖关系。运行任何服务管理命令,例如“Get-AzureService”,结果如下:
PS C:\WINDOWS\system32> Get-AzureService
Get-AzureService : Exception has been thrown by the target of an invocation.
At line:1 char:1
+ Get-AzureService
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzureService], TargetInvocationException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.HostedServices.GetAzureServiceCommand
我尝试更新到最新的 Azure powershell 模块 (Update-Module Azure)。这似乎也安装了 AzureRM.profile。
由于该模块无法与 Az 模块同时安装/使用,我不知道如何继续。
如果您还想使用新的 Az 模块,是否无法通过 powershell 使用旧的服务管理 API?
【问题讨论】:
-
import-module 并可能指定版本。 start-process 或 invoke-command 或者如果您不能同时导入两者 azure-powershell
-
我建议你将资源从classic迁移到ARM,然后统一使用新的
Az模块,见docs.microsoft.com/en-us/azure/virtual-machines/windows/… -
据我所知,经典云服务无法迁移到ARM。
标签: azure powershell azure-rm az