【问题标题】:List instances of Azure App Service with Powershell RM使用 Powershell RM 列出 Azure 应用服务的实例
【发布时间】:2017-04-27 18:12:52
【问题描述】:

我的目标是在 Azure 中找到特定应用服务的所有实例 ID,以便我可以编写一个热身例程并针对所有正在运行的实例 (ARRAfinity) 对其进行测试。

我可以使用 ASM Powershell 执行以下操作,但我需要在 ARM (RM) 中使用它,因为已为其配置了 Octopus。

(Get-AzureWebsite -Name "site-name" -Slot "Production").Instances

我找到了有关 RM 备用的文档,但以下内容对我没有任何帮助:

Get-AzureRmWebApp -Name "site-name"

任何帮助都会非常有帮助。

【问题讨论】:

  • 您是如何使用实例 ID 进行热身的?

标签: powershell azure azure-web-app-service azure-resource-manager octopus-deploy


【解决方案1】:

试试这样的:

Get-AzureRmResource -ResourceGroupName $ResourceGroupName -ResourceType Microsoft.Web/sites/instances -Name $WebAppName -ApiVersion 2016-03-01

另请参阅here 以了解也适用于插槽的辅助函数。

【讨论】:

  • 谢谢大卫 - 正是我想要的
  • 2019 年 9 月更新:您可以使用 Az 模块和具有相同参数的命令 Get-AzResource 来实现相同的结果。
【解决方案2】:

或者你可以使用:

Get-AzWebApp -ResourceGroupName $ResourceGroupName -Name $WebAppName

资源 cmdlet 的运行速度应该比 Get-AzResource (Get-AzureRmResource) 快,尤其是对于繁重的脚本。

【讨论】:

  • 是的,但这没有列出单独的实例
猜你喜欢
  • 1970-01-01
  • 2018-10-19
  • 2015-02-06
  • 1970-01-01
  • 2022-07-12
  • 1970-01-01
  • 2016-02-17
  • 2015-09-16
  • 1970-01-01
相关资源
最近更新 更多