{"id":3191,"date":"2012-08-21T20:03:36","date_gmt":"2012-08-21T18:03:36","guid":{"rendered":"http:\/\/contoso.se\/blog\/?p=3191"},"modified":"2012-08-21T20:03:36","modified_gmt":"2012-08-21T18:03:36","slug":"dependencies-between-runbooks-in-orchestrator","status":"publish","type":"post","link":"https:\/\/contoso.se\/blog\/?p=3191","title":{"rendered":"Dependencies between runbooks in Orchestrator"},"content":{"rendered":"<p>Today I\u00c2\u00a0received\u00c2\u00a0a question if it is possible to see the relationship between runbooks in Orchestrator. Relationships in this scenario is\u00c2\u00a0runbooks invoking each other. When you build a library of core runbooks, runbooks providing functions multiple\u00c2\u00a0runbooks will invoke and use, it is important not to modify these core runbooks without look at all dependencies. We cant see that relationship in a easy way with the runbook designer console. Of course we can open each invoke runbook activity in each runbook and draw the map manually, but that would take a lot of time. Running\u00c2\u00a0a SQL query against the Orchestrator database is a faster solution.<\/p>\n<p>The first step in building that SQL query is to list all invoke runbook activities we have in use. The SQL query below will list all activities, or actually all objects, in the Orchestrator environment not marked as deleted. The Objects table includes\u00c2\u00a0for example folders too, so not only runbooks.<\/p>\n<blockquote><p>SELECT Deleted, Name, ParentID, Description, ObjectType<br \/>\nFROM OBJECTS<br \/>\nWHERE (Deleted = 0)<\/p><\/blockquote>\n<p>Scroll down in the result list until you find a Invoke Runbook activity, copy the value from the ObjectType field. With the ObjectType value\u00c2\u00a0we can now update the query to only include Invoke Runbook activities.<\/p>\n<blockquote><p>SELECT Deleted, Name, ParentID, Description, ObjectType<br \/>\nFROM OBJECTS<br \/>\nWHERE (Deleted = 0) AND (ObjectType = &#8216;9C1BF9B4-515A-4FD2-A753-87D235D8BA1F&#8217;)<\/p><\/blockquote>\n<p>ParentID is the runbook where the Invoke Runbook activity exists, if we want to show the runbook too, we update the query like<\/p>\n<blockquote><p>SELECT OBJECTS.Name, OBJECTS.Description, POLICIES.Name AS Expr1<br \/>\nFROM OBJECTS INNER JOIN<br \/>\nPOLICIES ON OBJECTS.ParentID = POLICIES.UniqueID<br \/>\nWHERE (OBJECTS.Deleted = 0) AND (OBJECTS.ObjectType = &#8216;9C1BF9B4-515A-4FD2-A753-87D235D8BA1F&#8217;)<\/p><\/blockquote>\n<p>The next step is to look at the configuration of the Invoke Runbook activities<\/p>\n<blockquote><p>SELECT POLICIES.Name AS [Activity Name], OBJECTS.Name AS [Source Runbook], OBJECTS.Description AS [Activity Description], TRIGGER_POLICY.PolicyPath,<br \/>\nTRIGGER_POLICY.TriggerByPolicyPath, TRIGGER_POLICY.TargetActionServers, TRIGGER_POLICY.WaitToComplete<br \/>\nFROM OBJECTS INNER JOIN<br \/>\nPOLICIES ON OBJECTS.ParentID = POLICIES.UniqueID INNER JOIN<br \/>\nTRIGGER_POLICY ON OBJECTS.UniqueID = TRIGGER_POLICY.UniqueID<br \/>\nWHERE (OBJECTS.Deleted = 0) AND (OBJECTS.ObjectType = &#8216;9C1BF9B4-515A-4FD2-A753-87D235D8BA1F&#8217;)<\/p><\/blockquote>\n<p>In the picture below you see a example result from the query. You can now turn this query around to list all runbooks that invokes a specific runbook, or all runbook invoked by a specified runbook.<\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/08\/20120821_query_01.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-3193\" title=\"20120821_query_01\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/08\/20120821_query_01-300x144.jpg\" alt=\"\" width=\"300\" height=\"144\" srcset=\"https:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/08\/20120821_query_01-300x144.jpg 300w, https:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/08\/20120821_query_01.jpg 928w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today I\u00c2\u00a0received\u00c2\u00a0a question if it is possible to see the relationship between runbooks in Orchestrator. Relationships in this scenario is\u00c2\u00a0runbooks invoking each other. When you build a library of core runbooks, runbooks providing functions multiple\u00c2\u00a0runbooks will invoke and use, it is important not to modify these core runbooks without look at all dependencies. We cant &hellip; <a href=\"https:\/\/contoso.se\/blog\/?p=3191\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[60],"tags":[],"_links":{"self":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3191"}],"collection":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3191"}],"version-history":[{"count":4,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3191\/revisions"}],"predecessor-version":[{"id":3196,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3191\/revisions\/3196"}],"wp:attachment":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3191"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3191"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3191"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}