Edit

Register Azure Local with Azure Arc using Arc gateway

This article details how to register Azure Local using Azure Arc gateway and with the proxy configuration enabled. Once you create an Arc gateway resource in your Azure subscription, you can enable the Arc gateway features. For an overview of the Arc gateway, see About Azure Arc gateway for Azure Local.

  • Configure proxy with a script: Using this method, you can configure Arc proxy with a script. This method is useful as you don't need to configure the Arc proxy across WinInet, WinHttp, or environment variables manually.

  • Set up proxy via the Configurator app: Using this method, you can configure the Arc proxy via a user interface. This method is useful if you prefer not to use scripts or if you want to configure the proxy settings interactively.

Prerequisites

Step 1: Get the Arc gateway ID

  • Get Arc gateway ID. To create Azure Arc gateway, see Set up an Azure Arc gateway and get the resource ID of the Arc gateway. This is also referred to as the ArcGatewayID.

    1. In the Azure portal, go to the Arc gateway resource that you created.
    2. On the Overview page, copy the Resource ID. You use this Arc gateway ID later.

    Screenshot of the Resource ID in the Overview page for Azure Arc gateway.

Step 2: Review script parameters

Review the parameters used in the script:

Parameters Description
TenantID The tenant ID used to register your machines with Azure Arc. Go to your Microsoft Entra ID and copy the tenant ID property.
SubscriptionID The ID of the subscription used to register your machines with Azure Arc.
ResourceGroup The resource group precreated for Arc registration of the machines. A resource group is created if one doesn't exist.
Region The Azure region used for registration. See the Supported regions that can be used.
ArcGatewayID Define the Arc gateway resource ID from Azure.
ProxyServer Optional. Proxy Server address when required for outbound connectivity.
ProxyBypass Optional. Define the bypass list for the proxy. Use comma to separate each item from the list.
ArmAccessToken Optional. Required if you choose to authenticate using an Azure Resource Manager (ARM) access token. If omitted, the script prompts for device code authentication.
TargetSolutionVersion Optional. The target Azure Local solution version that the node must update to after registering with Azure Arc. For example: "12.2602.1002.10".

Step 3: Set parameters

Set the parameters required for the registration script.

Here's an example of how you should change these parameters for the Invoke-AzStackHciArcInitialization initialization script.

#Define the tenant you will use to register your machine as Arc device
$Tenant = "YourTenantID"

#Define the subscription where you want to register your Azure Local machine with Arc.
$Subscription = "yourSubscriptionID" 

#Define the resource group where you want to register your Azure Local machine with Arc.
$RG = "yourResourceGroupName" 

#Define the region to use to register your server as Arc device
#Do not use spaces or capital letters when defining region
$Region = "eastus"

#Define the Arc gateway resource ID from Azure 
$ArcgwId = "/subscriptions/yoursubscriptionid/resourceGroups/yourResourceGroupName/providers/Microsoft.HybridCompute/gateways/yourArcGatewayName" 

#Define the proxy address for your Azure Local deployment to access the internet via proxy.
$ProxyServer = "http://proxyaddress:port"

#Define the bypass list for the proxy. Use comma to separate each item from the list.  
# Parameters must be separated with a comma `,`.
# Use "localhost" instead of <local> 
# Use specific IPs such as 127.0.0.1 without mask 
# Use * for subnets allowlisting. 192.168.1.* for /24 exclusions. Use 192.168.*.* for /16 exclusions. 
# Append * for domain names exclusions like *.contoso.com 
# DO NOT INCLUDE .svc on the list. The registration script takes care of Environment Variables configuration. 
# At least the IP address of each Azure Local machine.
# At least the IP address of the Azure Local cluster.
# At least the IPs you defined for your infrastructure network. Arc resource bridge, Azure Kubernetes Service (AKS), and future infrastructure services using these IPs require outbound connectivity.
# NetBIOS name of each machine.
# NetBIOS name of the Azure Local cluster.

$ProxyBypassList = "localhost,127.0.0.1,*.contoso.com,machine1,machine2,machine3,machine4,machine5,192.168.*.*,AzureLocal-1" 

#Optional: Define the Azure Resource Manager access token.
# Required only if you want to use token-based authentication instead of device code authentication.
$armTokenResponse = Get-AzAccessToken

# Convert token to string for use in initialization
# Required because Get-AzAccessToken returns SecureString
$ArmAccessToken = [System.Net.NetworkCredential]::new("", $armTokenResponse.Token).Password

# Define the target Azure Local solution version that the node must update to after registering with Azure Arc.
# Example: "12.2602.1002.10"
$TargetSolutionVersion = "<solution-version>" 

Step 4: Run registration script

Note

If your Azure Local system is preinstalled with an Original Equipment Manufacturer (OEM) image that's outdated or unsupported, or if it was installed with an older ISO, see Handle preinstalled or outdated OS images during Azure Arc registration.

  1. Run the Arc registration script. The script takes a few minutes to run.

    Invoke-AzStackHciArcInitialization
    -TenantId $Tenant
    -SubscriptionID $Subscription
    -ResourceGroup $RG
    -Region $Region
    -Cloud "AzureCloud"
    -ArcGatewayID $ArcgwId
    # Optional
    -Proxy $ProxyServer
    # Optional
    -ProxyBypass $ProxyBypassList
    # Optional: include only when using token-based authentication
    -ArmAccessToken $ArmAccessToken
    # Optional
    -TargetSolutionVersion $TargetSolutionVersion
    

    Note

    If using -ArmAccessToken, convert the token to a plain text string using: $ArmAccessToken = [System.Net.NetworkCredential]::new("", $armTokenResponse.Token).Password.

    For a list of supported Azure regions, see Azure requirements.

  2. During the Arc registration process, you must authenticate with your Azure account. The console window displays a code that you must enter in the URL, displayed in the app, in order to authenticate. Follow the instructions to complete the authentication process.

    Screenshot of the console window with the device code and the URL to open.

Handle preinstalled or outdated OS images during Azure Arc registration

During Azure Arc registration, Azure Local verifies whether the OS image is current for its release baseline. If the image is outdated or unsupported, the system automatically detects it during initialization and provides a list of available update versions to select from. You can proactively specify a target solution version using the optional TargetSolutionVersion parameter.

  • The update typically takes 40-45 minutes followed by a reboot.

  • Rerun Invoke-AzStackHciArcInitialization cmdlet post reboot.

  • During the update, the registration status appears as Update: InProgress.

    Screenshot of the console window with the registration in progress.

Monitor and complete registration

  1. If registration times out or the machine reboots, reconnect and check the registration progress using the following commands:

    $status = Get-ArcBootstrapStatus
    $status.Response.Status
    
  2. Review the status value:

    • Succeeded: Registration completed successfully after the update.
    • Failed: Rerun registration using a new ARM token or device code flow.
    • If the issue persists, collect logs using Collect-ArcBootstrapSupportLogs and share them for further troubleshooting.
  3. After the reboot, rerun the Invoke-AzStackHciArcInitialization cmdlet to continue.

Step 4: Verify the Azure Arc gateway setup is successful

Once the registration is complete, follow these steps to verify that Azure Arc gateway setup is successful.

  1. Connect to the first Azure Local machine from your system.

  2. Open the Arc gateway log to monitor which endpoints are being redirected to the Arc gateway and which ones continue using your firewall or proxy. You can find the Arc gateway log at: c:\programdata\AzureConnectedMAchineAgent\Log\arcproxy.log.

    Screenshot that shows the Arc gateway log using script.

  3. To check the Arc agent configuration and verify that it's using the gateway, run the following command:

    C:\program files\AzureConnectedMachineAgent>.\azcmagent show
    

    The values displayed should be as follows:

    1. Agent version is 1.45 or later.

    2. Agent Status should show as Connected.

    3. Using HTTPS Proxy shows as http://localhost:40343when the Arc gateway is enabled.

    4. Upstream Proxy shows your enterprise proxy server and port.

    5. Azure Arc Proxy shows as running when the Arc gateway is enabled.

    Screenshot that shows the Arc agent with gateway using script.

  4. Additionally, to verify that the setup was done successfully, run the following command:

    C:\program files\AzureConnectedMachineAgent>.\azcmagent check
    

    The response should indicate that the connection.type is set to gateway, and the Reachable column should indicate true for all URLs.

    Here's an example of the Arc agent using the Arc gateway:

    Screenshot that shows the Arc agent with Arc gateway using script.

    You can also audit your gateway traffic by viewing the gateway router logs.

    To view gateway router logs on Windows, run the azcmagent logs command in PowerShell. In the resulting .zip file, the logs are located in the C:\ProgramData\Microsoft\ArcGatewayRouter folder.

This article details how to register using Azure Arc gateway on Azure Local without the proxy configuration. You can register via the Arc script or the Configurator app. For an overview of the Arc gateway, see About Azure Arc gateway for Azure Local.

  • Configure with a script: Using this method, configure the registration settings via a script.

  • Set up via the Configurator app: Configure Azure Arc gateway via a user interface. This method is useful if you prefer not to use scripts or if you want to configure the registration settings interactively.

Prerequisites

Step 1: Get the Arc gateway ID

  • Get Arc gateway ID. To create Azure Arc gateway, see Set up an Azure Arc gateway and get the resource ID of the Arc gateway. This is also referred to as the ArcGatewayID.

    1. In the Azure portal, go to the Arc gateway resource that you created.
    2. On the Overview page, copy the Resource ID. You use this Arc gateway ID later.

    Screenshot of the Resource ID in the Overview page for Azure Arc gateway.

Step 2: Review script parameters

Review the parameters used in the script:

Parameters Description
TenantID The tenant ID used to register your machines with Azure Arc. Go to your Microsoft Entra ID and copy the tenant ID property.
SubscriptionID The ID of the subscription used to register your machines with Azure Arc.
ResourceGroup The resource group precreated for Arc registration of the machines. A resource group is created if one doesn't exist.
Region The Azure region used for registration. See the Supported regions that can be used.
ArcGatewayID Define the Arc gateway resource ID from Azure.
ArmAccessToken Optional. Required if you choose to authenticate using an ARM access token. If omitted, the script prompts for device code authentication.
TargetSolutionVersion Optional. The target Azure Local solution version that the node must update to after registering with Azure Arc. For example: "12.2602.1002.10".

Step 3: Set parameters

Set the parameters required for the registration script.

Here's an example of how you should change these parameters for the Invoke-AzStackHciArcInitialization initialization script.

#Define the tenant you will use to register your machine as Arc device
$Tenant = "YourTenantID"

#Define the subscription where you want to register your Azure Local machine with Arc.
$Subscription = "yourSubscriptionID" 

#Define the resource group where you want to register your Azure Local machine with Arc.
$RG = "yourResourceGroupName" 

#Define the region to use to register your server as Arc device
#Do not use spaces or capital letters when defining region
$Region = "eastus"

#Define the Arc gateway resource ID from Azure 
$ArcgwId = "/subscriptions/yoursubscriptionid/resourceGroups/yourResourceGroupName/providers/Microsoft.HybridCompute/gateways/yourArcGatewayName" 

#Optional: Define the Azure Resource Manager access token.
# Required only if you want to use token-based authentication instead of device code authentication.
$armTokenResponse = Get-AzAccessToken

# Convert token to string for use in initialization
# Required because Get-AzAccessToken returns SecureString
$ArmAccessToken = [System.Net.NetworkCredential]::new("", $armTokenResponse.Token).Password

# Define the target Azure Local solution version that the node must update to after registering with Azure Arc.
# Example: "12.2602.1002.10"
$TargetSolutionVersion = "<solution-version>" 

Step 4: Run the registration script

Note

If your Azure Local system is preinstalled with an Original Equipment Manufacturer (OEM) image that's outdated or unsupported, or if it was installed with an older ISO, see Handle preinstalled or outdated OS images during Azure Arc registration.

To use the Arc gateway feature for Azure Local systems without a proxy, only use the ArcGatewayID parameter.

  1. Run the initialization script as follows.

    Invoke-AzStackHciArcInitialization
    -TenantId $Tenant
    -SubscriptionID $Subscription
    -ResourceGroup $RG
    -Region $Region
    -Cloud "AzureCloud"
    -ArcGatewayID $ArcgwId
    # Optional: include only when using token-based authentication
    -ArmAccessToken $ArmAccessToken
    # Optional
    -TargetSolutionVersion $TargetSolutionVersion
    

    Note

    If using -ArmAccessToken, convert the token to a plain text string using: $ArmAccessToken = [System.Net.NetworkCredential]::new("", $armTokenResponse.Token).Password.

  2. During the Arc registration process, you must authenticate with your Azure account. The console window displays a code that you must enter in the URL, in order to authenticate. Follow the instructions to complete the authentication process.

    Screenshot of the console window with the device code and the URL to open.

Handle preinstalled or outdated OS images during Azure Arc registration

During Azure Arc registration, Azure Local verifies whether the OS image is current for its release baseline. If the image is outdated or unsupported, the system automatically detects it during initialization and provides a list of available update versions to select from. You can proactively specify a target solution version using the optional TargetSolutionVersion parameter.

  • The update typically takes 40-45 minutes followed by a reboot.

  • Rerun Invoke-AzStackHciArcInitialization cmdlet post reboot.

  • During the update, the registration status appears as Update: InProgress.

    Screenshot of the console window with the registration in progress.

Monitor and complete registration

  1. If registration times out or the machine reboots, reconnect and check the registration progress using the following commands:

    $status = Get-ArcBootstrapStatus
    $status.Response.Status
    
  2. Review the status value:

    • Succeeded: Registration completed successfully after the update.
    • Failed: Rerun registration using a new ARM token or device code flow.
    • If the issue persists, collect logs using Collect-ArcBootstrapSupportLogs and share them for further troubleshooting.
  3. After the reboot, rerun the Invoke-AzStackHciArcInitialization cmdlet to continue.

Step 5: Verify the setup is successful

Once the registration is complete, follow these steps to verify that Azure Arc gateway setup is successful.

  1. Connect to the first Azure Local machine from your system.

  2. Open the Arc gateway log to monitor the endpoints that are being redirected to the Arc gateway and which ones continue using your firewall. You can find the Arc gateway log at: c:\programdata\AzureConnectedMAchineAgent\Log\arcproxy.log.

    Screenshot that shows the Arc gateway log using script.

  3. To check the Arc agent configuration and verify that it's using the gateway, run the following command:

    C:\program files\AzureConnectedMachineAgent>.\azcmagent show
    

    The values displayed should be as follows:

    1. Agent version is 1.45 or later.

    2. Agent Status should show as Connected.

    3. Using HTTPS Proxy shows as http://localhost:40343when the Arc gateway is enabled.

    4. Upstream Proxy shows your enterprise proxy server and port.

    5. Azure Arc Proxy shows as running when the Arc gateway is enabled.

    The Arc agent using the Arc gateway:

    Screenshot that shows the Arc agent with gateway using script.

  4. Additionally, to verify that the setup was done successfully, run the following command:

    C:\program files\AzureConnectedMachineAgent>.\azcmagent check
    

    The response should indicate that the connection.type is set to gateway, and the Reachable column should indicate true for all URLs.

    The Arc agent using the Arc gateway:

    Screenshot that shows the Arc agent with Arc gateway using script.

    You can also audit your gateway traffic by viewing the gateway router logs.

    To view gateway router logs on Windows, run the azcmagent logs command in PowerShell. In the resulting .zip file, the logs are located in the C:\ProgramData\Microsoft\ArcGatewayRouter folder.

Next steps

This feature is available only in Azure Local 2506 or later.