|
| 1 | +--- |
| 2 | +title: Configure Arc proxy via registration script for Azure gateway, version 2408 (preview) |
| 3 | +description: Learn how to Configure Arc proxy via registration script for Azure gateway, version 2408 (preview). |
| 4 | +author: alkohli |
| 5 | +ms.topic: how-to |
| 6 | +ms.date: 09/26/2024 |
| 7 | +ms.author: alkohli |
| 8 | +ms.subservice: azure-stack-hci |
| 9 | +--- |
| 10 | + |
| 11 | +# Configure Arc proxy via registration script for Azure gateway (preview) |
| 12 | + |
| 13 | +Applies to: Azure Stack HCI, versions 2408.1, 2408, and 23H2 |
| 14 | + |
| 15 | +After creating the Arc gateway resource in your Azure subscription, you can enable the new Arc gateway preview features. This article details how to configure the Arc proxy before Arc registration using a registration script for the Arc gateway. |
| 16 | + |
| 17 | +Using this method, you don’t need to configure the Arc proxy across WinInet, WinHttp, or environment variables manually. |
| 18 | + |
| 19 | +[!INCLUDE [important](../../includes/hci-preview.md)] |
| 20 | + |
| 21 | +## Prerequisites |
| 22 | + |
| 23 | +Make sure the following prerequisites are met before proceeding: |
| 24 | + |
| 25 | +- You’ve access to an Azure Stack HCI, version 23H2 system. |
| 26 | + |
| 27 | +- An Arc gateway resource created in the same subscription as used to deploy Azure Stack HCI. For more information, see [Create the Arc gateway resource in Azure](deployment-azure-arc-gateway-overview.md#create-the-arc-gateway-resource-in-azure). |
| 28 | + |
| 29 | +> [!Warning] |
| 30 | +> Only the standard ISO OS image available at https://aka.ms/PVenEREWEEW should be used to test the Arc gateway public preview on Azure Stack HCI, version 2408. Do not use the ISO image available in Azure portal. |
| 31 | +
|
| 32 | +## Step 1: Get the ArcGatewayID |
| 33 | + |
| 34 | +You need the proxy and the ArcGatewayID from Azure to run the Azure Stack HCI node registration script. To get the ArcGatewayID value, run the `az connectedmachine gateway list` command described previously. Do not run this command from any Azure Stack HCI nodes: |
| 35 | + |
| 36 | +```azurecli |
| 37 | +PS C:\> az connectedmachine gateway list |
| 38 | +This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus |
| 39 | +[ |
| 40 | + { |
| 41 | + "allowedFeatures": [ |
| 42 | + "*" |
| 43 | + ], |
| 44 | + "gatewayEndpoint": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx.gw.arc.azure.com", |
| 45 | + "gatewayId": "xxxxxxx-xxxx-xxx-xxxx-xxxxxxxxx", |
| 46 | + "gatewayType": "Public", |
| 47 | + "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/resourceGroups/yourresourcegroup/providers/Microsoft.HybridCompute/gateways/yourArcgateway", |
| 48 | + "location": "eastus", |
| 49 | + "name": " yourArcgateway", |
| 50 | + "provisioningState": "Succeeded", |
| 51 | + "resourceGroup": "yourresourcegroup", |
| 52 | + "type": "Microsoft.HybridCompute/gateways" |
| 53 | + } |
| 54 | +] |
| 55 | +``` |
| 56 | + |
| 57 | +## Step 2: Register new Azure Stack HCI version 2408 nodes |
| 58 | + |
| 59 | +You can run the initialization script by passing the `ArcGatewayID`, `Proxy server`, and `Proxy bypass list` parameters. |
| 60 | + |
| 61 | +Here's an example of how you should change these parameters for the `Invoke-AzStackHciArcInitialization` initialization script. Once registration is completed, the Azure Stack HCI nodes are registered in Azure Arc using the Arc gateway: |
| 62 | + |
| 63 | +```azurecli |
| 64 | +#Install required PowerShell modules in your node for registration |
| 65 | +Install-Module Az.Accounts -RequiredVersion 2.13.2 |
| 66 | +Install-Module Az.Resources -RequiredVersion 6.12.0 |
| 67 | +Install-Module Az.ConnectedMachine -RequiredVersion 0.5.2 |
| 68 | +
|
| 69 | +#Install Arc registration script from PSGallery |
| 70 | +Install-Module AzsHCI.ARCinstaller |
| 71 | +
|
| 72 | +#Define the subscription where you want to register your server as Arc device |
| 73 | +$Subscription = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx" |
| 74 | +
|
| 75 | +#Define the resource group where you want to register your server as Arc device |
| 76 | +$RG = "yourresourcegroupname" |
| 77 | +
|
| 78 | +#Define the tenant to use to register your server as Arc device |
| 79 | +$Tenant = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx" |
| 80 | +
|
| 81 | +#Define Proxy Server if necessary |
| 82 | +$ProxyServer = "http://x.x.x.x:port" |
| 83 | +
|
| 84 | +#Define the Arc gateway resource ID from Azure |
| 85 | +$ArcgwId = "/subscriptions/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx /resourceGroups/ yourresourcegroupname /providers/Microsoft.HybridCompute/gateways/yourarcgatewayname" |
| 86 | +
|
| 87 | +#Define the bypass list for the proxy. Use semicolon to separate each item from the list. |
| 88 | +# Use "localhost" instead of <local> |
| 89 | +# Use specific IPs such as 127.0.0.1 without mask |
| 90 | +# Use * for subnets allowlisting. 192.168.1.* for /24 exclusions. Use 192.168.*.* for /16 exclusions. |
| 91 | +# Append * for domain names exclusions like *.contoso.com |
| 92 | +# DO NOT INCLUDE .svc on the list. The registration script takes care of Environment Variables configuration. |
| 93 | +
|
| 94 | +$ProxyBypassList = "localhost;127.0.0.1;*.contoso.com;Node1;Node2;node3;node4;node5;192.168.*.*;HCI-cluster1” |
| 95 | +
|
| 96 | +#Connect to your Azure account and Subscription |
| 97 | +Connect-AzAccount -SubscriptionId $Subscription -TenantId $Tenant -DeviceCode |
| 98 | +
|
| 99 | +#Get the Access Token and Account ID for the registration |
| 100 | +$ARMtoken = (Get-AzAccessToken).Token |
| 101 | +
|
| 102 | +#Get the Account ID for the registration |
| 103 | +$id = (Get-AzContext).Account.Id |
| 104 | +
|
| 105 | +#Invoke the registration script with Proxy and ArcgatewayID |
| 106 | +Invoke-AzStackHciArcInitialization -SubscriptionID $Subscription -ResourceGroup $RG -TenantID $Tenant -Region australiaeast -Cloud "AzureCloud" -ArmAccessToken $ARMtoken -AccountID $id -Proxy $ProxyServer -ArcGatewayID $ArcgwId -ProxyBypass $ProxyBypassList |
| 107 | +``` |
| 108 | + |
| 109 | +## Step 3: Verify that the setup succeeded |
| 110 | + |
| 111 | +Once the deployment validation starts, you can connect to the first Azure Stack HCI node from your cluster and 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. |
| 112 | + |
| 113 | +You can find the Arc gateway log at: *c:\programdata\AzureConnectedMAchineAgent\Log\arcproxy.log*. |
| 114 | + |
| 115 | +:::image type="content" source="./media/deployment-connect-nodes-to-arc-gateway/arc-gateway-log.png" alt-text="Screenshot that shows the Arc gateway log using script." lightbox="./media/deployment-connect-nodes-to-arc-gateway/arc-gateway-log.png"::: |
| 116 | + |
| 117 | +To check the Arc agent configuration and verify that it is using the gateway, run the following command: `c:\program files\AzureConnectedMachineAgent>.\azcmagent show`. |
| 118 | + |
| 119 | +The values displayed should be as follows: |
| 120 | + |
| 121 | +- **Agent version** is **1.45**. |
| 122 | + |
| 123 | +- **Agent Status** should show as **Connected**. |
| 124 | + |
| 125 | +- **Using HTTPS Proxy** empty when Arc gateway isn't in use. It should show as `http://localhost:40343` when the Arc gateway is enabled. |
| 126 | + |
| 127 | +- **Upstream Proxy** shows your enterprise proxy server and port. |
| 128 | + |
| 129 | +- **Azure Arc Proxy** shows as stopped when Arc gateway isn't in use. Running when the Arc gateway is enabled. |
| 130 | + |
| 131 | +The Arc agent without the Arc gateway: |
| 132 | + |
| 133 | +:::image type="content" source="./media/deployment-connect-nodes-to-arc-gateway/arc-agent-without-gateway.png" alt-text="Screenshot that shows the Arc agent without gateway using script." lightbox="./media/deployment-connect-nodes-to-arc-gateway/arc-agent-with-gateway-2.png"::: |
| 134 | + |
| 135 | +The Arc agent using the Arc gateway: |
| 136 | + |
| 137 | +:::image type="content" source="./media/deployment-connect-nodes-to-arc-gateway/arc-agent-with-gateway.png" alt-text="Screenshot that shows the Arc agent with gateway using script." lightbox="./media/deployment-connect-nodes-to-arc-gateway/arc-agent-with-gateway-2.png"::: |
| 138 | + |
| 139 | +Additionally, to verify that the setup was done successfully, you can run the following command: `c:\program files\AzureConnectedMachineAgent>.\azcmagent check`. |
| 140 | + |
| 141 | +The response should indicate that the **connection.type** is set to **gateway**, and the **Reachable** column should indicate **true** for all URLs. |
| 142 | + |
| 143 | +The Arc agent without the Arc gateway: |
| 144 | + |
| 145 | +:::image type="content" source="./media/deployment-connect-nodes-to-arc-gateway/arc-agent-without-gateway-2.png" alt-text="Screenshot that shows the Arc agent without Arc gateway using script." lightbox="./media/deployment-connect-nodes-to-arc-gateway/arc-agent-without-gateway-2.png"::: |
| 146 | + |
| 147 | +The Arc agent using the Arc gateway: |
| 148 | + |
| 149 | +:::image type="content" source="./media/deployment-connect-nodes-to-arc-gateway/arc-agent-with-gateway-2.png" alt-text="Screenshot that shows the Arc agent with Arc gateway using script." lightbox="./media/deployment-connect-nodes-to-arc-gateway/arc-agent-with-gateway-2.png"::: |
| 150 | + |
| 151 | +You can also audit your gateway traffic by viewing the gateway router logs. |
| 152 | + |
| 153 | +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. |
| 154 | + |
| 155 | +## Next steps |
| 156 | + |
| 157 | +- [Get support for deployment issues](../manage/get-support-for-deployment-issues.md) |
| 158 | +- [Get support for Azure Stack HCI](../manage/get-support.md) |
0 commit comments