通过 powershell 创建 Azure 诊断设置不起作用

问题描述 投票:0回答:1

我使用以下 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"

显示的输出是

我等了几个小时来检查是否是由于延迟造成的,但没有运气!.

azure azure-logic-apps azure-powershell azure-diagnostics
1个回答
0
投票

下面是对我有用的

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:

enter image description here

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.