Azure Governance and Management Blog articles

Azure Governance and Management Blog articles

https://techcommunity.microsoft.com/t5/azure-governance-and-management/bg-p/AzureGovernanceandManagementBlog

Azure Governance and Management Blog articles

Public Preview of Azure Automation extension for Visual Studio Code

Published

Public Preview of Azure Automation extension for Visual Studio Code

We are happy to announce the Public Preview of Azure Automation extension to help create and manage runbooks directly from Visual Studio Code.  Visual Studio Code is a light weight source code editor which runs on your desktop and is available for Linux, macOS, and Windows. It provides an industry leading creation & editing experience for languages and runtimes like PowerShell, Python etc . This extension offers you features for runbook management operations like editing runbook, triggering a job, tracking recent jobs, linking a schedule , asset management , local debugging etc. ensuring the developers and IT admins can author, debug, edit and manage automation runbooks without leaving the IDE (Visual Studio Code).

 

This extension has been in works for a while and is already used by many Automation customers. It’s now ready for more exposure and usage with some improvements based on feedback as shared by the customers. We’ve built this experience for customers who heavily use the PowerShell ISE for writing runbooks instead of using the built-in browser-based interface for runbook authoring, while working with PowerShell cmdlets and Automation Assets. With a leg up to the current browser-based interface, the extension makes runbook developers more productive and reduces the E2E time for runbook management.

 

Key Features of the extension

  • Supports all the Automation – PowerShell 5, PowerShell 7, Python 2 and Python3 Runbooks.
  • Supports test execution of job, publishing automation Job and triggering job in Azure as well as Hybrid runbook workers. You can execute runbooks locally also.
  • Supports Python positional parameters and PowerShell parameters for job tiggering.
  • Supports linking a Schedule to Runbook and creating webhook. Starting a job through Webhook is simplified.
  • You can manage the Automation Assets – certificates, variables, credentials, and connections. You can perform create, update, and delete operation on the Automation Assets.
  • You can see the recent last 10 jobs by right clicking on the job and select ‘Job Output’ from the menu.
  • You can debug PowerShell scripts locally.
  • You can compare local Runbook to the published or the draft runbook.

Some of the key Runbook management operations -

 

  1. Create Runbook – Create a New Runbook in the Automation Account by right clicking on ‘Runbooks’ title node and selecting Create Runbook.
  2. Fetch Draft Runbook – Replace the content of the Local Runbook with draft version from the Automation Account by right clicking on the selected Runbook and Select Fetch Draft Runbook.
  3. Fetch Published Runbook – Replace the content of Local Runbook with the published version from the Automation Account by right clicking on the selected Runbook and Select Fetch Published Runbook.
  4. Open Local – Open the Local Runbook in the Editor by right Clicking on the selected Runbook properties and Select Open Local.
  5. Compare Local Runbook - This allows you to compare Local Runbook with the Published or Draft Runbook copy. You can visualize the change in the code side by side between the local runbook copy and the published or draft copy.
  6. Upload As Draft – Save a local copy of your Runbook as draft in Automation Account by right clicking on the Runbook properties and Select Upload As Draft.
  7. Publish Runbook – Publish the local copy of your Runbook in Automation Account by right clicking on the Runbook properties and selecting Publish Runbook.
  8. Delete Runbook – Delete a Runbook from Automation Account by right clicking on the selected Runbook and selecting Delete Runbook.

Test Runbook and Jobs -

 

  1. Run Local – Run local version of the automation job by right clicking the Runbook -> Run Local.
  2. Run Local in Debug Mode - Run local version of the PowerShell Runbooks in debug mode by allowing you to add breakpoints in the script. This provides support for using internal cmdlets like Get-AutomationVariable also (non-encrypted assets only supported currently).
  3. Start Automation Job – Start the automation job by right clicking in the Runbook properties -> Start Automation Job.
  4. Start Automation Test Job – Start the automation test job by right clicking in the Runbook properties -> Start Automation Test Job.
  5. Job Output – When a job is created, you can track the job output by clicking on Job Output option or you can go to Recent Jobs and right click to select Job Output . It polls the service every 5 seconds to show the job Output.

Work with Schedules, Assets and webhook - 

 

  • Link Schedule – You can link a schedule to the runbook by right clicking on the Runbook properties menu and selecting Link Schedule. It supports params and runOn option.
  • Add New Webhook – You can add a webhook to the runbook by right clicking on the Runbook properties menu and selecting Add New Webhook. It supports params and runOn option. 2.
  • You can create, update, or view the properties of Assets - Certificates, Connections, Credentials, Variables. You can also delete assets from the extension.

VSCode.jpg

 

Walkthrough of various extension operations can be found on the Extension Overview in the Visual Studio marketplace.  

Complete documentation can be found here.

 

Limitation

• Creation of new Schedules is not supported.
• Adding new Certificate in Assets is not supported.
• Uploading Modules (PowerShell & Python Packages) from the extension is not supported.
• Currently there is no auto-sync of local runbooks to Azure Automation Account Runbooks. You will have to perform the operation to Fetch or Publish runbook.
• For python currently we do not provide any debug options. It should be performed by the user as they do in any python script by installing any debugger extension.

 

We will be addressing these limitations in the future releases.

 

Feedback

Do share your review for us to improve the extension! We’ve already heard some great feedback about the extension helping users in the runbook authoring process. We hope you’ll try it out and let us know about your experience so we can continue to refine it.

 

Support for this extension is provided on our GitHub Issue Tracker. You can submit a bug report, a feature suggestion or participate in discussions.

 

Happy automation!

 

Just getting started with Azure Automation? Learn about the service here and follow Azure Automation on Twitter for the latest updates.

 

 

 

 

 

 

 

 

 

Continue to website...

More from Azure Governance and Management Blog articles