【问题标题】:download Azure Service Configuration (.cscfg) through Powershell cmdlet Get-AzureRMDeployment通过 Powershell cmdlet Get-AzureRMDeployment 下载 Azure 服务配置 (.cscfg)
【发布时间】:2023-03-10 17:36:01
【问题描述】:

我正在尝试使用以下命令 powershell 命令从云服务下载服务配置 (.cscfg)。但不幸的是得到了一个错误。

Get-AzureRmDeployment -Name "xxxx"
Get-AzureRmDeployment : Deployment 'xxxx' could not be found.

我选择了正确的订阅,通过了更正的部署名称,但仍然出现此错误。

我尝试使用以下命令获取此订阅上的所有部署,该命令没有返回任何内容,甚至没有返回错误。

Get-AzureRmDeployment

之前我在经典订阅中使用Get-AzureDeployment 来获取.cscfg,它曾经在RM 上完美运行,但上述命令不起作用。

谁能帮我弄清楚如何使用 powershell 获取服务配置...?

命令片段。

PS C:\WINDOWS\system32> Get-AzureRmDeployment -Name "xxxx"
Get-AzureRmDeployment : Deployment 'xxxx' could not be found.
At line:1 char:1
+ Get-AzureRmDeployment -Name "xxxx"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Get-AzureRmDeployment], CloudException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.GetAzureDeploymentCmdlet

【问题讨论】:

    标签: azure powershell cscfg


    【解决方案1】:

    云服务部署为经典(ASM),您无法通过Get-AzureRMDeployment获取部署。

    如果您想通过 ARM powershell 获取 Configuration (.cscfg),可以使用Get-AzureRmResource 获取。

    $slot = Get-AzureRmResource -ResourceGroupName <ResourceGroupName> -ResourceType Microsoft.ClassicCompute/domainNames/slots -ResourceName "xxxxx" -ApiVersion 2016-04-01
    $slot.Properties.configuration
    

    【讨论】:

      【解决方案2】:

      注意:此功能在 ARM cmdlet 中不可用。

      Azure 云服务使用 Azure 服务管理 PowerShell 模块。

      Get-AzureDeployment cmdlet 获取 Azure 经典 (ASM) 部署的详细信息。由于您使用的是云服务,因此它会提供输出。

      Get-AzureRMDeployment cmdlet 获取 Azure 资源管理器 (ARM) 部署的详细信息。

      由于您使用的是云服务,因此它不会提供输出,因为 Azure 云服务使用 ASM 模块而不是 ARM 模块。

      【讨论】:

      • 知道了,但我的订阅是 RM 订阅,因此无法使用 Select-AzureSubscription 命令选择订阅,RMSubscription Get-AzureDeployment 命令不起作用。那么有没有其他方法可以下载此服务配置...?
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-07-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多