Skip to content

Commit 8732f7e

Browse files
Merge pull request #267617 from SnehaSudhirG/29Feb-KnownIssue
Added new known issue
2 parents 692fc51 + 613d5ed commit 8732f7e

File tree

1 file changed

+62
-1
lines changed

1 file changed

+62
-1
lines changed

articles/automation/automation-runbook-types.md

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Azure Automation runbook types
33
description: This article describes the types of runbooks that you can use in Azure Automation and considerations for determining which type to use.
44
services: automation
55
ms.subservice: process-automation
6-
ms.date: 02/22/2024
6+
ms.date: 02/29/2024
77
ms.topic: conceptual
88
ms.custom: references_regions, devx-track-python
99
---
@@ -82,6 +82,27 @@ The following are the current limitations and known issues with PowerShell runbo
8282
- Executing child scripts using `.\child-runbook.ps1` is not supported.</br>
8383
**Workaround**: Use `Start-AutomationRunbook` (internal cmdlet) or `Start-AzAutomationRunbook` (from *Az.Automation* module) to start another runbook from parent runbook.
8484
- When you use [ExchangeOnlineManagement](/powershell/exchange/exchange-online-powershell?view=exchange-ps&preserve-view=true) module version: 3.0.0 or higher, you can experience errors. To resolve the issue, ensure that you explicitly upload [PowerShellGet](/powershell/module/powershellget/) and [PackageManagement](/powershell/module/packagemanagement/) modules.
85+
- When you utilize the `New-AzAutomationVariable`  cmdlet within Az.Automation Module to upload a variable of type **object**, the operation doesn't function as expected.
86+
87+
**Workaround**: Convert the object to a JSON string using the ConvertTo-Json cmdlet and then upload the variable with the JSON string as its value. This workaround ensures proper handling of the variable within the Azure Automation environment as a JSON string.
88+
89+
**Example** - Create a PowerShell object that has stored information around Azure VMs
90+
91+
```azurepowershell
92+
# Retrieve Azure virtual machines with status information for the 'northeurope' region
93+
$AzVM = Get-AzVM -Status | Where-Object {$_.Location -eq "northeurope"}
94+
95+
$VMstopatch = @($AzVM).Id
96+
# Create an Azure Automation variable (This cmdlet will not fail, but the variable may not work as intended when used in the runbook.)
97+
New-AzAutomationVariable -ResourceGroupName "mrg" -AutomationAccountName "mAutomationAccount2" -Name "complex1" -Encrypted $false -Value $VMstopatch
98+
99+
# Convert the object to a JSON string
100+
$jsonString = $VMstopatch | ConvertTo-Json
101+
102+
# Create an Azure Automation variable with a JSON string value (works effectively within the automation runbook)
103+
New-AzAutomationVariable -ResourceGroupName "mrg" -AutomationAccountName "mAutomationAccount2" -Name "complex1" -Encrypted $false -Value $jsonString
104+
```
105+
85106

86107
# [PowerShell 5.1](#tab/lps51)
87108

@@ -126,6 +147,26 @@ The following are the current limitations and known issues with PowerShell runbo
126147
* A PowerShell runbook can fail if it tries to write a large amount of data to the output stream at once. You can typically work around this issue by having the runbook output just the information needed to work with large objects. For example, instead of using `Get-Process` with no limitations, you can have the cmdlet output just the required parameters as in `Get-Process | Select ProcessName, CPU`.
127148
* When you use [ExchangeOnlineManagement](/powershell/exchange/exchange-online-powershell?view=exchange-ps&preserve-view=true) module version: 3.0.0 or higher, you may experience errors. To resolve the issue, ensure that you explicitly upload [PowerShellGet](/powershell/module/powershellget/) and [PackageManagement](/powershell/module/packagemanagement/) modules as well.
128149
* If you import module Az.Accounts with version 2.12.3 or newer, ensure that you import the **Newtonsoft.Json** v10 module explicitly if PowerShell 5.1 runbooks have a dependency on this version of the module. The workaround for this issue is to use PowerShell 7.2 runbooks.
150+
* When you utilize the `New-AzAutomationVariable` cmdlet within Az.Automation Module to upload a variable of type **object**, the operation doesn't function as expected.
151+
152+
**Workaround**: Convert the object to a JSON string using the ConvertTo-Json cmdlet and then upload the variable with the JSON string as its value. This workaround ensures proper handling of the variable within the Azure Automation environment as a JSON string.
153+
154+
**Example** - Create a PowerShell object that has stored information around Azure VMs
155+
156+
```azurepowershell
157+
# Retrieve Azure virtual machines with status information for the 'northeurope' region
158+
$AzVM = Get-AzVM -Status | Where-Object {$_.Location -eq "northeurope"}
159+
160+
$VMstopatch = @($AzVM).Id
161+
# Create an Azure Automation variable (This cmdlet will not fail, but the variable may not work as intended when used in the runbook.)
162+
New-AzAutomationVariable -ResourceGroupName "mrg" -AutomationAccountName "mAutomationAccount2" -Name "complex1" -Encrypted $false -Value $VMstopatch
163+
164+
# Convert the object to a JSON string
165+
$jsonString = $VMstopatch | ConvertTo-Json
166+
167+
# Create an Azure Automation variable with a JSON string value (works effectively within the automation runbook)
168+
New-AzAutomationVariable -ResourceGroupName "mrg" -AutomationAccountName "mAutomationAccount2" -Name "complex1" -Encrypted $false -Value $jsonString
169+
```
129170

130171
# [PowerShell 7.1](#tab/lps71)
131172

@@ -183,6 +224,26 @@ The following are the current limitations and known issues with PowerShell runbo
183224
- When you start PowerShell 7 runbook using the webhook, it auto-converts the webhook input parameter to an invalid JSON.
184225
- We recommend that you use [ExchangeOnlineManagement](/powershell/exchange/exchange-online-powershell?view=exchange-ps&preserve-view=true) module version: 3.0.0 or lower because version: 3.0.0 or higher may lead to job failures.
185226
- If you import module Az.Accounts with version 2.12.3 or newer, ensure that you import the **Newtonsoft.Json** v10 module explicitly if PowerShell 7.1 runbooks have a dependency on this version of the module. The workaround for this issue is to use PowerShell 7.2 runbooks.
227+
- When you utilize the `New-AzAutomationVariable`  cmdlet within Az.Automation Module to upload a variable of type **object**, the operation doesn't function as expected.
228+
229+
**Workaround**: Convert the object to a JSON string using the ConvertTo-Json cmdlet and then upload the variable with the JSON string as its value. This workaround ensures proper handling of the variable within the Azure Automation environment as a JSON string.
230+
231+
**Example** - Create a PowerShell object that has stored information around Azure VMs
232+
233+
```azurepowershell
234+
# Retrieve Azure virtual machines with status information for the 'northeurope' region
235+
$AzVM = Get-AzVM -Status | Where-Object {$_.Location -eq "northeurope"}
236+
237+
$VMstopatch = @($AzVM).Id
238+
# Create an Azure Automation variable (This cmdlet will not fail, but the variable may not work as intended when used in the runbook.)
239+
New-AzAutomationVariable -ResourceGroupName "mrg" -AutomationAccountName "mAutomationAccount2" -Name "complex1" -Encrypted $false -Value $VMstopatch
240+
241+
# Convert the object to a JSON string
242+
$jsonString = $VMstopatch | ConvertTo-Json
243+
244+
# Create an Azure Automation variable with a JSON string value (works effectively within the automation runbook)
245+
New-AzAutomationVariable -ResourceGroupName "mrg" -AutomationAccountName "mAutomationAccount2" -Name "complex1" -Encrypted $false -Value $jsonString
246+
```
186247
---
187248

188249
## PowerShell Workflow runbooks

0 commit comments

Comments
 (0)