{"id":194,"date":"2017-05-31T14:34:02","date_gmt":"2017-05-31T20:34:02","guid":{"rendered":"http:\/\/draith.com\/?p=194"},"modified":"2017-05-31T14:34:02","modified_gmt":"2017-05-31T20:34:02","slug":"oms-and-flow-integration-best-friends-forever","status":"publish","type":"post","link":"https:\/\/draith.com\/?p=194","title":{"rendered":"OMS and Flow Integration &#8211; Best Friends Forever"},"content":{"rendered":"<p>The alert actions in Microsoft OMS are great, but they can be a bit limited.  Sending emails can be boring, ignored, or end up in the spam folder.  Runbooks are awesome, but can take some time to setup.  What if you want to use a simple Microsoft Flow to perform other actions?  Flow is fast, simple, reliable, and mobile ready.  Here is how to make OMS and Flow best friends &#8211; and make you look like a rockstar!<\/p>\n<p>Go to <a href=\"https:\/\/requestb.in\/\">https:\/\/requestb.in\/<\/a> and select &#8220;Create a RequestBin&#8221;<br \/>\nCopy the Bin URL.  You will need this in a minute.<br \/>\nOpen <a href=\"http:\/\/oms.microsoft.com\">OMS<\/a> and head to the alert you want to make awesome (Overview &#8211; Settings &#8211; Alerts).<br \/>\nTurn on the Webhook action, and paste the Requestb.in url into the &#8220;WebHook URL&#8221; field.<br \/>\nCheck the box to turn on the &#8220;Include Custon JSON Payload&#8221;.  Paste this json into the field below the checkbox:<\/p>\n<p>{&#8220;AlertRuleName&#8221;:&#8221;#alertrulename&#8221;,<br \/>\n&#8220;AlertThresholdOperator&#8221;:&#8221;#thresholdoperator&#8221;,<br \/>\n&#8220;AlertThresholdValue&#8221;:&#8221;#thresholdvalue&#8221;,<br \/>\n&#8220;LinkToSearchResults&#8221;:&#8221;#linktosearchresults&#8221;,<br \/>\n&#8220;ResultCount&#8221;:&#8221;#searchresultcount&#8221;,<br \/>\n&#8220;SearchIntervalEndtimeUtc&#8221;:&#8221;#searchintervalendtimeutc&#8221;,<br \/>\n&#8220;SearchIntervalInSeconds&#8221;:&#8221;#searchinterval&#8221;,<br \/>\n&#8220;SearchIntervalStartTimeUtc&#8221;:&#8221;#searchintervalstarttimeutc&#8221;,<br \/>\n&#8220;searchquery&#8221;:&#8221;#searchquery&#8221;,<br \/>\n&#8220;workspace&#8221;:&#8221;#workspaceid&#8221;,<br \/>\n&#8220;IncludeSearchResults&#8221;:true<br \/>\n}<\/p>\n<p>Note:  You might want to remove the &#8220;searchquery&#8221; json pair &#8211; the alert queries that have special characters can really cause havoc with the webhook.<br \/>\nHit &#8220;Test WebHook&#8221;.  If you get an error, remove the searchquery section out of the json and try again.  If it occurs again, shoot me an email and I will be glad to help.<br \/>\nGo back to RequestB.in and refresh your page.  You should see something like this:<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/draith.com\/wp-content\/uploads\/2017\/05\/Requestbin.png\" alt=\"\" width=\"1484\" height=\"724\" class=\"alignnone size-full wp-image-197\" srcset=\"\/wp-content\/uploads\/2017\/05\/Requestbin.png 1484w, \/wp-content\/uploads\/2017\/05\/Requestbin-300x146.png 300w, \/wp-content\/uploads\/2017\/05\/Requestbin-1024x500.png 1024w, \/wp-content\/uploads\/2017\/05\/Requestbin-768x375.png 768w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/p>\n<p>Copy out the &#8220;Raw Body&#8221; section.<br \/>\nOpen <a href=\"https:\/\/flow.microsoft.com\/en-us\/\">Flow<\/a>, and create a new Flow (My Flows, Create from Blank)<br \/>\nFor the Trigger &#8211; pick &#8220;Request\/Response &#8211; Request&#8221;.  When you click on the trigger, it will open the Flow for editing.<br \/>\nClick on &#8220;Use sample payload to generate schema&#8221;, and paste in the data you got from RequestB.in.  Click &#8220;Done&#8221;.  Flow has now setup of the JSON schema that the rest of your Flow will use.<br \/>\nAdd another other Flow action like you normally would &#8211; For example, you might want to add these alerts to a Sharepoint list, or perhaps put them in a SQL database for archiving.  The fields that are available to the actions that follow the Request trigger depend on the fields that were sent by the alert &#8211; I suggest that you play around with Threshold vs Metric alerts so you can see how they post to Flow.<br \/>\nOne last step &#8211; when you save the Flow, make sure you go into the &#8220;Request&#8221; trigger and copy the URL.  You will want to paste that url in the OMS alert Webhook URL (remove the requestb.in url).  Now, when the alert triggers, it will pass the data to Flow rather than RequestB.in.<\/p>\n<p>Once you have the alerts coming to Flow, the possibilities are endless &#8211; want to see those Alerts on your phone?  Get PowerApps and in 5 minutes you can point it at the SQL database you are using to store the alerts.  Want a mobile notification?  Piece of cake with Flow.  Hell,  maybe you want to Tweet those alerts for some reason &#8211;  Go for it! I won&#8217;t tell you not to.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The alert actions in Microsoft OMS are great, but they can be a bit limited. Sending emails can be boring, ignored, or end up in the spam folder. Runbooks are awesome, but can take some time to setup. What if you want to use a simple Microsoft Flow to perform other actions? Flow is fast, &hellip; <a href=\"https:\/\/draith.com\/?p=194\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;OMS and Flow Integration &#8211; Best Friends Forever&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[8,14],"class_list":["post-194","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-flow","tag-oms"],"_links":{"self":[{"href":"https:\/\/draith.com\/index.php?rest_route=\/wp\/v2\/posts\/194","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/draith.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/draith.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/draith.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/draith.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=194"}],"version-history":[{"count":0,"href":"https:\/\/draith.com\/index.php?rest_route=\/wp\/v2\/posts\/194\/revisions"}],"wp:attachment":[{"href":"https:\/\/draith.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=194"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/draith.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=194"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/draith.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=194"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}