Skip to content

Commit 39cf868

Browse files
authored
Merge pull request #112333 from BethWilke/branch132
Fixing task 1707369
2 parents c8e60ae + 844a51f commit 39cf868

File tree

5 files changed

+44
-30
lines changed

5 files changed

+44
-30
lines changed

articles/automation/automation-connections.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ The function in the following table is used to access connections in a Python 2
6464
6565
## Creating a new connection
6666

67-
### To create a new connection with the Azure portal
67+
### Create a new connection with the Azure portal
6868

6969
1. From your Automation account, click the **Assets** part to open the **Assets** blade.
7070
2. Click the **Connections** part to open the **Connections** blade.
7171
3. Click **Add a connection** at the top of the blade.
7272
4. In the **Type** dropdown, select the type of connection you want to create. The form will present the properties for that particular type.
7373
5. Complete the form and click **Create** to save the new connection.
7474

75-
### To create a new connection with Windows PowerShell
75+
### Create a new connection with Windows PowerShell
7676

7777
Create a new connection with Windows PowerShell using the `New-AzAutomationConnection` cmdlet. This cmdlet has a parameter named `ConnectionFieldValues` that expects a [hashtable](https://technet.microsoft.com/library/hh847780.aspx) defining values for each of the properties defined by the connection type.
7878

@@ -84,7 +84,7 @@ $ConnectionFieldValues = @{"ApplicationId" = $Application.ApplicationId; "Tenant
8484
New-AzAutomationConnection -ResourceGroupName $ResourceGroup -AutomationAccountName $AutomationAccountName -Name $ConnectionAssetName -ConnectionTypeName AzureServicePrincipal -ConnectionFieldValues $ConnectionFieldValues
8585
```
8686

87-
You are able to use the script to create the connection asset because when you create your Automation account, it automatically includes several global modules by default along with the connection type `AzureServicePrincipal` to create the `AzureRunAsConnection` connection asset. This is important to keep in mind, because if you attempt to create a new connection asset to connect to a service or application with a different authentication method, it will fail because the connection type is not already defined in your Automation account. For more information on how to create your own connection type for your custom or module from the [PowerShell Gallery](https://www.powershellgallery.com), see [Integration Modules](automation-integration-modules.md).
87+
When you create your Automation account, it includes several global modules by default, along with the connection type `AzureServicePrincipal` to create the `AzureRunAsConnection` connection asset. If you try to create a new connection asset to connect to a service or application with a different authentication method, the operation fails because the connection type is not already defined in your Automation account. For more information on creating your own connection type for a custom [PowerShell Gallery](https://www.powershellgallery.com) module, see [Integration modules](automation-integration-modules.md).
8888

8989
## Using a connection in a runbook or DSC configuration
9090

articles/automation/automation-solution-vm-management-enable.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Perform the following steps to add the **Start/Stop VMs during off-hours** solut
4141
7. On the Add Solution page, select **Workspace**. Select a Log Analytics workspace that's linked to the same Azure subscription that the Automation account is in. If you don't have a workspace, select **Create New Workspace**. On the Log Analytics workspace page, perform the following steps:
4242

4343
- Specify a name for the new Log Analytics workspace, such as **ContosoLAWorkspace**.
44-
- Select a **Subscription** to link to by selecting from the drop-down list, if the default selected is not appropriate.
44+
- Select a **Subscription** to link to by selecting from the dropdown list, if the default selected is not appropriate.
4545
- For **Resource Group**, you can create a new resource group or select an existing one.
4646
- Select a **Location**.
4747
- Select a **Pricing tier**. Choose the **Per GB (Standalone)** option. Azure Monitor logs have updated [pricing](https://azure.microsoft.com/pricing/details/log-analytics/) and the Per GB tier is the only option.
@@ -85,7 +85,7 @@ Perform the following steps to add the **Start/Stop VMs during off-hours** solut
8585
After all settings are validated, the solution is deployed to your subscription. This process can take several seconds to finish, and you can track its progress under **Notifications** from the menu.
8686

8787
> [!NOTE]
88-
> If you have an Azure Cloud Solution Provider (Azure CSP) subscription, after deployment is complete, in your Automation account, go to **Variables** under **Shared Resources** and set the [**External_EnableClassicVMs**](automation-solution-vm-management.md#variables) variable to **False**. This stops the solution from looking for Classic VM resources.
88+
> If you have an Azure Cloud Solution Provider (Azure CSP) subscription, after deployment is complete, in your Automation account, go to **Variables** under **Shared Resources** and set the [External_EnableClassicVMs](automation-solution-vm-management.md#variables) variable to **False**. This stops the solution from looking for Classic VM resources.
8989
9090
## Next steps
9191

articles/automation/automation-solution-vm-management.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.topic: conceptual
88
---
99
# Start/stop VMs during off-hours solution in Azure Automation
1010

11-
The **Start/stop VMs during off-hours solution** starts or stops your Azure virtual machines. It starts or stops machines on user-defined schedules, provides insights through Azure Monitor logs, and sends optional emails by using [action groups](../azure-monitor/platform/action-groups.md). The solution supports both Azure Resource Manager and classic VMs for most scenarios.
11+
The **Start/stop VMs during off-hours** solution starts or stops your Azure virtual machines. It starts or stops machines on user-defined schedules, provides insights through Azure Monitor logs, and sends optional emails by using [action groups](../azure-monitor/platform/action-groups.md). The solution supports both Azure Resource Manager and classic VMs for most scenarios.
1212

1313
This solution provides a decentralized low-cost automation option for users who want to optimize their VM costs. With this solution, you can:
1414

articles/automation/shared-resources/modules.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,19 @@ When you create an Automation account, Azure Automation imports some modules by
2626
When Azure Automation executes runbook and DSC compilation jobs, it loads the modules into sandboxes where the runbooks can run and the DSC configurations can compile. Automation also automatically places any DSC resources in modules on the DSC pull server. Machines can pull the resources when they apply the DSC configurations.
2727

2828
>[!NOTE]
29-
>Be sure to import only the modules that your runbooks and DSC configurations actually need. Don't import the rollup module, for example, Az.Automation, in any case.
29+
>Be sure to import only the modules that your runbooks and DSC configurations actually need. We don’t recommend importing the root Az module since it includes many other modules that you might not need, which can cause performance problems. Import individual modules, such as Az.Compute, instead.
3030
3131
>[!NOTE]
3232
>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).
3333
3434
## Default modules
3535

36-
The following table lists modules that Azure Automation imports by default when you create your Automation account. Automation can import newer versions of these modules. However, you can't remove the original version from your Automation account even if you delete a newer version. Note that these default modules include several AzureRM modules.
36+
The following table lists modules that Azure Automation imports by default when you create your Automation account. Automation can import newer versions of these modules. However, you can't remove the original version from your Automation account, even if you delete a newer version. Note that these default modules include several AzureRM modules.
37+
38+
Az.Automation modules are preferred in your runbooks and DSC configurations. However, Azure Automation doesn't import the root Az module automatically into any new or existing Automation accounts. For more about working with these modules, see [Migrating to Az modules](#migrating-to-az-modules).
3739

3840
> [!NOTE]
39-
> We don't recommend altering modules and runbooks in Automation accounts that contain any solutions.
41+
> We don't recommend altering modules and runbooks in Automation accounts that contain the [Start/Stop VMs during off-hours solution in Azure Automation](../automation-solution-vm-management.md).
4042
4143
|Module name|Version|
4244
|---|---|
@@ -65,15 +67,12 @@ The following table lists modules that Azure Automation imports by default when
6567
| xPowerShellExecutionPolicy | 1.1.0.0 |
6668
| xRemoteDesktopAdmin | 1.1.0.0 |
6769

68-
69-
Az.Automation modules are preferred in your runbooks and DSC configurations. However, Azure Automation doesn't import the rollup Az module automatically into any new or existing Automation accounts. For more about working with these modules, see [Migrating to Az modules](#migrating-to-az-modules).
70-
7170
## Internal cmdlets
7271

73-
The following table defines the internal cmdlets supported by the `Orchestrator.AssetManagement.Cmdlets` module. Use these in your runbooks and DSC configurations to interact with Automation assets within the Automation account. The cmdlets are designed to retrieve secrets from encrypted variables, credentials, and encrypted connections.
72+
The following table defines the internal cmdlets supported by the `Orchestrator.AssetManagement.Cmdlets` module. Use these cmdlets in your runbooks and DSC configurations to interact with Azure assets within the Automation account. The cmdlets are designed to be used instead of Azure PowerShell cmdlets to retrieve secrets from encrypted variables, credentials, and encrypted connections.
7473

75-
> [!NOTE]
76-
> Azure PowerShell cmdlets can't obtain the asset secrets that the internal cmdlets can retrieve.
74+
>[!NOTE]
75+
>The internal cmdlets are only available when you're executing runbooks in the Azure sandbox environment or on a Windows Hybrid Runbook Worker.
7776
7877
|Name|Description|
7978
|---|---|
@@ -85,42 +84,43 @@ The following table defines the internal cmdlets supported by the `Orchestrator.
8584
|Start-AutomationRunbook|`Start-AutomationRunbook [-Name] <string> [-Parameters <IDictionary>] [-RunOn <string>] [-JobId <guid>] [<CommonParameters>]`|
8685
|Wait-AutomationJob|`Wait-AutomationJob -Id <guid[]> [-TimeoutInMinutes <int>] [-DelayInSeconds <int>] [-OutputJobsTransitionedToRunning] [<CommonParameters>]`|
8786

88-
These internal cmdlets are available on a Windows Hybrid Runbook Worker, but not on a Linux Hybrid Runbook Worker. They're executed from an Orchestrator sandbox, which is used by the hybrid worker. Their use doesn't require an implicit connection to Azure, as when using a Run As account for authentication.
87+
Note that the internal cmdlets differ in naming from the Az and AzureRM cmdlets. Internal cmdlet names don't contain words like “Azure” or “Az” in the noun, but do use the word "Automation". We recommend their use over the use of Az or AzureRM cmdlets during runbook execution in an Azure sandbox or on a Windows hybrid worker. They require fewer parameters and run in the context of your already-executing job.
8988

90-
Instead of using the internal cmdlets, use the Az or AzureRM cmdlets for runbooks and configurations running directly on the computer or against resources in your environment. In these cases, you must implicitly connect to Azure when using the cmdlets, as when using a Run As account to authenticate to Azure.
89+
Use Az or AzureRM cmdlets for manipulating Azure Automation resources outside the context of a runbook. In these cases, you must implicitly connect to Azure when using the cmdlets, as when using a Run As account to authenticate to Azure.
9190

9291
## Modules supporting Get-AutomationPSCredential
9392

9493
For local development using the Azure Automation Authoring Toolkit, the `Get-AutomationPSCredential` cmdlet is part of assembly [AzureAutomationAuthoringToolkit](https://www.powershellgallery.com/packages/AzureAutomationAuthoringToolkit/0.2.3.9). For Azure working with the Automation context, the cmdlet is in `Orchestrator.AssetManagement.Cmdlets`. To find out more about the use of credentials in Azure Automation, see [Credential assets in Azure Automation](credentials.md).
9594

95+
Note that `Get-AutomationPsCredential` returns a `PSCredential` object, which is expected by most PowerShell cmdlets that work with credentials. Most often, you should use this cmdlet instead of the [Get-AzAutomationCredential](https://docs.microsoft.com/powershell/module/az.automation/get-azautomationcredential?view=azps-3.8.0) cmdlet. `Get-AzAutomationCredential` retrieves a [CredentialInfo](https://docs.microsoft.com/dotnet/api/microsoft.azure.commands.automation.model.credentialinfo?view=azurerm-ps) object containing metadata about the credential. This information is not normally helpful to pass to another cmdlet.
96+
9697
## Migrating to Az modules
9798

9899
There are several things to take into consideration when using the Az modules in Azure Automation:
99100

100-
* Higher-level solutions in your Automation account can use runbooks and modules. Therefore, editing runbooks or upgrading modules can potentially cause issues with your solutions. You should test all runbooks and solutions carefully in a separate Automation account before importing the Az modules.
101+
* We don't recommend running AzureRM modules and Az modules in the same Automation account, as it's guaranteed to cause problems. See [Migrate Azure PowerShell from AzureRM to Az](https://docs.microsoft.com/powershell/azure/migrate-from-azurerm-to-az?view=azps-3.7.0).
101102

102-
* Any modifications to modules can negatively affect the [Start/Stop VMs during off hours solution](../automation-solution-vm-management.md).
103+
* Be sure to test all runbooks and DSC configurations carefully in a separate Automation account before importing the Az modules.
103104

104-
* Importing an Az module into your Automation account doesn't automatically import the module in the PowerShell session that runbooks use. Modules are imported into the PowerShell session in the following situations:
105+
* Importing an Az module into your Automation account doesn't automatically import the module into the PowerShell session that runbooks use. Modules are imported into the PowerShell session in the following situations:
105106

106107
* When a runbook invokes a cmdlet from a module
107-
* When a runbook imports the module explicitly with the `Import-Module` cmdlet
108+
* When a runbook imports the module explicitly with the [Import-Module](https://docs.microsoft.com/powershell/module/microsoft.powershell.core/import-module?view=powershell-7) cmdlet
108109
* When a runbook imports another dependent module
109110

110-
After you've completed the migration of your modules, 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.Automation, and operate with Az modules only.
111+
After you've completed the migration of your modules, 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.Automation, and operate with Az modules only.
111112

112113
>[!IMPORTANT]
113114
>When you create a new Automation account, Azure Automation installs the AzureRM modules by default. You can still update the tutorial runbooks with AzureRM cmdlets. However, you should not run these runbooks.
114115
115116
### Stop and unschedule all runbooks that use AzureRM modules
116117

117-
To ensure that you don't 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:
118-
119-
```powershell-interactive
120-
Get-AzureRmAutomationSchedule -AutomationAccountName "<AutomationAccountName>" -ResourceGroupName "<ResourceGroupName>" | Remove-AzureRmAutomationSchedule -WhatIf
121-
```
118+
To ensure that you don't run any existing runbooks that use AzureRM modules, stop and unschedule all affected runbooks using the [Remove-AzureRmAutomationSchedule](https://docs.microsoft.com/powershell/module/azurerm.automation/remove-azurermautomationschedule?view=azurermps-6.13.0) cmdlet. It's important to review each schedule separately to ensure that you can reschedule it in the future for your runbooks, if necessary.
122119

123-
It's important to review each schedule separately to ensure that you can reschedule it in the future for your runbooks, if necessary.
120+
```powershell
121+
Get-AzureRmAutomationSchedule -AutomationAccountName "Contoso17" -Name "DailySchedule08" -ResourceGroupName "ResourceGroup01"
122+
Remove-AzureRmAutomationSchedule -AutomationAccountName "Contoso17" -Name "DailySchedule08" -ResourceGroupName "ResourceGroup01"
123+
```
124124

125125
### Import the Az modules
126126

@@ -139,9 +139,9 @@ This import process can also be done through the [PowerShell Gallery](https://ww
139139

140140
### Test your runbooks
141141

142-
Once you've imported the Az modules into the Automation account, you can start editing the runbooks to use the new modules. The majority of the cmdlets have the same names as for the AzureRM modules, 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).
142+
Once you've imported the Az modules into the Automation account, you can start editing your runbooks to use the new modules. The majority of the cmdlets have the same names as for the AzureRM modules, except that the 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).
143143

144-
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.
144+
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.
145145

146146
## Authoring modules
147147

articles/automation/troubleshoot/runbooks.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,20 @@ To determine what's wrong, take the following steps:
363363
}
364364
```
365365

366+
## <a name="object-reference-not-set"></a>Scenario: Incorrect object reference on call to Add-AzAccount
367+
368+
### Issue
369+
370+
You receive this error when working with `Add-AzAccount`, which is an alias for the `Connect-AzAccount` cmdlet:
371+
372+
```error
373+
Add-AzAccount : Object reference not set to an instance of an object
374+
```
375+
376+
### Cause
377+
378+
This error can occur if the runbook doesn't do the proper steps before calling `Add-AzAccount` to add the Automation account. An example of one of the necessary steps is signing in with a Run As account. For the correct operations to use in your runbook, see [Runbook execution in Azure Automation](https://docs.microsoft.com/azure/automation/automation-runbook-execution).
379+
366380
## <a name="child-runbook-object"></a>Scenario: Object reference not set to an instance of an object
367381

368382
### Issue

0 commit comments

Comments
 (0)