发送交换操作后,我想知道其进度。如何使用Powershell做到这一点?我应该使用Get-AzureRmLog
监视什么事件?我尝试使用$_.resourceid -like "*Microsoft.Web/sites/examplesite" -and $_.OperationName.Value -eq 'Microsoft.Web/sites/write' -and $_.Status.Value -eq 'Succeeded'
检查。工作一次,但现在不工作。见下文。
> Switch-AzureRmWebAppSlot -SourceSlotName qa -DestinationSlotName production
> $r = get-azurermlog -ResourceGroupName examplegrp 3> $null
> $r | select { $_.eventtimestamp,$_.operationname.value,$_.status.value,$_.resourceid.substring(50) }
{2018-07-23 17:10:05, Microsoft.Sql/servers/databases/write, Succeeded, a/resourcegroups/examplegrp/providers/Microsoft.Sql/servers/examplesqlserver/databases/aatDb}
{2018-07-23 17:10:04, Microsoft.Sql/servers/databases/write, Succeeded, a/resourcegroups/examplegrp/providers/Microsoft.Sql/servers/examplesqlserver/databases/prodDb}
{2018-07-23 17:10:04, Microsoft.Sql/servers/databases/write, Succeeded, a/resourcegroups/examplegrp/providers/Microsoft.Sql/servers/examplesqlserver/databases/qaDb}
{2018-07-23 17:09:33, Microsoft.Web/sites/slots/write, Succeeded, a/resourcegroups/examplegrp/providers/Microsoft.Web/sites/examplesite/slots/aat}
{2018-07-23 17:09:27, Microsoft.Sql/servers/write, Succeeded, a/resourcegroups/examplegrp/providers/Microsoft.Sql/servers/examplesqlserver}
{2018-07-23 17:08:52, Microsoft.Sql/servers/write, Succeeded, a/resourcegroups/examplegrp/providers/Microsoft.Sql/servers/examplesqlserver}
{2018-07-23 17:08:17, Microsoft.Web/serverFarms/write, Succeeded, a/resourcegroups/examplegrp/providers/Microsoft.Web/serverFarms/AppServicePlan-example}
{2018-07-23 17:07:53, Microsoft.Web/serverFarms/write, Succeeded, a/resourcegroups/examplegrp/providers/Microsoft.Web/serverFarms/AppServicePlan-example}
{2018-07-23 17:07:51, Microsoft.Storage/storageAccounts/write, Succeeded, a/resourcegroups/examplegrp/providers/Microsoft.Storage/storageAccounts/exampleaatsa}
{2018-07-23 17:00:19, Microsoft.Web/sites/slots/slotsswap/action, Accepted, a/resourceGroups/examplegrp/providers/Microsoft.Web/sites/examplesite/slots/qa}
{2018-07-23 17:00:17, Microsoft.Web/sites/slots/slotsswap/action, Started, a/resourceGroups/examplegrp/providers/Microsoft.Web/sites/examplesite/slots/qa}
在https://docs.microsoft.com/en-us/azure/app-service/web-sites-staged-publishing#automate-with-azure-powershell处建议的解决方案不起作用。 Get-AzureRmLog -ResourceGroup [resource group name] -StartTime [time] -Caller SlotSwapJobProcessor
一无所获。版本:Get-AzureRmLog 5.0.1 AzureRM.Insights。
实际上,在Azure门户上,该组下的“活动”日志中也不显示有用的事件
答案 0 :(得分:1)
尝试下面的命令,它对我而言效果很好。
$a = Get-AzureRmLog -ResourceGroupName <ResourceGroupName> | Where-Object { $_.operationname.value -contains "Microsoft.Web/sites/slots/slotsswap/action" -and $_.Status.Value -eq 'Succeeded'}
$a | select { $_.eventtimestamp,$_.operationname.value,$_.status.value,$_.resourceid.substring(50) }