Skip to content

Commit 613d5ed

Browse files
committed
minor formatting edit
1 parent 7b03005 commit 613d5ed

File tree

1 file changed

+48
-48
lines changed

1 file changed

+48
-48
lines changed

articles/automation/automation-runbook-types.md

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -84,24 +84,24 @@ The following are the current limitations and known issues with PowerShell runbo
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.
8585
- 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.
8686

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.
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.
8888

89-
**Example** - Create a PowerShell object that has stored information around Azure VMs
89+
**Example** - Create a PowerShell object that has stored information around Azure VMs
9090

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-
```
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+
```
105105

106106

107107
# [PowerShell 5.1](#tab/lps51)
@@ -149,24 +149,24 @@ New-AzAutomationVariable -ResourceGroupName "mrg" -AutomationAccountName "mAutom
149149
* 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.
150150
* 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.
151151

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"}
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.
159153

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
154+
**Example** - Create a PowerShell object that has stored information around Azure VMs
163155

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-
```
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+
```
170170

171171
# [PowerShell 7.1](#tab/lps71)
172172

@@ -226,24 +226,24 @@ New-AzAutomationVariable -ResourceGroupName "mrg" -AutomationAccountName "mAutom
226226
- 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.
227227
- 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.
228228

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"}
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.
236230

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
231+
**Example** - Create a PowerShell object that has stored information around Azure VMs
240232

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-
```
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+
```
247247
---
248248

249249
## PowerShell Workflow runbooks

0 commit comments

Comments
 (0)