{"id":5761,"date":"2015-06-04T00:01:00","date_gmt":"2015-06-04T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2015\/06\/04\/using-azure-automation-part-4\/"},"modified":"2019-02-18T09:47:36","modified_gmt":"2019-02-18T16:47:36","slug":"using-azure-automation-part-4","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/using-azure-automation-part-4\/","title":{"rendered":"Using Azure Automation: Part 4"},"content":{"rendered":"<p><b style=\"font-size:12px\">Summary: <\/b>Learn how to report output from Azure Automation and publish to production.<\/p>\n<p>Honorary Scripting Guy, Sean Kearney, is here again to show you more about Azure Automation and to empower you in automating your assets in Azure. This is the fourth post in a five-part series. To catch up, read:<\/p>\n<ul>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/scripting\/using-azure-automation-part-1\/\" target=\"_blank\">Using Azure Automation: Part&nbsp;1<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/scripting\/using-azure-automation-part-2\/\" target=\"_blank\">Using Azure Automation: Part 2<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/scripting\/using-azure-automation-part-3\/\" target=\"_blank\">Using Azure Automation: Part 3<\/a><\/li>\n<\/ul>\n<p>Our current task is trying to see what is happening in the magic genie bottle that contains our Azure Automation runbook. I say &quot;magic genie bottle&quot; because up to this point, we really can&#039;t see what&#039;s going on, can we? There&#039;s no Windows Powershell console, no ISE.<\/p>\n<p>Nothing&hellip;<\/p>\n<p>Not a sausage!<\/p>\n<p>Well actually, that&#039;s not true. I fibbed a bit. We do have an output pane that is waiting for output.&nbsp;<span style=\"font-size:12px\">When you run <\/span><b style=\"font-size:12px\">Test<\/b><span style=\"font-size:12px\"> on the runbook, you&#039;ll see a window at the bottom of the webpage that shows nothing other than <\/span><b style=\"font-size:12px\">Status Starting<\/b><span style=\"font-size:12px\">.&nbsp;<\/span><span style=\"font-size:12px\">But we can have some output go to this window. It&#039;s actually pretty easy. Simply use the <\/span><b style=\"font-size:12px\">Write-Output<\/b><span style=\"font-size:12px\"> cmdlet with some information.<\/span><\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/8311.1.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/8311.1.PNG\" alt=\"Image of menu\" title=\"Image of menu\" \/><\/a><\/p>\n<p>We can add some status reports to our workflow now by injected in some appropriate <b>Write-Output<\/b> statements.<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/5543.2.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/5543.2.PNG\" alt=\"Image of script\" title=\"Image of script\" \/><\/a><\/p>\n<p>Now the runbook will send status messages to the output pane, as you can see here:<\/p>\n<p style=\"margin-left:30px\"><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/7713.3.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/7713.3.PNG\" border=\"0\" alt=\" \" \/><\/a><\/p>\n<p>We now have confirmation that it&#039;s running properly!<\/p>\n<p>At this point, we take the next big step: promoting to production and making it a real runbook (yes, Pinocchio, it&#039;s your time).&nbsp;<span style=\"font-size:12px\">This is done by clicking the <\/span><b style=\"font-size:12px\">Publish<\/b><span style=\"font-size:12px\"> button after you click <\/span><b style=\"font-size:12px\">Save<\/b><span style=\"font-size:12px\">:<\/span><\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/7801.4.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/7801.4.PNG\" alt=\"Image of menu\" title=\"Image of menu\" \/><\/a><\/p>\n<p>You will be prompted for confirmations to continue each time. When done, you&#039;ll get a happy status message like this one:<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/7853.5.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/7853.5.PNG\" alt=\"Image of message\" title=\"Image of message\" \/><\/a><\/p>\n<p>You&#039;ll also notice that your runbook lettering is greyed out because it&#039;s now a production runbook. If you click <b>Draft<\/b> again, you&#039;ll notice a new option to edit the existing production runbook. Go ahead!<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/2843.6.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/2843.6.PNG\" alt=\"Image of message\" title=\"Image of message\" \/><\/a><\/p>\n<p>When you click <b>Edit<\/b>, you&#039;ll see a copy of your production runbook. Take note of the operative word &quot;copy.&quot; If you make changes, you are not editing the main runbook. Nothing will change in the main runbook until you save and publish again.&nbsp;<span style=\"font-size:12px\">As shown here, you&#039;ll see a <\/span><b style=\"font-size:12px\">Discard<\/b><span style=\"font-size:12px\"> <\/span><b style=\"font-size:12px\">Draft<\/b><span style=\"font-size:12px\"> button now, which allows you to scrap the current draft:<\/span><\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/0525.7.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/0525.7.PNG\" alt=\"Image of script\" title=\"Image of script\" \/><\/a><\/p>\n<p>Now that we have a functional runbook, the next step is running it.<\/p>\n<p>That we will. Tomorrow&#8230;<\/p>\n<p>Tomorrow, young scripter. We&#039;ll end the week on a solid note with Windows PowerShell!<\/p>\n<p>I invite you to follow The Scripting Guys on <a href=\"http:\/\/bit.ly\/scriptingguystwitter\" target=\"_blank\">Twitter<\/a> and <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\" target=\"_blank\">Facebook<\/a>. If you have any questions, send an email to The Scripting Guys at <a href=\"mailto:scripter@microsoft.com\" target=\"_blank\">scripter@microsoft.com<\/a>, or post your questions on the <a href=\"http:\/\/bit.ly\/scriptingforum\" target=\"_blank\">Official Scripting Guys Forum<\/a>. See you tomorrow. Until then remember eat your cmdlets every day with a taste of creativity.<\/p>\n<p><b>Sean Kearney, <\/b>Windows PowerShell MVP and Honorary Scripting Guy<span style=\"font-size:12px\">&nbsp;<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Learn how to report output from Azure Automation and publish to production. Honorary Scripting Guy, Sean Kearney, is here again to show you more about Azure Automation and to empower you in automating your assets in Azure. This is the fourth post in a five-part series. To catch up, read: Using Azure Automation: Part&nbsp;1 [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[583,56,154,549,45],"class_list":["post-5761","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-azure-automation","tag-guest-blogger","tag-sean-kearney","tag-series","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Learn how to report output from Azure Automation and publish to production. Honorary Scripting Guy, Sean Kearney, is here again to show you more about Azure Automation and to empower you in automating your assets in Azure. This is the fourth post in a five-part series. To catch up, read: Using Azure Automation: Part&nbsp;1 [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/5761","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=5761"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/5761\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=5761"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=5761"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=5761"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}