Muokkaa

Jaa


Use existing runbooks and modules

Rather than creating your own runbooks and modules in Azure Automation, you can access scenarios that have already been built by Microsoft and the community. You can get Azure-related PowerShell and Python runbooks from the Runbook Gallery in the Azure portal, and modules and runbooks (which may or may not be specific to Azure) from the PowerShell Gallery. You can also contribute to the community by sharing scenarios that you develop.

Note

The TechNet Script Center is retiring. All of the runbooks from Script Center in the Runbook gallery have been moved to our Automation GitHub organization For more information, see Azure Automation Runbooks moving to GitHub.

Import runbooks from GitHub with the Azure portal

Note

  • The Browse gallery option in the Azure portal has an enhanced user experience.
  • In Process Automation > Runbook blade, you can import runbooks either by Import a runbook or Browse gallery option and the Runbooks page displays two new columns - Runtime version and Runbook type.
  1. In the Azure portal, open your Automation account.

  2. Select Runbooks blade under Process Automation.

  3. Click Import a runbook in the Runbooks page.

    Screenshot of selecting a runbook from import runbook option.

  4. In the Import a runbook page, you can either import a file stored on your local machine or from GitHub using Browse for file or Browse from gallery respectively.

  5. Select the file.

  6. Enter the Name, Runtime version, and Description.

  7. Click Import.

    Screenshot of selecting a runbook from file or gallery.

  8. Alternatively, Select Browse Gallery in the Runbooks page to browse the available runbooks.

    Screenshot of selecting browsing gallery option from runbook blade.

  9. You can use the filters above the list to narrow the display by publisher, type, and sort. Locate the gallery item you want and select it to view its details.

    Browsing runbook gallery.

  10. Click Select to select a chosen runbook.

  11. In the Import a runbook page, enter the Name and select the Runtime versions.

  12. The Runbook type and Description are auto populated.

  13. Click Import.

    Gallery item import.

  14. The runbook appears on the Runbooks tab for the Automation account.

Important

You should validate the contents of any runbooks that you get from the PowerShell Gallery. Use extreme caution in installing and running them in a production environment.

The PowerShell Gallery provides various runbooks from Microsoft and the community that you can import into Azure Automation. To use one, download a runbook from the gallery, or you can directly import runbooks from the gallery, or from your Automation account in the Azure portal.

Note

Graphical runbooks are not supported in PowerShell Gallery.

You can only import directly from the PowerShell Gallery using the Azure portal. You cannot perform this function using PowerShell. The procedure is the same as shown in Import runbooks from GitHub with the Azure portal, except that the Source will be PowerShell Gallery.

Showing runbook gallery source selection.

PowerShell modules contain cmdlets that you can use in your runbooks. Existing modules that you can install in Azure Automation are available in the PowerShell Gallery. You can launch this gallery from the Azure portal and install the modules directly into Azure Automation, or you can manually download and install them.

You can also find modules to import in the Azure portal. They're listed for your Automation Account in the Modules under Shared resources.

Important

Do not include the keyword "AzureRm" in any script designed to be executed with the Az module. Inclusion of the keyword, even in a comment, may cause the AzureRm to load and then conflict with the Az module.

The list below contains a few runbooks that support common scenarios. For a full list of runbooks created by the Azure Automation team, see AzureAutomationTeam profile.

Contribute to the community

We strongly encourage you to contribute and help grow the Azure Automation community. Share the amazing runbooks you've built with the community. Your contributions will be appreciated!

You can add new PowerShell or Python runbooks to the Runbook gallery with this GitHub workflow.

  1. Create a public repository on GitHub, and add the runbook and any other necessary files (like readme.md, description, and so on).

  2. Add the topic azureautomationrunbookgallery to make sure the repository is discovered by our service, so it can be displayed in the Automation Runbook gallery.

  3. If the runbook that you created is a PowerShell workflow, add the topic PowerShellWorkflow. If it's a Python 3 runbook, add Python3. No other specific topics are required for Azure runbooks, but we encourage you to add other topics that can be used for categorization and search in the Runbook Gallery.

    Note

    Check out existing runbooks in the gallery for things like formatting, headers, and existing tags that you might use (like Azure Automation or Linux Azure Virtual Machines).

To suggest changes to an existing runbook, file a pull request against it.

If you decide to clone and edit an existing runbook, best practice is to give it a different name. If you re-use the old name, it will show up twice in the Runbook gallery listing.

Note

Please allow at least 12 hours for synchronization between GitHub and the Automation Runbook Gallery, for both updated and new runbooks.

Microsoft encourages you to add runbooks to the PowerShell Gallery that you think would be useful to other customers. The PowerShell Gallery accepts PowerShell modules and PowerShell scripts. You can add a runbook by uploading it to the PowerShell Gallery.

  1. In the Azure portal, open your Automation account.

  2. Under Shared Resources, select Modules.

  3. In Modules page, select Browse gallery to open the list of modules.

    View of the module gallery.

  4. On the Browse gallery page, you can search by the following fields:

    • Module Name
    • Tags
    • Author
    • Cmdlet/DSC resource name
  5. Locate a module that you're interested in and select it to view its details.

    When you drill into a specific module, you can view more information. This information includes a link back to the PowerShell Gallery, any required dependencies, and all of the cmdlets or DSC resources that the module contains.

    Detailed view of a module from the gallery.

  6. To install the module directly into Azure Automation, click Import.

  7. On the Import pane, you can see the name of the module to import. If all the dependencies are installed, the OK button is activated. If you're missing dependencies, you need to import those dependencies before you can import this module.

  8. On the Import pane, click OK to import the module. While Azure Automation imports a module to your account, it extracts metadata about the module and the cmdlets. This action might take a couple of minutes since each activity needs to be extracted.

  9. You receive an initial notification that the module is being deployed and another notification when it has completed.

  10. After the module is imported, you can see the available activities. You can use module resources in your runbooks and DSC resources.

Note

Modules that only support PowerShell core are not supported in Azure Automation and are unable to be imported in the Azure portal, or deployed directly from the PowerShell Gallery.

Request a runbook or module

You can send requests to User Voice. If you need help with writing a runbook or have a question about PowerShell, post a question to our Microsoft Q&A question page.

Next steps