설명에 따르면 Get-AzureRmResource 명령을 사용하여 웹 응용 프로그램에서 각 인스턴스의 프로세스를 먼저 찾을 수 있습니다. 그런 다음 Remove-AzureRmResource를 사용하여 이러한 프로세스를 중지 할 수 있습니다. 그런 다음 하늘빛 웹 응용 프로그램에 액세스하면 하늘빛은 자동으로 응용 프로그램을 실행하기 위해 새로운 인스턴스의 프로세스를 만듭니다.
자세한 내용은, 당신은 파워 쉘 코드 아래를 참조 수 :
Login-AzureRmAccount
Select-AzureRmSubscription -SubscriptionId '{your subscriptionid}'
$siteName = "{sitename}"
$rgGroup = "{groupname}"
$webSiteInstances = @()
#This gives you list of instances
$webSiteInstances = Get-AzureRmResource -ResourceGroupName $rgGroup -ResourceType Microsoft.Web/sites/instances -ResourceName $siteName -ApiVersion 2015-11-01
$sub = (Get-AzureRmContext).Subscription.SubscriptionId
foreach ($instance in $webSiteInstances)
{
$instanceId = $instance.Name
"Going to enumerate all processes on {0} instance" -f $instanceId
# This gives you list of processes running
# on a particular instance
$processList = Get-AzureRmResource `
-ResourceId /subscriptions/$sub/resourceGroups/$rgGroup/providers/Microsoft.Web/sites/$sitename/instances/$instanceId/processes `
-ApiVersion 2015-08-01
foreach ($process in $processList)
{
if ($process.Properties.Name -eq "w3wp")
{
$resourceId = "/subscriptions/$sub/resourceGroups/$rgGroup/providers/Microsoft.Web/sites/$sitename/instances/$instanceId/processes/" + $process.Properties.Id
$processInfoJson = Get-AzureRmResource -ResourceId $resourceId -ApiVersion 2015-08-01
# is_scm_site is a property which is set
# on the worker process for the KUDU
$computerName = $processInfoJson.Properties.Environment_variables.COMPUTERNAME
if ($processInfoJson.Properties.is_scm_site -ne $true)
{
$computerName = $processInfoJson.Properties.Environment_variables.COMPUTERNAME
"Instance ID" + $instanceId + "is for " + $computerName
"Going to stop this process " + $processInfoJson.Name + " with PID " + $processInfoJson.Properties.Id
# Remove-AzureRMResource finally STOPS the worker process
$result = Remove-AzureRmResource -ResourceId $resourceId -ApiVersion 2015-08-01 -Force
if ($result -eq $true)
{
"Process {0} stopped " -f $processInfoJson.Properties.Id
}
}
}
}
}
결과 :
모든 업데이 트를 내 대답은 도움이/유용하다고 생각합니다. 다른 사람들이 그 혜택을 누릴 수 있도록 답변으로 표시하십시오. –