Skip to content

Commit 671452f

Browse files
Split Az.ConnectedMachine Examples (#17025)
1 parent 4e34a5d commit 671452f

14 files changed

+92
-50
lines changed

src/ConnectedMachine/help/Connect-AzConnectedMachine.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ API to register a new machine and thereby create a tracked resource in ARM
2525

2626
### Example 1: Onboards the machine you're on as a connected machine
2727
```powershell
28-
PS C:\> Connect-AzConnectedMachine -ResourceGroupName contoso-connected-machines -Name linux_eastus1_1 -Location eastus
28+
Connect-AzConnectedMachine -ResourceGroupName contoso-connected-machines -Name linux_eastus1_1 -Location eastus
29+
```
2930

31+
```output
3032
< truncated output of installing the azcmagent >
3133
3234
time="2020-08-07T13:13:25-07:00" level=info msg="Onboarding Machine. It usually takes a few minutes to complete. Sometimes it may take longer depending on network and server load status."
@@ -43,9 +45,11 @@ Onboards the machine you're on as a connected machine.
4345

4446
### Example 2: Onboards a remote machine as a connected device
4547
```powershell
46-
PS C:\> $session = Connect-PSSession -ComputerName WINBOX
47-
PS C:\> Connect-AzConnectedMachine -ResourceGroupName contoso-rg -Name win_eastus1_1 -Location eastus -PSSession $session
48+
$session = Connect-PSSession -ComputerName WINBOX
49+
Connect-AzConnectedMachine -ResourceGroupName contoso-rg -Name win_eastus1_1 -Location eastus -PSSession $session
50+
```
4851

52+
```output
4953
< truncated output of installing the azcmagent >
5054
5155
time="2020-08-07T13:13:25-07:00" level=info msg="Onboarding Machine. It usually takes a few minutes to complete. Sometimes it may take longer depending on network and server load status."

src/ConnectedMachine/help/Get-AzConnectedMachine.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ Retrieves information about the model view or the instance view of a hybrid mach
3636

3737
### Example 1: List all connected machines in a subscription
3838
```powershell
39-
PS C:\> Get-AzConnectedMachine -SubscriptionId 67379433-5e19-4702-b39a-c0a03ca8d20c
39+
Get-AzConnectedMachine -SubscriptionId 67379433-5e19-4702-b39a-c0a03ca8d20c
40+
```
4041

42+
```output
4143
Name Location OSName Status ProvisioningState
4244
---- -------- ------ ------ -----------------
4345
winwestus2_1 westus2 windows Connected Succeeded
@@ -52,8 +54,10 @@ If subscription isn't specified, it will use the subscription from your current
5254

5355
### Example 2: List all connected machines in a resource group
5456
```powershell
55-
PS C:\> Get-AzConnectedMachine -ResourceGroupName contoso-connected-machines
57+
Get-AzConnectedMachine -ResourceGroupName contoso-connected-machines
58+
```
5659

60+
```output
5761
Name Location OSName Status ProvisioningState
5862
---- -------- ------ ------ -----------------
5963
winwestus2_2 westus2 windows Connected Succeeded
@@ -64,8 +68,10 @@ List all connected machines in a resource group.
6468

6569
### Example 3: Get a connected machine in a resource group by name
6670
```powershell
67-
PS C:\> Get-AzConnectedMachine -ResourceGroupName contoso-connected-machines -Name winwestus2_1
71+
Get-AzConnectedMachine -ResourceGroupName contoso-connected-machines -Name winwestus2_1
72+
```
6873

74+
```output
6975
Name Location OSName Status ProvisioningState
7076
---- -------- ------ ------ -----------------
7177
winwestus2_1 westus2 windows Connected Succeeded

src/ConnectedMachine/help/Get-AzConnectedMachineExtension.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ The operation to get the extension.
3131

3232
### Example 1: List all extensions for a machine
3333
```powershell
34-
PS C:\> Get-AzConnectedMachineExtension -ResourceGroupName contoso-connected-machines -MachineName winwestus2_2
34+
Get-AzConnectedMachineExtension -ResourceGroupName contoso-connected-machines -MachineName winwestus2_2
35+
```
3536

37+
```output
3638
Name Location PropertiesType ProvisioningState
3739
---- -------- -------------- -----------------
3840
custom westus2 CustomScriptExtension Succeeded
@@ -44,8 +46,10 @@ Lists all extensions for a specific machine.
4446

4547
### Example 2: Get a specific extension on a machine
4648
```powershell
47-
PS C:\> Get-AzConnectedMachineExtension -ResourceGroupName contoso-connected-machines -MachineName winwestus2_2 -Name dsc
49+
Get-AzConnectedMachineExtension -ResourceGroupName contoso-connected-machines -MachineName winwestus2_2 -Name dsc
50+
```
4851

52+
```output
4953
Name Location PropertiesType ProvisioningState
5054
---- -------- -------------- -----------------
5155
dsc westus2 CustomScriptExtension Succeeded

src/ConnectedMachine/help/Get-AzConnectedPrivateLinkScope.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ Returns a Azure Arc PrivateLinkScope.
3636

3737
### Example 1: List all private link scopes in a resource group
3838
```powershell
39-
PS C:\> Get-AzConnectedPrivateLinkScope -ResourceGroupName $resourceGroupName
39+
Get-AzConnectedPrivateLinkScope -ResourceGroupName $resourceGroupName
40+
```
4041

42+
```output
4143
Name Location PublicNetworkAccess ProvisioningState Tag
4244
---- -------- ------------------- ----------------- ---
4345
name1 eastus2euap Enabled Succeeded Microsoft.Azure.PowerShell.Cmdlets.ConnectedMachine.Models.Api20210520.PrivateLinkScopesResourceTags
@@ -49,8 +51,10 @@ Lists all private link scopes in a specified resource group
4951

5052
### Example 2: Get a private link scope in a resource group by name
5153
```powershell
52-
PS C:\> Get-AzConnectedPrivateLinkScope -ResourceGroupName $resourceGroupName -ScopeName $scopeName
54+
Get-AzConnectedPrivateLinkScope -ResourceGroupName $resourceGroupName -ScopeName $scopeName
55+
```
5356

57+
```output
5458
Name Location PublicNetworkAccess ProvisioningState Tag
5559
---- -------- ------------------- ----------------- ---
5660
name1 eastus2euap Enabled Succeeded Microsoft.Azure.PowerShell.Cmdlets.ConnectedMachine.Models.Api20210520.PrivateLinkScopesRes…

src/ConnectedMachine/help/New-AzConnectedMachineExtension.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ The operation to create or update the extension.
5555

5656
### Example 1: Add a new extension to a machine
5757
```powershell
58-
PS C:\> $Settings = @{ "commandToExecute" = "powershell.exe -c Get-Process" }
59-
PS C:\> New-AzConnectedMachineExtension -Name custom -ResourceGroupName ContosoTest -MachineName win-eastus1 -Location eastus -Publisher "Microsoft.Compute" -TypeHandlerVersion 1.10 -Settings $Settings -ExtensionType CustomScriptExtension
58+
$Settings = @{ "commandToExecute" = "powershell.exe -c Get-Process" }
59+
New-AzConnectedMachineExtension -Name custom -ResourceGroupName ContosoTest -MachineName win-eastus1 -Location eastus -Publisher "Microsoft.Compute" -TypeHandlerVersion 1.10 -Settings $Settings -ExtensionType CustomScriptExtension
60+
```
6061

62+
```output
6163
Name Location ProvisioningState
6264
---- -------- -----------------
6365
custom eastus Succeeded
@@ -67,9 +69,11 @@ Sets an extension on a machine.
6769

6870
### Example 2: Add a new extension with extension parameters specified via the pipeline
6971
```powershell
70-
PS C:\> $otherExtension = Get-AzConnectedMachineExtension -Name custom -ResourceGroupName ContosoTest -MachineName other
71-
PS C:\> $otherExtension | New-AzConnectedMachineExtension -Name custom -ResourceGroupName ContosoTest -MachineName important
72+
$otherExtension = Get-AzConnectedMachineExtension -Name custom -ResourceGroupName ContosoTest -MachineName other
73+
$otherExtension | New-AzConnectedMachineExtension -Name custom -ResourceGroupName ContosoTest -MachineName important
74+
```
7275

76+
```output
7377
Name Location ProvisioningState
7478
---- -------- -----------------
7579
custom eastus Succeeded
@@ -80,12 +84,14 @@ This is great if you want to grab the parameters of one machine and apply it to
8084

8185
### Example 3: Add a new extension with location specified via the pipeline
8286
```powershell
83-
PS C:\> $identity = [Microsoft.Azure.PowerShell.Cmdlets.ConnectedMachine.Models.ConnectedMachineIdentity]@{
87+
$identity = [Microsoft.Azure.PowerShell.Cmdlets.ConnectedMachine.Models.ConnectedMachineIdentity]@{
8488
Id = "/subscriptions/$($SubscriptionId)/resourceGroups/$($ResourceGroupName)/providers/Microsoft.HybridCompute/machines/$MachineName/extensions/$ExtensionName"
8589
}
86-
PS C:\> $Settings = @{ "commandToExecute" = "powershell.exe -c Get-Process" }
87-
PS C:\> $identity | New-AzConnectedMachineExtension -Location eastus -Publisher "Microsoft.Compute" -TypeHandlerVersion 1.10 -Settings $Settings -ExtensionType CustomScriptExtension
90+
$Settings = @{ "commandToExecute" = "powershell.exe -c Get-Process" }
91+
$identity | New-AzConnectedMachineExtension -Location eastus -Publisher "Microsoft.Compute" -TypeHandlerVersion 1.10 -Settings $Settings -ExtensionType CustomScriptExtension
92+
```
8893

94+
```output
8995
Name Location ProvisioningState
9096
---- -------- -----------------
9197
custom eastus Succeeded
@@ -96,8 +102,8 @@ You likely won't do this, but it's possible.
96102

97103
### Example 4: Add a new extension using an extension object as both the location and parameters for updating
98104
```powershell
99-
PS C:\> $ext = Get-AzConnectedMachineExtension -Name custom -ResourceGroupName ContosoTest -MachineName other
100-
PS C:\> $ext | New-AzConnectedMachineExtension -ExtensionParameter $ext
105+
$ext = Get-AzConnectedMachineExtension -Name custom -ResourceGroupName ContosoTest -MachineName other
106+
$ext | New-AzConnectedMachineExtension -ExtensionParameter $ext
101107
```
102108

103109
This creates a new machine extension using the identity provided via the pipeline and the extension details provided by the passed in extension object.

src/ConnectedMachine/help/New-AzConnectedPrivateLinkScope.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@ Note: You cannot specify a different value for InstrumentationKey nor AppId in t
4949

5050
### Example 1: Add a new private link scope in a subscription
5151
```powershell
52-
PS C:\> New-AzConnectedPrivateLinkScope -ResourceGroupName $resourceGroupName -ScopeName $scopeName -PublicNetworkAccess "Enabled" -Location $location
52+
New-AzConnectedPrivateLinkScope -ResourceGroupName $resourceGroupName -ScopeName $scopeName -PublicNetworkAccess "Enabled" -Location $location
53+
```
5354

55+
```output
5456
Name Location PublicNetworkAccess ProvisioningState Tag
5557
---- -------- ------------------- ----------------- ---
5658
name1 eastus2euap Enabled Succeeded Microsoft.Azure.PowerShell.Cmdlets.ConnectedMachine.Models.Api20210520.PrivateLinkScopesReso…

src/ConnectedMachine/help/Remove-AzConnectedMachine.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,14 @@ The operation to remove a hybrid machine identity in Azure.
3131

3232
### Example 1: Remove a connected machine
3333
```powershell
34-
PS C:\> Remove-AzConnectedMachine -Name myMachine -ResourceGroupName myRG
35-
34+
Remove-AzConnectedMachine -Name myMachine -ResourceGroupName myRG
3635
```
3736

3837
Deletes the connected machine.
3938

4039
### Example 2: Remove connected machines via the pipeline
4140
```powershell
42-
PS C:\> Get-AzConnectedMachine -ResourceGroupName contoso-connected-machines | Remove-AzConnectedMachine
43-
41+
Get-AzConnectedMachine -ResourceGroupName contoso-connected-machines | Remove-AzConnectedMachine
4442
```
4543

4644
Removes all machines in the `contoso-connected-machines` resource group.

src/ConnectedMachine/help/Remove-AzConnectedMachineExtension.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,14 @@ The operation to delete the extension.
3232

3333
### Example 1: Remove a machine extension.
3434
```powershell
35-
PS C:\> Remove-AzConnectedMachineExtension -MachineName myMachine -ResourceGroupName myRG -Name custom
36-
35+
Remove-AzConnectedMachineExtension -MachineName myMachine -ResourceGroupName myRG -Name custom
3736
```
3837

3938
Deletes the extension on the machine.
4039

4140
### Example 2: Remove extension via the pipeline
4241
```powershell
43-
PS C:\> Get-AzConnectedMachineExtension -ResourceGroupName contoso-connected-machines -MachineName myMachine | Remove-AzConnectedMachineExtension
44-
42+
Get-AzConnectedMachineExtension -ResourceGroupName contoso-connected-machines -MachineName myMachine | Remove-AzConnectedMachineExtension
4543
```
4644

4745
Removes all extensions in the specified machine.

src/ConnectedMachine/help/Remove-AzConnectedPrivateLinkScope.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ Deletes a Azure Arc PrivateLinkScope.
3131

3232
### Example 1: Remove a private link scope in a subscription by name
3333
```powershell
34-
PS C:\> Remove-AzConnectedPrivateLinkScope -ResourceGroupName $resourceGroupName -ScopeName $scopeName
34+
Remove-AzConnectedPrivateLinkScope -ResourceGroupName $resourceGroupName -ScopeName $scopeName
35+
```
3536

37+
```output
3638
<None>
3739
```
3840

src/ConnectedMachine/help/Set-AzConnectedMachineExtension.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ The operation to create or update the extension.
3737

3838
### Example 1: Set an extension on a machine
3939
```powershell
40-
PS C:\> $Settings = @{ "commandToExecute" = "powershell.exe -c Get-Process" }
41-
PS C:\> Set-AzConnectedMachineExtension -Name custom -ResourceGroupName ContosoTest -MachineName win-eastus1 -Location eastus -Publisher "Microsoft.Compute" -TypeHandlerVersion 1.10 -Settings $Settings -ExtensionType CustomScriptExtension
40+
$Settings = @{ "commandToExecute" = "powershell.exe -c Get-Process" }
41+
Set-AzConnectedMachineExtension -Name custom -ResourceGroupName ContosoTest -MachineName win-eastus1 -Location eastus -Publisher "Microsoft.Compute" -TypeHandlerVersion 1.10 -Settings $Settings -ExtensionType CustomScriptExtension
42+
```
4243

44+
```output
4345
Name Location ProvisioningState
4446
---- -------- -----------------
4547
custom eastus Succeeded
@@ -49,9 +51,11 @@ Sets an extension on a machine.
4951

5052
### Example 2: Set an extension with extension parameters specified via the pipeline
5153
```powershell
52-
PS C:\> $otherExtension = Get-AzConnectedMachineExtension -Name custom -ResourceGroupName ContosoTest -MachineName other
53-
PS C:\> $otherExtension | Set-AzConnectedMachineExtension -Name custom -ResourceGroupName ContosoTest -MachineName important
54+
$otherExtension = Get-AzConnectedMachineExtension -Name custom -ResourceGroupName ContosoTest -MachineName other
55+
$otherExtension | Set-AzConnectedMachineExtension -Name custom -ResourceGroupName ContosoTest -MachineName important
56+
```
5457

58+
```output
5559
Name Location ProvisioningState
5660
---- -------- -----------------
5761
custom eastus Succeeded

src/ConnectedMachine/help/Set-AzConnectedPrivateLinkScope.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ Note: You cannot specify a different value for InstrumentationKey nor AppId in t
3535

3636
### Example 1: Set a private link scope in a subscription by name
3737
```powershell
38-
PS C:\> Set-AzConnectedPrivateLinkScope -ResourceGroupName $resourceGroupName -ScopeName $scopeName -PublicNetworkAccess "Disabled" -Tag $tags -Location $location
38+
Set-AzConnectedPrivateLinkScope -ResourceGroupName $resourceGroupName -ScopeName $scopeName -PublicNetworkAccess "Disabled" -Tag $tags -Location $location
39+
```
3940

41+
```output
4042
Name Location PublicNetworkAccess ProvisioningState Tag
4143
---- -------- ------------------- ----------------- ---
4244
name eastus2euap Disabled Succeeded Microsoft.Azure.PowerShell.Cmdlets.ConnectedMachine.Models.Api20210520.PrivateLinkScopesRes…

src/ConnectedMachine/help/Update-AzConnectedExtension.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@ The operation to Upgrade Machine Extensions.
4646

4747
### Example 1: Update an extension in a machine to a specific version
4848
```powershell
49-
PS C:\> $target = @{"Microsoft.Compute.CustomScriptExtension" = @{"targetVersion"="1.10.12"}}
50-
PS C:\> Update-AzConnectedExtension -ResourceGroupName $env.ResourceGroupName -MachineName $machineName -ExtensionTarget $target
49+
$target = @{"Microsoft.Compute.CustomScriptExtension" = @{"targetVersion"="1.10.12"}}
50+
Update-AzConnectedExtension -ResourceGroupName $env.ResourceGroupName -MachineName $machineName -ExtensionTarget $target
51+
```
5152

53+
```output
5254
<None>
5355
```
5456

src/ConnectedMachine/help/Update-AzConnectedMachineExtension.md

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,18 @@ The operation to create or update the extension.
5050

5151
### Example 1: Update an extension
5252
```powershell
53-
PS C:\> $splat = @{
53+
$splat = @{
5454
ResourceGroupName = "connectedMachines"
5555
MachineName = "linux-eastus1_1"
5656
Name = "customScript"
5757
Settings = @{
5858
commandToExecute = "ls -l"
5959
}
6060
}
61-
PS C:\> Update-AzConnectedMachineExtension @splat
61+
Update-AzConnectedMachineExtension @splat
62+
```
6263

64+
```output
6365
Name Location ProvisioningState
6466
---- -------- -----------------
6567
customScript eastus Succeeded
@@ -69,11 +71,13 @@ Updates an extension on a specific machine.
6971

7072
### Example 2: Update an extension with location specified via the pipeline
7173
```powershell
72-
PS C:\> $extToUpdate = Get-AzConnectedMachineExtension -ResourceGroupName connectedMachines -MachineName linux-eastus1_1 -Name customScript
73-
PS C:\> $extToUpdate | Update-AzConnectedMachineExtension -Settings @{
74+
$extToUpdate = Get-AzConnectedMachineExtension -ResourceGroupName connectedMachines -MachineName linux-eastus1_1 -Name customScript
75+
$extToUpdate | Update-AzConnectedMachineExtension -Settings @{
7476
commandToExecute = "ls -l"
7577
}
78+
```
7679

80+
```output
7781
Name Location ProvisioningState
7882
---- -------- -----------------
7983
customScript eastus Succeeded
@@ -84,16 +88,18 @@ Here we are using the extension passed in via the pipeline to help us identify w
8488

8589
### Example 3: Update an extension with extension parameters specified via the pipeline
8690
```powershell
87-
PS C:\> $extToUpdate = Get-AzConnectedMachineExtension -ResourceGroupName connectedMachines -MachineName linux-eastus1_1 -Name customScript
88-
PS C:\> # Update the settings on the object that will be used via the pipeline
89-
PS C:\> $extToUpdate.Setting.commandToExecute = "ls -l"
90-
PS C:\> $splat = @{
91+
$extToUpdate = Get-AzConnectedMachineExtension -ResourceGroupName connectedMachines -MachineName linux-eastus1_1 -Name customScript
92+
# Update the settings on the object that will be used via the pipeline
93+
$extToUpdate.Setting.commandToExecute = "ls -l"
94+
$splat = @{
9195
ResourceGroupName = "connectedMachines"
9296
MachineName = "linux-eastus1_1"
9397
Name = "customScript"
9498
}
95-
PS C:\> $extToUpdate | Update-AzConnectedMachineExtension @splat
99+
$extToUpdate | Update-AzConnectedMachineExtension @splat
100+
```
96101

102+
```output
97103
Name Location ProvisioningState
98104
---- -------- -----------------
99105
customScript eastus Succeeded
@@ -105,11 +111,13 @@ The location of the extension is not retrieved via the pipeline but rather via t
105111

106112
### Example 4: Using an extension object as both the location and parameters for updating
107113
```powershell
108-
PS C:\> $extToUpdate = Get-AzConnectedMachineExtension -ResourceGroupName connectedMachines -MachineName linux-eastus1_1 -Name customScript
109-
PS C:\> # Update the settings on the object that will be used via the pipeline
110-
PS C:\> $extToUpdate.Setting.commandToExecute = "ls -l"
111-
PS C:\> $extToUpdate | Update-AzConnectedMachineExtension -ExtensionParameter $extToUpdate
114+
$extToUpdate = Get-AzConnectedMachineExtension -ResourceGroupName connectedMachines -MachineName linux-eastus1_1 -Name customScript
115+
# Update the settings on the object that will be used via the pipeline
116+
$extToUpdate.Setting.commandToExecute = "ls -l"
117+
$extToUpdate | Update-AzConnectedMachineExtension -ExtensionParameter $extToUpdate
118+
```
112119

120+
```output
113121
Name Location ProvisioningState
114122
---- -------- -----------------
115123
customScript eastus Succeeded

src/ConnectedMachine/help/Update-AzConnectedPrivateLinkScopeTag.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ To update other fields use the CreateOrUpdate method.
4747

4848
### Example 1: Update the tags of a private link scope
4949
```powershell
50-
PS C:\> Update-AzConnectedPrivateLinkScopeTag -ResourceGroupName $resourceGroupName -ScopeName $scopeName -Tag $tags2
50+
Update-AzConnectedPrivateLinkScopeTag -ResourceGroupName $resourceGroupName -ScopeName $scopeName -Tag $tags2
51+
```
5152

53+
```output
5254
Name Location PublicNetworkAccess ProvisioningState Tag
5355
---- -------- ------------------- ----------------- ---
5456
name eastus2euap Disabled Succeeded Microsoft.Azure.PowerShell.Cmdlets.ConnectedMachine.Models.Api20210520.PrivateLinkScopesRes…

0 commit comments

Comments
 (0)