如何使用 PowerShell 为已停止的 Azure Web 应用程序禁用 Kudu (SCM)?

How do I disable Kudu (SCM) for a stopped Azure Web App using PowerShell?

如何使用 Az.Websites PowerShell 模块为已停止的 Azure Web 应用程序禁用 Kudu (SCM)?

我试过这个:

$app = Get-AzWebApp -Name $appName
$app.ScmSiteAlsoStopped = $true
Set-AzWebApp -WebApp $app

$app = Get-AzWebApp -Name $appName
$app.ScmSiteAlsoStopped

但它 returns 错误。

您可以通过 Az.Resources 模块执行此操作,请尝试以下命令。

$app = Get-AzResource -ResourceGroupName <ResourceGroupName> -ResourceType Microsoft.Web/sites -ResourceName "<webapp name>"
$app.properties.ScmSiteAlsoStopped = $true
$app | Set-AzResource -Force