Skip to main content
Version: 2604 (Preview)

Task 02: Register Cluster Nodes with Azure Arc

Runbook Phase 04 Platform

DOCUMENT CATEGORY: Runbook SCOPE: Arc-enable each Azure Local cluster node using Invoke-AzStackHciArcInitializa... PURPOSE: Arc-enable each Azure Local cluster node using Invoke-AzStackHciArcInitialization MASTER REFERENCE: Register Azure Local with Azure Arc

Status: Active

Overview​

Register all cluster nodes with Azure Arc using Invoke-AzStackHciArcInitialization. Arc registration is a mandatory prerequisite for Azure Local cloud deployment — without it, the deployment orchestrator cannot communicate with the cluster.

Azure Authentication

Arc registration requires authenticating to Azure (not the node OS). Two methods are available:

  • Service principal (SPN) — Production default. SPN secret resolved from Key Vault or prompted securely. Used by both tabs and by the Invoke- script.
  • Device code — Lab/test alternative. Interactive browser-based login via Connect-AzAccount -DeviceCode. Available in the Direct tab.

Node access (RDP for Direct, WinRM for Orchestrated) is separate — it uses the management server session context or your RDP session. No node credentials are passed to Azure.

OEM Image Bootstrap

When nodes ship with a preinstalled or outdated Azure Stack HCI OS image (Dell, HPE, Lenovo, etc.), Invoke-AzStackHciArcInitialization triggers an automatic OS update cycle:

  1. Scan — detect current OS version vs. latest baseline
  2. Download — download update package (~40-60 min depending on network)
  3. Install — apply the OS update
  4. Reboot — node reboots to complete the update (WinRM session disconnects)
  5. Resume — bootstrap service resumes Arc registration using cached SPN token

This is expected behavior. The Invoke-AzStackHciArcInitialization cmdlet manages the full update + reboot + resume cycle internally. The synchronous Invoke-Command session stays alive through reboots — no manual intervention required. Run Task 03 in a separate window to monitor OEM update progress.

See: Handle preinstalled or outdated OS images during Azure Arc registration


Prerequisites​

RequirementDetails
Task 01 passedConnectivity validation succeeded on all nodes
Service principalCreated with Contributor on the resource group
SPN credentialsApp ID and secret available (Key Vault or secure store)
Node accessRDP/console (Direct) or WinRM from mgmt server (Orchestrated)

Variables from variables.yml​

PathTypeDescription
azure_platform.tenant.idstringAzure Tenant ID
azure_platform.subscriptions.lab.idstringAzure Subscription ID
compute.azure_local.arc_resource_groupstringResource group for Arc resources
azure_platform.regionstringAzure region
compute.azure_local.arc_gateway_idstringArc Gateway resource ID
identity.service_principal.client_idstringSPN Application ID
compute.cluster_nodes[].management_ipstringNode management IPs
security.keyvault.kv_azl.kv_azl_namestringKey Vault name

Execution​

Run on each node individually via RDP or console.

Option A: Service Principal Authentication (Production)​

# Task 02 - Register Node with Azure Arc (SPN auth, run on each node)

$TenantId = "REPLACE_TENANT_ID"
$SubscriptionId = "REPLACE_SUBSCRIPTION_ID"
$ResourceGroup = "REPLACE_RESOURCE_GROUP"
$Region = "REPLACE_REGION"
$Cloud = "AzureCloud"
$ArcGatewayId = "REPLACE_ARC_GATEWAY_ID"
$SpnId = "REPLACE_SPN_ID"

if ($TenantId -match '^REPLACE_') { throw 'Edit the REPLACE_ variables before running.' }

# Prompt for SPN secret securely (never hardcode secrets in scripts)
$SpnSecure = Read-Host "Enter SPN secret" -AsSecureString
$SpnSecret = [System.Net.NetworkCredential]::new('', $SpnSecure).Password

# Authenticate with service principal
$SecurePassword = ConvertTo-SecureString $SpnSecret -AsPlainText -Force
$Credential = New-Object System.Management.Automation.PSCredential($SpnId, $SecurePassword)
Connect-AzAccount -ServicePrincipal -TenantId $TenantId -Credential $Credential -SubscriptionId $SubscriptionId

# Get ARM access token
$ArmToken = (Get-AzAccessToken).Token
$AccountId = $SpnId

# Register this node with Arc
Invoke-AzStackHciArcInitialization `
-SubscriptionID $SubscriptionId `
-ResourceGroup $ResourceGroup `
-TenantID $TenantId `
-Region $Region `
-Cloud $Cloud `
-ArmAccessToken $ArmToken `
-AccountID $AccountId `
-ArcGatewayID $ArcGatewayId

Option B: Device Code Authentication (Lab/Test)​

# Task 02 - Register Node with Azure Arc (device code auth, run on each node)

$TenantId = "REPLACE_TENANT_ID"
$SubscriptionId = "REPLACE_SUBSCRIPTION_ID"
$ResourceGroup = "REPLACE_RESOURCE_GROUP"
$Region = "REPLACE_REGION"
$Cloud = "AzureCloud"
$ArcGatewayId = "REPLACE_ARC_GATEWAY_ID"

if ($TenantId -match '^REPLACE_') { throw 'Edit the REPLACE_ variables before running.' }

# Authenticate interactively — opens a browser prompt via device code
Connect-AzAccount -TenantId $TenantId -SubscriptionId $SubscriptionId -DeviceCode

# Get ARM access token
$ArmToken = (Get-AzAccessToken).Token
$AccountId = (Get-AzContext).Account.Id

# Register this node with Arc
Invoke-AzStackHciArcInitialization `
-SubscriptionID $SubscriptionId `
-ResourceGroup $ResourceGroup `
-TenantID $TenantId `
-Region $Region `
-Cloud $Cloud `
-ArmAccessToken $ArmToken `
-AccountID $AccountId `
-ArcGatewayID $ArcGatewayId

Alternative: Configurator App (Preview)​

Microsoft provides a GUI wizard — the Azure Stack HCI Configurator App — that simplifies Arc registration for smaller or first-time deployments.

SettingValueSource
AuthenticationInteractive or Service PrincipalUser preference
Tenant IDFrom variables.ymlazure_platform.tenant.id
Subscription IDFrom variables.ymlazure_platform.subscriptions.lab.id
Resource GroupFrom variables.ymlcompute.azure_local.arc_resource_group
RegionFrom variables.ymlazure_platform.region
Arc GatewayEnabledcompute.azure_local.arc_gateway_id
  1. Download from aka.ms/ashciconfigurator
  2. Launch → Register with Azure Arc
  3. Fill in settings from the table above
  4. Authenticate (device code or SPN)
  5. Click Register and wait for completion

Reference: Microsoft Learn — Use Configurator for Arc Registration


Combined Registration + Monitor (Wrapper Script)​

For OEM image scenarios where nodes will reboot during registration, use the wrapper script to launch both registration and monitoring together:

Start-ArcRegistrationWithMonitor.ps1 — Combined execution
# Launch monitor in a new window + run registration in current window
.\scripts\deploy\04-cluster-deployment\phase-04-arc-registration\task-02-register-cluster-nodes-with-azure-arc\powershell\Start-ArcRegistrationWithMonitor.ps1 `
-ConfigPath .\configs\infrastructure-azl-lab.yml

The wrapper:

  1. Launches Invoke-BootstrapMonitor-Orchestrated.ps1 in a new PowerShell window (background)
  2. Runs Invoke-ArcRegistration-Orchestrated.ps1 in the current window (foreground)
  3. The monitor tracks all OEM update phases while registration runs synchronously
ParameterDefaultDescription
-ConfigPath(required)Path to variables.yml
-TargetNodeall nodesTarget specific node(s) — passed to both scripts
-WhatIf—Dry-run registration only, no monitor window
-PollIntervalSeconds60Monitor poll interval (passed to monitor)
-NoMonitor—Skip launching the monitor window
-SpnSecret—SPN secret override (passed to registration)
-NoArcGateway—Skip Arc Gateway requirement (registration without gateway)
When to Use the Wrapper

Use Start-ArcRegistrationWithMonitor.ps1 when deploying nodes with OEM images that may trigger automatic OS updates and reboots. For fresh installs or nodes already at baseline OS version, Invoke-ArcRegistration-Orchestrated.ps1 alone is sufficient.


Expected Outcomes​

After registration completes on each node, confirm:

# Quick check — run on any node
Get-Service himds | Select-Object Name, Status
& "$env:ProgramFiles\AzureConnectedMachineAgent\azcmagent.exe" show
CheckExpected
himds serviceRunning
azcmagent show statusConnected
Azure Portal → Arc serversAll nodes visible

Troubleshooting​

IssueResolution
SPN auth failsVerify App ID/Secret, confirm Contributor role on RG
Token expired mid-runRe-run Connect-AzAccount and get a fresh token
WinRM denied (orchestrated)Confirm WinRM enabled from Phase 03 and session context (domain trust) is valid — use -Credential override if needed
Arc init timeoutCheck node internet connectivity (Task 01)
Bootstrap reports InProgressOEM updates or registration still running — run Task 03 to monitor
Bootstrap reports Failed (401)SPN token expired or session lost — re-run registration with fresh auth


Alternatives​

The procedures in this task use the scripted methods shown in the tabs above. Additional deployment methods including Azure CLI and Bash scripts are available in the azurelocal-toolkit repository under scripts/deploy/.

MethodDescription
Azure CLIPowerShell-based Azure CLI scripts for Azure resource operations
BashLinux/macOS compatible shell scripts for pipeline environments

← Task 01: Pre-Registration Validation · Task 03: Monitor Bootstrap →


Version Control​

VersionDateAuthorChanges
1.0.02025-03-25Azure Local CloudInitial release