无法使用 Remove-AzDiagnosticSetting 删除诊断设置

Cannot remove a diagnostic setting with Remove-AzDiagnosticSetting

我在 Database/Master 上有一个诊断设置,但我在 AzureCLI 中删除它时遇到了一些困难。

所以我用

Remove-AzDiagnosticSetting -ResourceId "/subscriptions/xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/resourceGroups/PainfulRG/providers/Microsoft.Sql/servers/testsqltoday/databases/db1" -Name Jason

返回状态为 OK。

然后我在 Azure 门户的诊断设置中查看 activity 日志,我看到:

  "resourceId": "/subscriptions/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx/resourceGroups/PainfulRG/providers/Microsoft.Sql/servers/testsqltoday/databases/db1/providers/Microsoft.Insights/diagnosticSettings/Jason",
    "status": {
        "value": "Succeeded",
        "localizedValue": "Succeeded"
    },
    "subStatus": {
        "value": "OK",
        "localizedValue": "OK (HTTP Status Code: 200)"
    },

所以看起来没问题(200 状态)。

但是当我转到诊断设置并单击 db1 - 然后进入诊断设置时 - 该设置仍然存在。

您可以使用下面的其余部分API删除诊断设置

https://docs.microsoft.com/en-us/rest/api/monitor/diagnostic-settings/delete