azure - 无法通过 Azure FrontDoor WAF 策略中的 powershell 获取 Get-AzDiagnosticSetting。这是否允许我们获取诊断设置?
问题描述
Get-AzDiagnosticSetting:异常类型:ErrorResponseException,消息:Microsoft.Azure.Management.Monitor.Models.ErrorResponseException:操作在 Microsoft.Azure.Management.Monitor.DiagnosticSettingsOperations.d__8.MoveNext() 处返回了无效状态代码“BadRequest”-- - 从先前引发异常的位置结束堆栈跟踪 --- 在 Microsoft.Azure.Management.Monitor 的 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 的 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()。 DiagnosticSettingsOperationsExtensions.d__7.MoveNext() --- 在 System.Runtime.CompilerServices.TaskAwaiter 的 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 处从先前引发异常的位置结束堆栈跟踪。在 Microsoft.Azure.Commands.Insights.Diagnostics.GetAzureRmDiagnosticSettingCommand.ProcessRecordInternal() 在 Microsoft.Azure.Commands.Insights.MonitorCmdletBase .ExecuteCmdlet(),代码:Null,状态码:Null,原因短语:Null At C:\Users\n1542975\Desktop\MigrationScripts\WAF_Policy.ps1:121 char:26原因短语:Null At C:\Users\n1542975\Desktop\MigrationScripts\WAF_Policy.ps1:121 char:26原因短语:Null At C:\Users\n1542975\Desktop\MigrationScripts\WAF_Policy.ps1:121 char:26
- ... gsettings = Get-AzDiagnosticSetting -ResourceID $FrontDoorWAFPolicyNa ...
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : CloseError: (:) [Get-AzDiagnosticSetting], PSInvalidOperationException
- fullyQualifiedErrorId:Microsoft.Azure.Commands.Insights.Diagnostics.GetAzureRmDiagnosticSettingCommand
解决方案
是的,使用“Get-AzDiagnosticSetting”cmdlet,您可以获取特定资源的诊断设置。我们使用远程 PowerShell 和 Azure CLI 运行以下命令来获取前门的诊断设置。AzureCLI Cmdlet:
az monitor diagnostic-settings show --resource-group <resource-group> --resource <resource-name> --resource-type Microsoft.Network/frontdoors --name <diagnosticsettingname>
以下是供参考的示例输出:
电源外壳 Cmdlet:
Get-AzDiagnosticSetting -ResourceId <resourceId> -Name <diagnosticsettingName>
这是供参考的示例输出:
您可以参考以下 Azure 文档,了解有关PowerShell和Azure CLI语法的更多信息。
推荐阅读
- r - 清理混合地理数据 (R)
- jenkins - jenkins pipeline groovy - 列表框依赖于另一个列表框
- python - 读取特定 JSON 列以进行标记化
- javascript - Node JS - 循环通过 POST 请求并与其他数据结合的问题
- python - 使用漂亮的汤进行刮擦时出现错误 404,即使该站点存在
- dynamics-crm - 如何获取实体属性元数据列表?
- mysql - 触发器+过程问题
- r - 如何在 R 中没有转发和回复的情况下检索用户的推文?
- javascript - 未处理的拒绝(TypeError):无法读取未定义的属性“preventDefault”
- node.js - 如何进行幂等微基准测试或单独测量/模拟程序使用的 CPU 周期?