使用 Powershell RM 列出 Azure App Service 的实例

List instances of Azure App Service with Powershell RM

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

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

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

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

Get-AzureRmWebApp -Name "site-name"

任何帮助都会很有帮助。

尝试这样的事情:

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

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

或者您可以使用:

Get-AzWebApp -ResourceGroupName $ResourceGroupName -Name $WebAppName

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