Modifier

Partager via


Connect-AzConnectedMachine

API to register a new machine and thereby create a tracked resource in ARM

Syntax

Connect-AzConnectedMachine
       [-ResourceGroupName] <String>
       [[-SubscriptionId] <String>]
       [[-Name] <String>]
       [-Location] <String>
       [[-PSSession] <PSSession[]>]
       [[-Tag] <Hashtable>]
       [[-DefaultProfile] <PSObject>]
       [[-Proxy] <Uri>]
       [<CommonParameters>]

Description

API to register a new machine and thereby create a tracked resource in ARM

Examples

Example 1: Onboards the machine you're on as a connected machine

Connect-AzConnectedMachine -ResourceGroupName contoso-connected-machines -Name linux_eastus1_1 -Location eastus

< truncated output of installing the azcmagent >

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."
time="2020-08-07T13:13:25-07:00" level=info msg="Check network connectivity to all endpoints..."
time="2020-08-07T13:13:29-07:00" level=info msg="All endpoints are available... continue onboarding"
time="2020-08-07T13:13:50-07:00" level=info msg="Successfully Onboarded Resource to Azure" VM Id=********-****-****-****-**********

Name             Location OSName   Status     ProvisioningState
----             -------- ------   ------     -----------------
linux_eastus1_1  eastus   linux    Connected  Succeeded

Onboards the machine you're on as a connected machine.

Example 2: Onboards a remote machine as a connected device

$session = Connect-PSSession -ComputerName WINBOX
Connect-AzConnectedMachine -ResourceGroupName contoso-rg -Name win_eastus1_1 -Location eastus -PSSession $session

< truncated output of installing the azcmagent >

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."
time="2020-08-07T13:13:25-07:00" level=info msg="Check network connectivity to all endpoints..."
time="2020-08-07T13:13:29-07:00" level=info msg="All endpoints are available... continue onboarding"
time="2020-08-07T13:13:50-07:00" level=info msg="Successfully Onboarded Resource to Azure" VM Id=********-****-****-****-**********


Name           Location OSName   Status     ProvisioningState
----           -------- ------   ------     -----------------
win_eastus1_1  eastus   windows  Connected  Succeeded

Onboards a remote machine as a connected device using PowerShell remoting. Note: only Windows as the target is supported at this time.

Parameters

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:PSObject
Aliases:AzureRMContext, AzureCredential
Position:5
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Location

The location for the created ConnectedMachine.

Type:String
Position:3
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Name

The name that will be used for this machine. The hostname is used by default.

Type:String
Position:4
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Proxy

The URI for the proxy server to use

Type:Uri
Position:8
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PSSession

When specified, the command that onboards machines to Azure will be run within each PSSession. NOTE: This only works on Windows for now.

Type:PSSession[]
Aliases:Session
Position:6
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ResourceGroupName

The name of the resource group you want to add the machine to.

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-SubscriptionId

The ID of the subscription you want to add the machine to.

Type:String
Position:2
Default value:(Get-AzContext).Subscription.Id
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Tag

Resource tags.

Type:Hashtable
Position:7
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False