-
Import a runbook
Importing a runbook is a very powerful way to quickly add functionality to your script library. When you import a runbook you typically are working with runbook code that has already been written, tested, and made ready to go. You might need to assign your specific values to the variables when you run it, or modify the code slightly after import to meet your specific needs. You can import from a file share on your internal company site where you store your company Windows PowerShell scripts. You can also import runbooks from community sites or the Microsoft Script Center. Many common scripts are available from the Script Center that you can import and use as is or modify for your deployment.
There are many ways to import runbook functionality. Note that when you import a plain Windows PowerShell script, it will be converted to a workflow.
- Internal site You can import from a file share on the internal company site where you store your company PowerShell scripts.
- Script Center You can import from community sites or the Microsoft Script Center. To import a runbook, you can go to the TechNet Script Center and filter by technologies you might want to consider. Many common scripts are available that you can import directly or copy and modify a bit for your deployment.
- Runbook Gallery—Portal You can import a runbook from the Azure Management Portal Runbook Gallery that contains similar functionality to what you can download from the Script Center for Azure. The best recommendation is to use the Azure Portal Runbook Gallery first, and then go to the online Runbook Gallery if you can’t find what you need
- Runbook Gallery—Online You can also download and import from the online Runbook Gallery, which continues to expand with many scenarios and sample utility runbooks.
Import a runbook from the Script Center
An imported runbook comes in with a draft status, and you have to explicitly decide when to publish it. After you publish it, other runbooks within your subscription can invoke it.
To import a runbook from the Microsoft Script Center, do the following:
1. Go to the Repository of the Script Center.
2. In Categories, select Windows Azure. (As of this writing, the label isn’t updated to Microsoft Azure.)
3. Under Operating System, make the selection appropriate to your environment.
4. For Scripting Language, select the PowerShell check box.
5. For Contributors, select the check box for the contribution source you want to use. Generally, scripts originate from either Microsoft or the community.
6. From the results, select a script of interest to you and then download and save it as a file to a location of your choice.
7. Sign in to the Azure Management Portal at manage.windowsazure.com.
8. Click Automation, and then click the automation account for which you want to import the runbook.
9. On that automation account’s page, click Runbooks and then click Import.
10. On the Import Runbook page, browse to select the runbook file (for example, the file you downloaded in step 6), and then click the check mark to import the runbook. You can import any Windows PowerShell script file with a .ps1 extension. This could be a file you have written previously or a file you download from the Microsoft Script Center. Clicking Import allows you to browse for any PS1 file that is 1 MB size maximum.
11. Find the imported runbook on the Runbooks page of the Azure Automation account. The value in the Authoring column is New. Click the name of the runbook to go to the Learn About This Runbook page.
Import or export a runbook via the Azure Management Portal
To import a runbook, go to the Azure Automation icon on the left side of the portal, which shows any Azure Automation accounts you have for that subscription. Clicking one of those subscriptions will take you to the main account screen. Simply click Runbooks to display all the runbooks contained in that Azure Automation account. At the bottom of the screen are two related buttons, Import and Export.
You can import any Windows PowerShell script file with a .ps1 extension. This could be a script file you have written previously or one you download from the Script Center. Click Import to browse for any PS1 file that is 1 MB size maximum. When you import a PS1 script file, it will be converted to a workflow during the import operation.
Correspondingly, you can export a runbook by clicking Export. You will be prompted to make sure you want to export it, and you can to save it to any location you want.
Source of Information : Azure Automation
Subscribe to:
Post Comments (Atom)
0 comments: