Azure Automation Runbook无法解码webhook请求数据 [英] Azure Automation Runbook unable to decode the webhook request data

查看:76
本文介绍了Azure Automation Runbook无法解码webhook请求数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我对此问题感到非常震惊。我请你回答或提示。我的选项用完了。

I am badly struck by this problem. I request you to answer or give a hint. I am running out of options.


我通过WebHook在高CPU利用率时调用azure Runbook。我的问题是在Runbook数据内部没有得到正确的解码。例如,下面的行不打印任何内容。

I am calling an azure runbook upon high CPU utilization via a WebHook. My problem is inside runbook data is not getting decoded properly. For example, the below line is not printing anything.

 Write-Output $WebHookData.RequestHeader



< g class =" gr_ gr_20 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace"数据-GR-ID =" 20" ID = QUOT; 20"> Wheras< / g取代; IF< g class =" gr_ gr_23 gr-alert gr_tiny gr_spell gr_inline_cards
gr_run_anim ContextualSpelling multiReplace"数据-GR-ID =" 23" ID = QUOT; 23" I标记< / g取代;尝试< g class =" gr_ gr_21 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace"数据-GR-ID =" 21"
id =" 21"> explictly< / g>将数据转换为JSON,就像这样

<g class="gr_ gr_20 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="20" id="20">Wheras</g> IF <g class="gr_ gr_23 gr-alert gr_tiny gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace" data-gr-id="23" id="23">i</g> try to <g class="gr_ gr_21 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="21" id="21">explictly</g> convert the data to JSON, like this

*$WebhookData = ConvertFrom-Json $WebhookData*



然后是投掷错误。

then it is a throwing error.



ConvertFrom-Json:无效的JSON原语:。在行:6 char:31 + $ WebhookData = $ WebhookData | ConvertFrom-Json

ConvertFrom-Json : Invalid JSON primitive: . At line:6 char:31 + $WebhookData = $WebhookData | ConvertFrom-Json



顺便说一句,我正在尝试使用Azure gallery上的Runbook {使用Azure自动化垂直扩展Azure
资源管理器虚拟机
}


从虚拟机上创建的警报调用我的Webhook。

My Webhook is called from alert created on VM.


一个非常奇怪的观察:


工作WebHood示例(在示例中找到){" WebhookName":" test1"," RequestBody":"  [ \\\ n
{\\\\ n \" Message \":\" Test Message \" \\ \\ r \\ n} \\\ ** ** **<

Working WebHood Example (found in an example) {"WebhookName":"test1","RequestBody":" [\r\n {\r\n \"Message\": \"Test Message\"\r\n }\r\n**]**"


不工作(从VM调用Runbook时发送的数据):

Not Working(the data sent upon calling runbook from VM):


{" WebhookName":" test2"," RequestBody":"  { \" schemaId \":\" AzureMonitorMetricAlert \"} }

{"WebhookName":"test2","RequestBody":" {\"schemaId\":\"AzureMonitorMetricAlert\"}}


谢谢

推荐答案

为更广泛的受众分享以下信息 -

Sharing below information for broader audience -

我们注意到这个问题与  这个  Stack Overflow问题。

We have noticed that this question is a duplicate of this Stack Overflow question.


这篇关于Azure Automation Runbook无法解码webhook请求数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆