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
+20-18Lines changed: 20 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,58 +9,60 @@ ms.topic: conceptual
9
9
10
10
# Az module support in Azure Automation
11
11
12
-
Azure automation supports the ability to use the[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. This article discusses how to use Az modules with Azure Automation.
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.
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 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.
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
20
* When a cmdlet from a module is invoked from a runbook
21
21
* When a runbook imports it explicitly with the `Import-Module` cmdlet
22
22
* When another module depending on the module is imported into a PowerShell session
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 will complete, but an [error referencing the get_SerializationSettings method](troubleshoot/runbooks.md#get-serializationsettings)will show in the job streams and cmdlets may have not been properly executed. If you import `AzureRM` and then `Az` your runbook will still complete, but you will see an error in the job streams stating that both `Az` and `AzureRM`cannot be imported in the same session or used in the same runbook.
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.
26
26
27
27
## Migrating to Az modules
28
28
29
-
It's recommended you test the migration to using Az modules instead of AzureRM modules in a test Automation Account. Once that Automation Account has been created, you can use the following steps to ensure your migration goes smoothly:
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.
30
30
31
-
### Stop and unschedule all runbook that uses AzureRM modules
31
+
### Stop and unschedule all runbooks that use AzureRM cmdlets
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 the following example:
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.
It's important to review each schedule separately to ensure 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 of the `Az.*` modules to be imported. This guidance is the same for all modules.
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.
44
44
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.
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
46
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.
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
48
49
-

49
+

50
50
51
-
This import process can also be done through the [PowerShell Gallery](https://www.powershellgallery.com) by searching for the module. Once you find the module, select it and under the **Azure Automation** tab, click **Deploy to Azure Automation**.
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**.
52
52
53
53

54
54
55
-
## Test your runbooks
55
+
## Testing your runbooks
56
56
57
-
Once the `Az` modules are imported in your Automation Account, you can now start editing your runbooks to use the Az module instead. The majority of the cmdlets have the same name except for`AzureRM` has been changed to `Az`. For a list of modules that do not follow this process, see [list of exceptions](/powershell/azure/migrate-from-azurerm-to-az#update-cmdlets-modules-and-parameters).
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).
58
58
59
-
One way to test your runbooks before modifying your runbook to use the new cmdlets is by using `Enable-AzureRMAlias -Scope Process` at the beginning of a runbook. By adding this to your runbook, your runbook can run without changes.
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.
60
60
61
-
## Aftermigration details
61
+
## After-migration details
62
62
63
-
After the migration is complete, don't start runbooks using `AzureRM` modules on the account any longer. It's also recommended don't import or update `AzureRM` modules on this account. Starting from this moment, consider this account migrated to `Az`, and operate with `Az` modules only. When a new Automation Account is created the existing `AzureRM` modules will still be installed and the tutorial runbooks will still be authored with `AzureRM` cmdlets. These runbooks should not be run.
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.
64
+
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.
0 commit comments