我使用以下 powershell 命令通过 (Az) PowerShell 将诊断设置添加到 LogicApp,但是,在资源的诊断设置中没有创建任何内容。
$LogicApp = "/subscriptions/dc4e35b0-3a98-41a6-86a0-e83de3d06b2e/resourceGroups/Lieblik/providers/Microsoft.Logic/workflows/logic-lieblik-sitepoolingscheduler"
$Workspace = Get-AzOperationalInsightsWorkspace -Name "BO-Crayon-LAW" -ResourceGroupName "commonservices"
New-AzDiagnosticSetting -ResourceId $LogicApp -WorkspaceId $Workspace.ResourceId -Name "DiagMonitor"
我等了几个小时来检查是否是由于延迟造成的,但没有运气!.
下面是对我有用的
script
:
$RithResourceId = "/subscriptions/b83c84c23f/resourceGroups/vbojja/providers/Microsoft.Logic/workflows/rith6"
$RithWorkspc = Get-AzOperationalInsightsWorkspace -Name "rit54-workspacename" -ResourceGroupName "rgname"
$RithWkId= $RithWorkspc.ResourceId
$DiagnosticSettingName = "RithTesting"
$rithmetrics = New-AzDiagnosticSettingMetricSettingsObject -Enabled $true -Category AllMetrics
New-AzDiagnosticSetting -Name $DiagnosticSettingName -ResourceId $RithResourceId -WorkspaceId $RithWkId -Metric $rithmetrics
$RithResourceId 是您要在其中创建诊断设置的资源的资源 ID。
Output: