You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/automation/az-modules.md
+25-19Lines changed: 25 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,60 +9,66 @@ ms.topic: conceptual
9
9
10
10
# Az module support in Azure Automation
11
11
12
-
Azure Automation supports the use of [Azure PowerShell Az module](/powershell/azure/new-azureps-module-az?view=azps-1.1.0) in your runbooks. The Az module is not imported automatically in any new or existing Automation accounts.
12
+
Azure Automation supports the use of [Azure PowerShell Az module](/powershell/azure/new-azureps-module-az?view=azps-1.1.0) in your runbooks. The rollup Az module is not imported automatically in any new or existing Automation accounts.
13
13
14
14
## Considerations
15
15
16
-
There are many things to take into consideration when using the Az module in Azure Automation. Runbooks and modules can be used by higher-level solutions in your Automation account. Editing runbooks or upgrading modules can potentially cause issues with your runbooks. You should test all runbooks and solutions carefully in a separate Automation account before importing the new `Az` modules. Any modifications to modules can negatively affect the [Start/Stop](automation-solution-vm-management.md) solution. We don't recommend altering modules and runbooks in Automation accounts that contain any solutions. This behavior isn't specific to the Az modules. This behavior should be taken into consideration when introducing any changes to your Automation account.
16
+
There are many things to take into consideration when using the rollup Az module in Azure Automation. Runbooks and modules can be used by higher-level solutions in your Automation account. Editing runbooks or upgrading modules can potentially cause issues with your runbooks. You should test all runbooks and solutions carefully in a separate Automation account before importing new Az modules. Any modifications to modules can negatively affect the [Start/Stop](automation-solution-vm-management.md) solution. We don't recommend altering modules and runbooks in Automation accounts that contain any solutions. This behavior isn't specific to the Az modules. It should be taken into consideration when introducing any changes to your Automation account.
17
17
18
-
Importing an `Az` module in your Automation account doesn't automatically import the module in the PowerShell session that the runbooks use. Modules are imported into the PowerShell session in the following situations:
18
+
Importing an Az module in your Automation account doesn't automatically import the module in the PowerShell session that the runbooks use. Modules are imported into the PowerShell session in the following situations:
19
19
20
-
* When a cmdlet from a module is invoked from a runbook
21
-
* When a runbook imports it explicitly with the `Import-Module` cmdlet
22
-
* When another module depending on the module is imported into a PowerShell session
20
+
* When a runbook invokes a cmdlet from a module
21
+
* When a runbook imports the module explicitly with the `Import-Module` cmdlet
22
+
* When a runbook imports another module depending on the module
23
23
24
24
> [!IMPORTANT]
25
-
> It is important to make sure that runbooks in an Automation account either only import `Az`or `AzureRM` modules into the PowerShell sessions used by runbooks and not both. If `Az` is imported before `AzureRM` in a runbook, the runbook completes, but an error referencing the [Get_SerializationSettings](troubleshoot/runbooks.md#get-serializationsettings) cmdlet shows up in the job streams and cmdlets might not be properly executed. If you import `AzureRM` and then `Az`, your runbook still completes, but you receive an error in the job streams stating that both `Az` and `AzureRM` can't be imported in the same session or used in the same runbook.
25
+
> Make sure that runbooks in an Automation account import either Az modules or [AzureRM](https://www.powershellgallery.com/packages/AzureRM/6.13.1) modules, but not both, into a PowerShell session. If a runbook imports Az modules before AzureRM modules, the runbook completes. However, an error referencing the [Get_SerializationSettings](troubleshoot/runbooks.md#get-serializationsettings) cmdlet shows up in the job streams and cmdlets might not execute properly. If the runbook imports AzureRM modules before Az modules, the runbook also completes. In this case, though, you receive an error in the job streams stating that both Az and AzureRM can't be imported in the same session or used in the same runbook.
26
26
27
27
## Migrating to Az modules
28
28
29
-
It's recommended that you test the migration to Az modules in a test Automation account. Once that Automation account has been created, you can use the instructions in this section to work with the modules.
29
+
It's recommended that you test a migration to Az modules in a test Automation account. Once you create this account, you can use the instructions in this section to work with the modules.
30
30
31
-
### Stop and unschedule all runbooks that use AzureRM cmdlets
31
+
### Stop and unschedule all runbooks that use AzureRM modules
32
32
33
-
To ensure that you do not run any existing runbooks that use `AzureRM` cmdlets, you should stop and unschedule all runbooks that use `AzureRM` modules. You can see what schedules exist and which schedules must be removed by running code similar to this example.
33
+
To ensure that you do not run any existing runbooks that use AzureRM modules, stop and unschedule all affected runbooks. You can see what schedules exist and which schedules to remove by running code similar to this example:
It's important to review each schedule separately to ensure that you can reschedule it in the future for your runbooks if necessary.
39
+
It's important to review each schedule separately to ensure that you can reschedule it in the future for your runbooks, if necessary.
40
40
41
41
### Import the Az modules
42
42
43
-
Only import the Az modules that are required for your runbooks. Don't import the rollup `Az` module, as it includes all `Az.*` modules. This guidance is the same for all modules.
43
+
>[!NOTE]
44
+
>Have your runbooks import only required Az modules. Don't import the rollup Az module, as it includes all Az modules. This guidance is the same for all modules.
44
45
45
-
The [Az.Accounts](https://www.powershellgallery.com/packages/Az.Accounts/1.1.0) module is a dependency for the other `Az.*` modules. For this reason, this module needs to be imported into your Automation account before you import any other modules.
46
+
The [Az.Accounts](https://www.powershellgallery.com/packages/Az.Accounts/1.1.0) module is a dependency for the other Az modules. For this reason, your runbooks must import this module into your Automation account before importing any other modules.
46
47
47
-
From your Automation account, select **Modules** under **Shared Resources**. Click **Browse Gallery** to open the **Browse Gallery** page. In the search bar, enter the module name (such as `Az.Accounts`). On the PowerShell Module page, click **Import** to import the module into your Automation account.
48
+
To import the modules in the Azure portal:
49
+
50
+
1. From your Automation account, select **Modules** under **Shared Resources**.
51
+
2. Click **Browse Gallery** to open the Browse Gallery page.
52
+
3. In the search bar, enter the module name, for example, `Az.Accounts`.
53
+
4. On the PowerShell Module page, click **Import** to import the module into your Automation account.
48
54
49
55

50
56
51
-
This import process can also be done through the [PowerShell Gallery](https://www.powershellgallery.com) by searching for the module for import. Once you find the module, select it and under the **Azure Automation** tab, click **Deploy to Azure Automation**.
57
+
This import process can also be done through the [PowerShell Gallery](https://www.powershellgallery.com) by searching for the module for import. Once you find the module, select it, choose the **Azure Automation** tab, and click **Deploy to Azure Automation**.
52
58
53
59

54
60
55
61
## Testing your runbooks
56
62
57
-
Once the `Az` modules are imported into your Automation account, you can start editing your runbooks to use the Az modules. The majority of the cmdlets have the same names except that `AzureRM`has been changed to `Az`. For a list of modules that do not follow this naming convention, see [list of exceptions](/powershell/azure/migrate-from-azurerm-to-az#update-cmdlets-modules-and-parameters).
63
+
Once you've imported the Az modules into the Automation account, you can start editing your runbooks to use the modules. The majority of the cmdlets have the same names as for the AzureRM module, except that the AzureRM (or AzureRm) prefix has been changed to Az. For a list of modules that don't follow this naming convention, see [list of exceptions](/powershell/azure/migrate-from-azurerm-to-az#update-cmdlets-modules-and-parameters).
58
64
59
-
One way to test the modification of a runbook to use the new cmdlets is by using `Enable-AzureRMAlias -Scope Process` at the beginning of the runbook. By adding this command to your runbook, the script can run without changes.
65
+
One way to test the modification of a runbook to use the new cmdlets is by using `Enable-AzureRmAlias -Scope Process` at the beginning of the runbook. By adding this command to your runbook, the script can run without changes.
60
66
61
67
## After-migration details
62
68
63
-
After the migration is complete, don't try to start runbooks using `AzureRM` modules on the Automation account any longer. It's also recommended to not import or update `AzureRM` modules on the account. Consider the account migrated to `Az`, and operate with `Az` modules only.
69
+
After the migration is complete, don't try to start runbooks using AzureRM modules on the Automation account. It's also recommended to not import or update AzureRM modules on the account. Consider the account migrated to Az, and operate with Az modules only.
64
70
65
-
When a new Automation account is created, the existing `AzureRM` modules are still installed. You can still update the tutorial runbooks with `AzureRM` cmdlets. You should not run these runbooks.
71
+
When you create a new Automation account, the existing AzureRM modules are still installed. You can still update the tutorial runbooks with AzureRM cmdlets. However, you should not run these runbooks.
Copy file name to clipboardExpand all lines: articles/automation/manage-runbooks.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,12 +8,12 @@ ms.topic: conceptual
8
8
---
9
9
# Manage runbooks in Azure Automation
10
10
11
-
You can add a runbook to Azure Automation by either [creating a new one](#create-a-runbook) or [importing an existing one](#import-a-runbook) from a file or the [Runbook Gallery](automation-runbook-gallery.md). This article provides information on creating and importing runbooks from a file. You can get all the details of accessing community runbooks and modules in [Runbook and module galleries for Azure Automation](automation-runbook-gallery.md).
11
+
You can add a runbook to Azure Automation by either [creating a new one](#creating-a-runbook) or [importing an existing one](#importing-a-runbook) from a file or the [Runbook Gallery](automation-runbook-gallery.md). This article provides information on creating and importing runbooks from a file. You can get all the details of accessing community runbooks and modules in [Runbook and module galleries for Azure Automation](automation-runbook-gallery.md).
12
12
13
13
>[!NOTE]
14
14
>This article has been updated to use the new Azure PowerShell Az module. You can still use the AzureRM module, which will continue to receive bug fixes until at least December 2020. To learn more about the new Az module and AzureRM compatibility, see [Introducing the new Azure PowerShell Az module](https://docs.microsoft.com/powershell/azure/new-azureps-module-az?view=azps-3.5.0). For Az module installation instructions on your Hybrid Runbook Worker, see [Install the Azure PowerShell Module](https://docs.microsoft.com/powershell/azure/install-az-ps?view=azps-3.5.0). For your Automation account, you can update your modules to the latest version using [How to update Azure PowerShell modules in Azure Automation](automation-update-azure-modules.md).
15
15
16
-
## Create a runbook
16
+
## Creating a runbook
17
17
18
18
You can create a new runbook in Azure Automation using one of the Azure portals or Windows PowerShell. Once the runbook has been created, you can edit it using information in [Learning PowerShell Workflow](automation-powershell-workflow.md) and [Graphical authoring in Azure Automation](automation-graphical-authoring-intro.md).
You can create a new runbook in Azure Automation by importing a PowerShell script or PowerShell Workflow (**.ps1**), an exported graphical runbook (**.graphrunbook**), or a Python 2 script (**.py**). You must specify the [type of runbook](automation-runbook-types.md) that is created during import, taking into account the following considerations.
41
+
You can create a new runbook in Azure Automation by importing a PowerShell script or PowerShell Workflow (**.ps1**), an exported graphical runbook (**.graphrunbook**), or a Python2 script (**.py**). You must specify the [type of runbook](automation-runbook-types.md) that is created during import, taking into account the following considerations.
42
42
43
43
* A **.ps1** file that doesn't contain a workflow can be imported into either a [PowerShell runbook](automation-runbook-types.md#powershell-runbooks) or a [PowerShell Workflow runbook](automation-runbook-types.md#powershell-workflow-runbooks). If you import it into a PowerShell Workflow runbook, it is converted to a workflow. In this case, comments are included in the runbook to describe the changes that have been made.
44
44
@@ -62,7 +62,7 @@ You can use the following procedure to import a script file into Azure Automatio
62
62
5. If the **Name** field is enabled, you have the option of changing the runbook name. The name must start with a letter and can contain letters, numbers, underscores, and dashes.
63
63
6. The [runbook type](automation-runbook-types.md) is automatically selected, but you can change the type after taking the applicable restrictions into account.
64
64
7. Click **Create**. The new runbook appears in the list of runbooks for the Automation account.
65
-
8. You must [publish the runbook](#publish-a-runbook) before you can run it.
65
+
8. You must [publish the runbook](#publishing-a-runbook) before you can run it.
66
66
67
67
> [!NOTE]
68
68
> After you import a graphical runbook or a graphical PowerShell Workflow runbook, you can convert it to another type. However, you can't convert one of these graphical runbooks to a textual runbook.
When you test a runbook, the [Draft version](#publish-a-runbook) is executed and any actions that it performs are completed. No job history is created, but the [Output](automation-runbook-output-and-messages.md#output-stream) and [Warning and Error](automation-runbook-output-and-messages.md#message-streams) streams are displayed in the Test output pane. Messages to the [Verbose stream](automation-runbook-output-and-messages.md#message-streams) are displayed in the Output pane only if the `VerbosePreference` variable](automation-runbook-output-and-messages.md#preference-variables) is set to Continue.
89
+
When you test a runbook, the [Draft version](#publishing-a-runbook) is executed and any actions that it performs are completed. No job history is created, but the [Output](automation-runbook-output-and-messages.md#output-stream) and [Warning and Error](automation-runbook-output-and-messages.md#message-streams) streams are displayed in the Test output pane. Messages to the [Verbose stream](automation-runbook-output-and-messages.md#message-streams) are displayed in the Output pane only if the [VerbosePreference](automation-runbook-output-and-messages.md#preference-variables)variable is set to `Continue`.
90
90
91
91
Even though the draft version is being run, the runbook still executes normally and performs any actions against resources in the environment. For this reason, you should only test runbooks on non-production resources.
92
92
@@ -100,7 +100,7 @@ The procedure to test each [type of runbook](automation-runbook-types.md) is the
100
100
1. You can use the buttons under the Output pane to stop or suspend a [PowerShell Workflow](automation-runbook-types.md#powershell-workflow-runbooks) or [graphical](automation-runbook-types.md#graphical-runbooks) runbook while it's being tested. When you suspend the runbook, it completes the current activity before being suspended. Once the runbook is suspended, you can stop it or restart it.
101
101
1. Inspect the output from the runbook in the Output pane.
102
102
103
-
## Publish a runbook
103
+
## Publishing a runbook
104
104
105
105
When you create or import a new runbook, you must publish it before you can run it. Each runbook in Azure Automation has a Draft version and a Published version. Only the Published version is available to be run, and only the Draft version can be edited. The Published version is unaffected by any changes to the Draft version. When the Draft version should be made available, you publish it, overwriting the current Published version with the Draft version.
0 commit comments