Skip to content

Commit 6800fe5

Browse files
authored
Merge pull request #152950 from v-dturcaso/1830520
1830520
2 parents daf43df + 2f87fda commit 6800fe5

19 files changed

+73
-69
lines changed

articles/automation/automation-child-runbooks.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ When your runbook calls a graphical or PowerShell Workflow child runbook using i
5050
The following example starts a test child runbook that accepts a complex object, an integer value, and a boolean value. The output of the child runbook is assigned to a variable. In this case, the child runbook is a PowerShell Workflow runbook.
5151

5252
```azurepowershell-interactive
53-
$vm = Get-AzVM ResourceGroupName "LabRG" Name "MyVM"
54-
$output = PSWF-ChildRunbook VM $vm RepeatCount 2 Restart $true
53+
$vm = Get-AzVM -ResourceGroupName "LabRG" -Name "MyVM"
54+
$output = PSWF-ChildRunbook -VM $vm -RepeatCount 2 -Restart $true
5555
```
5656

5757
Here is the same example using a PowerShell runbook as the child.
5858

5959
```azurepowershell-interactive
60-
$vm = Get-AzVM ResourceGroupName "LabRG" Name "MyVM"
61-
$output = .\PS-ChildRunbook.ps1 VM $vm RepeatCount 2 Restart $true
60+
$vm = Get-AzVM -ResourceGroupName "LabRG" -Name "MyVM"
61+
$output = .\PS-ChildRunbook.ps1 -VM $vm -RepeatCount 2 -Restart $true
6262
```
6363

6464
## Start a child runbook using a cmdlet
@@ -78,15 +78,15 @@ Parameters for a child runbook started with a cmdlet are provided as a hashtable
7878

7979
The subscription context might be lost when starting child runbooks as separate jobs. For the child runbook to execute Az module cmdlets against a specific Azure subscription, the child must authenticate to this subscription independently of the parent runbook.
8080

81-
If jobs within the same Automation account work with more than one subscription, selecting a subscription in one job can change the currently selected subscription context for other jobs. To avoid this situation, use `Disable-AzContextAutosave Scope Process` at the beginning of each runbook. This action only saves the context to that runbook execution.
81+
If jobs within the same Automation account work with more than one subscription, selecting a subscription in one job can change the currently selected subscription context for other jobs. To avoid this situation, use `Disable-AzContextAutosave -Scope Process` at the beginning of each runbook. This action only saves the context to that runbook execution.
8282

8383
### Example
8484

8585
The following example starts a child runbook with parameters and then waits for it to complete using the `Start-AzAutomationRunbook` cmdlet with the `Wait` parameter. Once completed, the example collects cmdlet output from the child runbook. To use `Start-AzAutomationRunbook`, the script must authenticate to your Azure subscription.
8686

8787
```azurepowershell-interactive
8888
# Ensure that the runbook does not inherit an AzContext
89-
Disable-AzContextAutosave Scope Process
89+
Disable-AzContextAutosave -Scope Process
9090
9191
# Connect to Azure with Run As account
9292
$ServicePrincipalConnection = Get-AutomationConnection -Name 'AzureRunAsConnection'
@@ -102,11 +102,11 @@ $AzureContext = Set-AzContext -SubscriptionId $ServicePrincipalConnection.Subscr
102102
$params = @{"VMName"="MyVM";"RepeatCount"=2;"Restart"=$true}
103103
104104
Start-AzAutomationRunbook `
105-
AutomationAccountName 'MyAutomationAccount' `
106-
Name 'Test-ChildRunbook' `
105+
-AutomationAccountName 'MyAutomationAccount' `
106+
-Name 'Test-ChildRunbook' `
107107
-ResourceGroupName 'LabRG' `
108108
-AzContext $AzureContext `
109-
Parameters $params Wait
109+
-Parameters $params -Wait
110110
```
111111

112112
## Next steps

articles/automation/automation-dsc-cd-chocolatey.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ of VM extensions.
6363
## Quick trip around the diagram
6464

6565
Starting at the top, you write your code, build it, test it, then create an installation package. Chocolatey can handle various types of installation packages, such as MSI, MSU, ZIP. And you have the full power of PowerShell to do the actual installation if Chocolatey's native capabilities
66-
aren't up to it. Put the package into some place reachable a package repository. This usage
66+
aren't up to it. Put the package into some place reachable - a package repository. This usage
6767
example uses a public folder in an Azure blob storage account, but it can be anywhere. Chocolatey
6868
works natively with NuGet servers and a few others for management of package metadata. [This article](https://github.com/chocolatey/choco/wiki/How-To-Host-Feed) describes the options. The usage example uses NuGet. A Nuspec is metadata about your packages. The Nuspec information is compiled into a NuPkg and stored on a NuGet server. When your configuration requests a package by name and references a NuGet server, the Chocolatey DSC resource on the VM grabs the package and installs it. You can also request a specific version of a package.
6969

@@ -100,8 +100,8 @@ Full source for this usage example is in [this Visual Studio project](https://gi
100100
At an authenticated (`Connect-AzAccount`) PowerShell command line: (can take a few minutes while the pull server is set up)
101101

102102
```azurepowershell-interactive
103-
New-AzResourceGroup Name MY-AUTOMATION-RG Location MY-RG-LOCATION-IN-QUOTES
104-
New-AzAutomationAccount ResourceGroupName MY-AUTOMATION-RG Location MY-RG-LOCATION-IN-QUOTES Name MY-AUTOMATION-ACCOUNT
103+
New-AzResourceGroup -Name MY-AUTOMATION-RG -Location MY-RG-LOCATION-IN-QUOTES
104+
New-AzAutomationAccount -ResourceGroupName MY-AUTOMATION-RG -Location MY-RG-LOCATION-IN-QUOTES -Name MY-AUTOMATION-ACCOUNT
105105
```
106106

107107
You can put your Automation account into any of the following regions (also known as locations): East US 2,
@@ -145,7 +145,7 @@ There's also a manual approach, used only once per resource, unless you want to
145145
2. Install the integration module.
146146

147147
```azurepowershell-interactive
148-
Install-Module Name MODULE-NAME` <—grabs the module from the PowerShell Gallery
148+
Install-Module -Name MODULE-NAME` <—grabs the module from the PowerShell Gallery
149149
```
150150
151151
3. Copy the module folder from **c:\Program Files\WindowsPowerShell\Modules\MODULE-NAME** to a temporary folder.
@@ -161,7 +161,7 @@ There's also a manual approach, used only once per resource, unless you want to
161161
```azurepowershell-interactive
162162
New-AzAutomationModule `
163163
-ResourceGroupName MY-AUTOMATION-RG -AutomationAccountName MY-AUTOMATION-ACCOUNT `
164-
-Name MODULE-NAME ContentLinkUri 'https://STORAGE-URI/CONTAINERNAME/MODULE-NAME.zip'
164+
-Name MODULE-NAME -ContentLinkUri 'https://STORAGE-URI/CONTAINERNAME/MODULE-NAME.zip'
165165
```
166166
167167
The included example implements these steps for cChoco and xNetworking.
@@ -171,7 +171,7 @@ The included example implements these steps for cChoco and xNetworking.
171171
There's nothing special about the first time you import your configuration into the pull server and
172172
compile. All later imports or compilations of the same configuration look exactly the same. Each time
173173
you update your package and need to push it out to production you do this step after ensuring the
174-
configuration file is correct including the new version of your package. Here's the configuration file **ISVBoxConfig.ps1**:
174+
configuration file is correct - including the new version of your package. Here's the configuration file **ISVBoxConfig.ps1**:
175175
176176
```powershell
177177
Configuration ISVBoxConfig
@@ -220,18 +220,18 @@ Here is the **New-ConfigurationScript.ps1** script (modified to use the Az modul
220220

221221
```powershell
222222
Import-AzAutomationDscConfiguration `
223-
-ResourceGroupName MY-AUTOMATION-RG AutomationAccountName MY-AUTOMATION-ACCOUNT `
223+
-ResourceGroupName MY-AUTOMATION-RG -AutomationAccountName MY-AUTOMATION-ACCOUNT `
224224
-SourcePath C:\temp\AzureAutomationDsc\ISVBoxConfig.ps1 `
225-
-Published Force
225+
-Published -Force
226226
227227
$jobData = Start-AzAutomationDscCompilationJob `
228-
-ResourceGroupName MY-AUTOMATION-RG AutomationAccountName MY-AUTOMATION-ACCOUNT `
228+
-ResourceGroupName MY-AUTOMATION-RG -AutomationAccountName MY-AUTOMATION-ACCOUNT `
229229
-ConfigurationName ISVBoxConfig
230230
231231
$compilationJobId = $jobData.Id
232232
233233
Get-AzAutomationDscCompilationJob `
234-
-ResourceGroupName MY-AUTOMATION-RG AutomationAccountName MY-AUTOMATION-ACCOUNT `
234+
-ResourceGroupName MY-AUTOMATION-RG -AutomationAccountName MY-AUTOMATION-ACCOUNT `
235235
-Id $compilationJobId
236236
```
237237

articles/automation/automation-dsc-extension-history.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ This article provides information about each version of the Azure DSC VM extensi
306306
- **Remarks:** This version uses DSC as included in Windows Server 2016 Technical Preview; for other
307307
Windows OSs, it installs the [Windows Management Framework 5.0 RTM](https://devblogs.microsoft.com/powershell/windows-management-framework-wmf-5-0-rtm-is-now-available-via-the-microsoft-update-catalog/) (installing WMF requires a reboot).
308308
- **New features:**
309-
- In extension version 2.14, changes to install WMF RTM were included. While upgrading from extension version 2.13.2.0 to 2.14.0.0, you may notice that some DSC cmdlets fail or your configuration fails with an error 'No Instance found with given property values'. For more information, see the [DSC release notes](/powershell/scripting/wmf/known-issues/known-issues-dsc). The workarounds for these issues have been added in 2.15 version.
309+
- In extension version 2.14, changes to install WMF RTM were included. While upgrading from extension version 2.13.2.0 to 2.14.0.0, you may notice that some DSC cmdlets fail or your configuration fails with an error - 'No Instance found with given property values'. For more information, see the [DSC release notes](/powershell/scripting/wmf/known-issues/known-issues-dsc). The workarounds for these issues have been added in 2.15 version.
310310
- If you already installed version 2.14 and are running into one of the above two issues, you need to perform these steps manually. In an elevated PowerShell session run the following commands:
311311
- `Remove-Item -Path $env:SystemRoot\system32\Configuration\DSCEngineCache.mof`
312312
- `mofcomp $env:windir\system32\wbem\DscCoreConfProv.mof`

articles/automation/automation-graphical-authoring-intro.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,19 +323,19 @@ Use [comparison operators](/powershell/module/microsoft.powershell.core/about/ab
323323
For example, the following condition determines if the virtual machine from an activity named `Get-AzureVM` is currently stopped.
324324

325325
```powershell-interactive
326-
$ActivityOutput["Get-AzureVM"].PowerState eq "Stopped"
326+
$ActivityOutput["Get-AzureVM"].PowerState -eq "Stopped"
327327
```
328328

329329
The following condition determines if the same virtual machine is in any state other than stopped.
330330

331331
```powershell-interactive
332-
$ActivityOutput["Get-AzureVM"].PowerState ne "Stopped"
332+
$ActivityOutput["Get-AzureVM"].PowerState -ne "Stopped"
333333
```
334334

335335
You can join multiple conditions in your runbook using a [logical operator](/powershell/module/microsoft.powershell.core/about/about_logical_operators), such as `-and` or `-or`. For example, the following condition checks to see if the virtual machine in the previous example is in a state of Stopped or Stopping.
336336

337337
```powershell-interactive
338-
($ActivityOutput["Get-AzureVM"].PowerState eq "Stopped") -or ($ActivityOutput["Get-AzureVM"].PowerState eq "Stopping")
338+
($ActivityOutput["Get-AzureVM"].PowerState -eq "Stopped") -or ($ActivityOutput["Get-AzureVM"].PowerState -eq "Stopping")
339339
```
340340

341341
### Use hashtables

articles/automation/automation-hrw-run-runbooks.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ To create the GPG keyring and keypair, use the Hybrid Runbook Worker [nxautomati
263263
1. Use the sudo application to sign in as the **nxautomation** account.
264264

265265
```bash
266-
sudo su nxautomation
266+
sudo su - nxautomation
267267
```
268268

269269
1. Once you are using **nxautomation**, generate the GPG keypair. GPG guides you through the steps. You must provide name, email address, expiration time, and passphrase. Then you wait until there is enough entropy on the machine for the key to be generated.
@@ -299,7 +299,7 @@ sudo python /opt/microsoft/omsconfig/modules/nxOMSAutomationWorker/DSCResources/
299299
Once you have configured signature validation, use the following GPG command to sign the runbook.
300300

301301
```bash
302-
gpg -clear-sign <runbook name>
302+
gpg --clear-sign <runbook name>
303303
```
304304

305305
The signed runbook is called **<runbook name>.asc**.
@@ -315,7 +315,7 @@ When you start a runbook in the Azure portal, you're presented with the **Run on
315315
When starting a runbook using PowerShell, use the `RunOn` parameter with the [Start-AzAutomationRunbook](/powershell/module/Az.Automation/Start-AzAutomationRunbook) cmdlet. The following example uses Windows PowerShell to start a runbook named **Test-Runbook** on a Hybrid Runbook Worker group named MyHybridGroup.
316316
317317
```azurepowershell-interactive
318-
Start-AzAutomationRunbook AutomationAccountName "MyAutomationAccount" Name "Test-Runbook" -RunOn "MyHybridGroup"
318+
Start-AzAutomationRunbook -AutomationAccountName "MyAutomationAccount" -Name "Test-Runbook" -RunOn "MyHybridGroup"
319319
```
320320
321321
## Logging

articles/automation/automation-runbook-output-and-messages.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Have your runbook write data to the output stream using [Write-Output](/powershe
3131

3232
```powershell
3333
#The following lines both write an object to the output stream.
34-
Write-Output InputObject $object
34+
Write-Output -InputObject $object
3535
$object
3636
```
3737

@@ -133,8 +133,8 @@ Create a warning or error message using the [Write-Warning](/powershell/module/m
133133
#The following lines create a warning message and then an error message that will suspend the runbook.
134134
135135
$ErrorActionPreference = "Stop"
136-
Write-Warning Message "This is a warning message."
137-
Write-Error Message "This is an error message that will stop the runbook because of the preference variable."
136+
Write-Warning -Message "This is a warning message."
137+
Write-Error -Message "This is an error message that will stop the runbook because of the preference variable."
138138
```
139139

140140
### Write output to debug stream
@@ -192,7 +192,7 @@ The following code creates a verbose message using the [Write-Verbose](/powershe
192192
```powershell
193193
#The following line creates a verbose message.
194194
195-
Write-Verbose Message "This is a verbose message."
195+
Write-Verbose -Message "This is a verbose message."
196196
```
197197

198198
## Handle progress records
@@ -236,22 +236,22 @@ The following example starts a sample runbook and then waits for it to complete.
236236

237237
```powershell
238238
$job = Start-AzAutomationRunbook -ResourceGroupName "ResourceGroup01" `
239-
AutomationAccountName "MyAutomationAccount" Name "Test-Runbook"
239+
-AutomationAccountName "MyAutomationAccount" -Name "Test-Runbook"
240240
241241
$doLoop = $true
242242
While ($doLoop) {
243243
$job = Get-AzAutomationJob -ResourceGroupName "ResourceGroup01" `
244-
AutomationAccountName "MyAutomationAccount" -Id $job.JobId
244+
-AutomationAccountName "MyAutomationAccount" -Id $job.JobId
245245
$status = $job.Status
246246
$doLoop = (($status -ne "Completed") -and ($status -ne "Failed") -and ($status -ne "Suspended") -and ($status -ne "Stopped"))
247247
}
248248
249249
Get-AzAutomationJobOutput -ResourceGroupName "ResourceGroup01" `
250-
AutomationAccountName "MyAutomationAccount" -Id $job.JobId Stream Output
250+
-AutomationAccountName "MyAutomationAccount" -Id $job.JobId -Stream Output
251251
252252
# For more detailed job output, pipe the output of Get-AzAutomationJobOutput to Get-AzAutomationJobOutputRecord
253253
Get-AzAutomationJobOutput -ResourceGroupName "ResourceGroup01" `
254-
AutomationAccountName "MyAutomationAccount" -Id $job.JobId Stream Any | Get-AzAutomationJobOutputRecord
254+
-AutomationAccountName "MyAutomationAccount" -Id $job.JobId -Stream Any | Get-AzAutomationJobOutputRecord
255255
```
256256

257257
### Retrieve runbook output and messages in graphical runbooks

articles/automation/automation-scenario-aws-deployment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.topic: conceptual
99

1010
# Deploy an Amazon Web Services VM with a runbook
1111

12-
In this article, you learn how you can leverage Azure Automation to provision a virtual machine in your Amazon Web Service (AWS) subscription and give that VM a specific name which AWS refers to as “tagging” the VM.
12+
In this article, you learn how you can leverage Azure Automation to provision a virtual machine in your Amazon Web Service (AWS) subscription and give that VM a specific name - which AWS refers to as “tagging” the VM.
1313

1414
## Prerequisites
1515

articles/automation/how-to/automation-region-dns-records.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ We recommend that you use the addresses listed when defining [exceptions](../aut
9393
* [Azure IP Ranges and Service Tags - Azure public](https://www.microsoft.com/download/details.aspx?id=56519)
9494
* [Azure IP Ranges and Service Tags- Azure Government](https://www.microsoft.com/download/details.aspx?id=57063)
9595
* [Azure IP Ranges and Service Tags - Azure Germany](https://www.microsoft.com/download/details.aspx?id=57064)
96-
* [Azure IP Ranges and Service Tags Azure China Vianet 21](https://www.microsoft.com/download/details.aspx?id=57062)
96+
* [Azure IP Ranges and Service Tags - Azure China Vianet 21](https://www.microsoft.com/download/details.aspx?id=57062)
9797

9898
The IP address file lists the IP address ranges that are used in the Microsoft Azure datacenters. It includes compute, SQL, and storage ranges, and reflects currently deployed ranges and any upcoming changes to the IP ranges. New ranges that appear in the file aren't used in the datacenters for at least one week.
9999

articles/automation/learn/automation-tutorial-runbook-textual-powershell.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ As shown in the example below, the Run As connection is made with the [Connect-A
132132
133133
```powershell
134134
# Ensures you do not inherit an AzContext in your runbook
135-
Disable-AzContextAutosave Scope Process
135+
Disable-AzContextAutosave -Scope Process
136136
137137
$connection = Get-AutomationConnection -Name AzureRunAsConnection
138138
@@ -164,7 +164,7 @@ As shown in the example below, the Run As connection is made with the [Connect-A
164164

165165
```powershell
166166
# Ensures you do not inherit an AzContext in your runbook
167-
Disable-AzContextAutosave Scope Process
167+
Disable-AzContextAutosave -Scope Process
168168
169169
$connection = Get-AutomationConnection -Name AzureRunAsConnection
170170
@@ -196,7 +196,7 @@ Now that your runbook is authenticating to your Azure subscription, you can mana
196196

197197
```powershell
198198
# Ensures you do not inherit an AzContext in your runbook
199-
Disable-AzContextAutosave Scope Process
199+
Disable-AzContextAutosave -Scope Process
200200
201201
$connection = Get-AutomationConnection -Name AzureRunAsConnection
202202
while(!($connectionResult) -and ($logonAttempt -le 10))
@@ -231,7 +231,7 @@ Your runbook currently starts the virtual machine that you hard-coded in the run
231231
[string]$ResourceGroupName
232232
)
233233
# Ensures you do not inherit an AzContext in your runbook
234-
Disable-AzContextAutosave Scope Process
234+
Disable-AzContextAutosave -Scope Process
235235
236236
$connection = Get-AutomationConnection -Name AzureRunAsConnection
237237
while(!($connectionResult) -and ($logonAttempt -le 10))

articles/automation/learn/automation-tutorial-runbook-textual.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ You've tested and published your runbook, but so far it doesn't do anything usef
141141

142142
```powershell-interactive
143143
# Ensures you do not inherit an AzContext in your runbook
144-
Disable-AzContextAutosave Scope Process
144+
Disable-AzContextAutosave -Scope Process
145145
146146
$Conn = Get-AutomationConnection -Name AzureRunAsConnection
147147
Connect-AzAccount -ServicePrincipal -Tenant $Conn.TenantID `
@@ -166,7 +166,7 @@ Now that your runbook is authenticating to the Azure subscription, you can manag
166166
workflow MyFirstRunbook-Workflow
167167
{
168168
# Ensures that you do not inherit an AzContext in your runbook
169-
Disable-AzContextAutosave Scope Process
169+
Disable-AzContextAutosave -Scope Process
170170
171171
$Conn = Get-AutomationConnection -Name AzureRunAsConnection
172172
Connect-AzAccount -ServicePrincipal -Tenant $Conn.TenantID -ApplicationId $Conn.ApplicationID -CertificateThumbprint $Conn.CertificateThumbprint
@@ -195,7 +195,7 @@ Your runbook currently starts the VM that you have hardcoded in the runbook. It
195195
[string]$ResourceGroupName
196196
)
197197
# Ensures you do not inherit an AzContext in your runbook
198-
Disable-AzContextAutosave Scope Process
198+
Disable-AzContextAutosave -Scope Process
199199
200200
$Conn = Get-AutomationConnection -Name AzureRunAsConnection
201201
Connect-AzAccount -ServicePrincipal -Tenant $Conn.TenantID -ApplicationId $Conn.ApplicationID -CertificateThumbprint $Conn.CertificateThumbprint

0 commit comments

Comments
 (0)