共用方式為


在不使用 Arc Gateway 的情況下,將 Azure Local 註冊到 Azure Arc

本文詳細說明如何在不使用 Arc 閘道器且啟用代理設定的情況下,透過 Azure Arc 註冊Azure Local機器。 代理設定可以透過 Arc 腳本或 Azure Local 的 Configurator 應用程式完成。

  • 使用腳本進行設定:您可以使用Arc腳本來設定註冊設定。

  • 透過配置器應用程式設定(預覽):使用此方法,您可以透過使用者介面設定Azure Local註冊。 如果您不想使用腳本,或想要以互動方式設定設定,這個方法會很有用。

關於如何使用 Arc Gateway 並啟用代理配置來將 Azure Local 機器註冊進入 Azure Arc 的說明,請參見 Register Azure Local with Azure Arc using Arc gateway

先決條件

在繼續之前,請確定符合下列必要條件:

這很重要

在你打算叢集的每台 Azure Local 機器上,以本地管理員的身份執行這些步驟。

步驟 1:檢閱腳本參數

檢閱文稿中使用的參數:

參數 說明
TenantID 租戶 ID 用於將您的機器註冊到 Azure Arc 上。請到您的 Microsoft Entra ID,並複製租戶 ID 屬性。
SubscriptionID 訂閱的 ID 是用來註冊你的機器到 Azure Arc。
ResourceGroup 為進行機器 Arc 註冊而預先建立的資源群組。 若資源群組不存在,則會建立一個新的資源群組。
Region 註冊使用的 Azure 區域。 請參閱可使用的支持區域
ProxyServer 選擇性。 輸出連線所需的 Proxy 伺服器位址。
ProxyBypass 選擇性。 定義代理的繞過清單。 用逗號將每個項目從列表中分開。
ArmAccessToken 選擇性。 如果你選擇使用 Azure Resource Manager(ARM)存取權杖進行驗證,必須如此。 若未執行,腳本會提示裝置程式碼驗證。
TargetSolutionVersion 選擇性。 節點註冊 Azure Arc 後必須更新的目標 Azure Local 解決方案版本。例如:「12.2602.1002.10」。

步驟 2:設定參數

設定註冊腳本所需的參數。

以下範例說明如何設定初始化腳本的 Invoke-AzStackHciArcInitialization 參數。 註冊完成後,Azure Local 機器會被註冊到 Azure Arc:

#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 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>"
展開本節以查看範例輸出。
PS C:\Users\SetupUser> $Subscription = "Subscription ID"
PS C:\Users\SetupUser> $RG = "myashcirg"
PS C:\Users\SetupUser> $Region = "eastus"
PS C:\Users\SetupUser> $Tenant = "Tenant ID"
PS C:\Users\SetupUser> $ProxyServer = "http://192.168.10.10:8080"
PS C:\Users\SetupUser> $ProxyBypassList = "localhost,127.0.0.1,*.contoso.com,machine1,machine2,machine3,machine4,machine5,192.168.*.*,AzureLocal-1"
PS C:\Users\SetupUser> $TargetSolutionVersion = "12.2602.1002.10"

步驟 3:執行註冊腳本

備註

如果你的Azure Local系統預裝了過時或不支援的原廠廠商(OEM)映像檔,或是安裝了較舊的 ISO,請參考 在Azure Arc註冊時處理預裝或過時的作業系統映像

  1. 執行 Arc 註冊腳本。 指令碼需要幾分鐘的執行時間。

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

    備註

    若使用 -ArmAccessToken,則將標記轉換為純文字串,使用: $ArmAccessToken = [System.Net.NetworkCredential]::new("", $armTokenResponse.Token).Password

    有關支援的Azure區域列表,請參見 Azure 要求

    展開本節以查看範例輸出。

    以下是您機器成功註冊的示例結果:

    PS C:\Users\Administrator> Invoke-AzStackHciArcInitialization -TenantId $Tenant -SubscriptionID $Subscription -ResourceGroup $RG -Region $Region -Cloud "AzureCloud" -Proxy $ProxyServer
    >>
    Configuration saved to: C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap.json
    Triggering bootstrap on the device...
    Waiting for bootstrap to complete... Current Status: InProgress
    =========SNIPPED=========SNIPPED=============
    Waiting for bootstrap to complete... Current Status: InProgress
    Waiting for bootstrap to complete... Current Status: Succeeded
    Bootstrap succeeded.
    
    Triggering bootstrap log collection as a best effort.
    Version Response                                                    
    ------- --------                                                    
    V1      Microsoft.Azure.Edge.Bootstrap.ServiceContract.Data.Response
    V1      Microsoft.Azure.Edge.Bootstrap.ServiceContract.Data.Response
    
    
    PS C:\Users\Administrator>
    
  2. 在 Arc 註冊過程中,您必須使用您的 Azure 帳號進行驗證。 主控台視窗會顯示您必須在應用程式中顯示的URL中輸入的程式代碼,才能進行驗證。 請遵循指示來完成驗證程式。

    主控台視窗的螢幕快照,其中包含用於驗證的裝置程式代碼和URL。

註冊完成後,Azure Local 機器會註冊到 Azure Arc。

在 Azure Arc 註冊時處理事先安裝或過期的作業系統映像

在 Azure Arc 註冊期間,Azure Local 會驗證作業系統映像是否符合其發佈基準的最新狀態。 若圖片過時或不支援,系統會在註冊時自動更新。 你可以選擇性地用參數 TargetSolutionVersion 指定目標解版本。

  • 更新通常需要40到45分鐘。

  • 需要系統重啟。

  • 在更新期間,註冊狀態會顯示為 「更新:進行中」。

    主控台視窗的截圖,註冊進行中。

監控並完成註冊

  1. 如果註冊逾時或本機重新啟動,請重新連線並使用下列命令檢查註冊進度:

    $status = Get-ArcBootstrapStatus
    $status.Response.Status
    
  2. 檢視狀態值:

    • 成功:更新後註冊成功完成。
    • 失敗:使用新的 ARM 令牌或裝置程式碼流程重新執行註冊。
    • 如果問題仍然存在,請使用 Collect-ArcBootstrapSupportLogs 來收集日誌,並共用它們以進一步進行故障排除。
  3. 重啟後,重新執行 Invoke-AzStackHciArcInitialization cmdlet 繼續。

步驟 4:確認設定是否成功

腳本在所有機器上順利完成之後,請確認您的計算機已向Arc註冊。

  1. 前往 Azure 入口網站。

  2. 移至與註冊相關聯的資源群組。 這些機器在指定的資源群組中以 Machine - Azure Arc 類型的資源出現。

    成功註冊後資源群組中Azure Local機器的截圖。

備註

如果 Azure Local 機器無法註冊,你可以先取消註冊,然後再重新註冊叢集。 詳細指示請參見 Re-register Azure Local machines

本文說明如何在不使用 Arc 閘道器且未啟用代理設定的情況下,透過 Azure Arc 註冊Azure Local機器。 您可以透過Arc腳本或 Configurator 應用程式註冊。

  • 使用腳本進行設定:使用此方法,透過腳本設定註冊設定。

  • 透過 Configurator 應用程式設定:透過使用者介面設定Azure Arc閘道。 如果您不想使用腳本,或想要以互動方式設定註冊設定,這個方法會很有用。

關於如何使用 Arc 閘道器在未啟用代理設定的情況下,將 Azure Local 機器註冊至 Azure Arc 的說明,請參見 Register Azure Local with Azure Arc 使用 Arc gateway

先決條件

在繼續之前,請確定符合下列必要條件:

  • 你可以使用運行 2505 或更新版本的 Azure Local 機器。
  • 您已將適當的許可權指派給用於註冊的訂用帳戶。 欲了解更多資訊,請參見 Assign required permissions for Azure Local deployment
  • 請參考在 Azure Arc 註冊時處理預裝或過時作業系統映像檔的指導。

這很重要

在你打算叢集的每台 Azure Local 機器上,以本地管理員的身份執行這些步驟。

步驟 1:檢閱腳本參數

檢閱文稿中使用的參數:

參數 說明
TenantID 租戶 ID 是用來在 Azure Arc 註冊機器的。到你的 Microsoft Entra ID 並複製租戶 ID 屬性。
SubscriptionID 訂閱的 ID 是用來註冊你的機器到 Azure Arc。
ResourceGroup 為進行機器 Arc 註冊而預先建立的資源群組。 若資源群組不存在,則會建立一個新的資源群組。
Region 註冊使用的 Azure 區域。 請參閱可使用的支持區域
ArmAccessToken 選擇性。 如果你選擇使用 ARM access token 進行驗證,這是必須的。 若未執行,腳本會提示裝置程式碼驗證。
TargetSolutionVersion 選擇性。 節點註冊 Azure Arc 後必須更新的目標 Azure Local 解決方案版本。例如:「12.2602.1002.10」。

步驟 2:設定參數

設定參數。

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

#Define the subscription where you want to register your machine as Arc device
$Subscription = "YourSubscriptionID"

#Define the resource group where you want to register your machine as Arc device
$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"

#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>"
展開本節以查看範例輸出。
PS C:\Users\SetupUser> $Tenant = "Your tenant ID"
PS C:\Users\SetupUser> $Subscription = "Subscription ID"
PS C:\Users\SetupUser> $RG = "myashcirg"
PS C:\Users\SetupUser> $Region = "eastus"
PS C:\Users\SetupUser> $TargetSolutionVersion = "12.2602.1002.10"

步驟 3:執行註冊腳本

備註

如果你的Azure Local系統預裝了過時或不支援的原廠廠商(OEM)映像檔,或是安裝了較舊的 ISO,請參考 在Azure Arc註冊時處理預裝或過時的作業系統映像

  1. 執行 Arc 註冊腳本。 指令碼需要幾分鐘的執行時間。

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

    備註

    若使用 -ArmAccessToken,則將標記轉換為純文字串,使用: $ArmAccessToken = [System.Net.NetworkCredential]::new("", $armTokenResponse.Token).Password

    有關支援的Azure區域列表,請參見 Azure 要求

    展開本節以查看範例輸出。
    PS C:\Users\Administrator> Invoke-AzStackHciArcInitialization -TenantId $Tenant -SubscriptionID $Subscription -ResourceGroup $RG -Region $Region -Cloud "AzureCloud"
    >>
    Configuration saved to: C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap.json
    Triggering bootstrap on the device...
    Waiting for bootstrap to complete... Current Status: InProgress
    =========SNIPPED=========SNIPPED=============
    Waiting for bootstrap to complete... Current Status: InProgress
    Waiting for bootstrap to complete... Current Status: Succeeded
    Bootstrap succeeded.
    
    Triggering bootstrap log collection as a best effort.
    Version Response                                                    
    ------- --------                                                    
    V1      Microsoft.Azure.Edge.Bootstrap.ServiceContract.Data.Response
    V1      Microsoft.Azure.Edge.Bootstrap.ServiceContract.Data.Response
    
    
    PS C:\Users\Administrator>
    
  2. 在 Arc 註冊過程中,您必須使用您的 Azure 帳號進行驗證。 主控台視窗會顯示您必須在應用程式中顯示的URL中輸入的程式代碼,才能進行驗證。 請遵循指示來完成驗證程式。

    主控台視窗的螢幕快照,其中包含用於驗證的裝置程式代碼和URL。

在 Azure Arc 註冊時處理預裝或過時的作業系統映像檔

在 Azure Arc 註冊期間,Azure Local 會驗證作業系統映像是否符合其發佈基準的最新狀態。 若圖片過時或不支援,系統會在註冊時自動更新。 你可以選擇性地用參數 TargetSolutionVersion 指定目標解版本。

  • 更新通常需要40到45分鐘。

  • 需要系統重啟。

  • 在更新期間,註冊狀態會顯示為 「更新:進行中」。

    主控台視窗的截圖,註冊進行中。

監控並完成註冊

  1. 如果註冊逾時或本機重新啟動,請重新連線並使用下列命令檢查註冊進度:

    $status = Get-ArcBootstrapStatus
    $status.Response.Status
    
  2. 檢視狀態值:

    • 成功:更新後註冊成功完成。
    • 失敗:使用新的 ARM 令牌或裝置程式碼流程重新執行註冊。
    • 如果問題仍然存在,請使用 Collect-ArcBootstrapSupportLogs 來收集日誌,並共用它們以進一步進行故障排除。
  3. 重啟後,重新執行 Invoke-AzStackHciArcInitialization cmdlet 繼續。

步驟 4:確認設定是否成功

  1. 前往 Azure 入口網站。

  2. 移至與註冊相關聯的資源群組。 這些機器在指定的資源群組中以 Machine - Azure Arc 類型的資源出現。

    成功註冊後資源群組中Azure Local機器的截圖。

備註

一旦 Azure Local 機器在 Azure Arc 註冊,唯一能撤銷註冊的方法就是在該機器上重新安裝作業系統。

後續步驟

此功能僅在 Azure Local 2503 或更新版本中提供。 以下內容專門適用於2503或2504版本。

本文詳細說明如何用 Azure Arc 及代理設定註冊 Azure Local 機器。 代理設定可以透過 Arc 腳本或 Azure Local 的 Configurator 應用程式完成。

  • 使用腳本進行設定:您可以使用Arc腳本來設定註冊設定。

  • 透過配置器應用程式設定(預覽):使用此方法,您可以透過使用者介面設定Azure Local註冊。 如果您不想使用腳本,或想要以互動方式設定設定,這個方法會很有用。

使用 Proxy 組態註冊的必要條件

在繼續之前,請確定符合下列必要條件:

這很重要

在你打算叢集的每台 Azure Local 機器上,以本地管理員的身份執行這些步驟。

檢閱指令碼參數

檢閱文稿中使用的參數:

參數 說明
TenantID 租戶 ID 是用來將你的機器在 Azure Arc 上註冊的。請前往查看你的 Microsoft Entra ID,並複製其中的租戶 ID 屬性。
SubscriptionID 訂閱的 ID 是用來註冊你的機器到 Azure Arc。
ResourceGroup 為進行機器 Arc 註冊而預先建立的資源群組。 若資源群組不存在,則會建立一個新的資源群組。
Region 註冊使用的 Azure 區域。 請參閱可使用的支持區域
ProxyServer 選擇性參數。 輸出連線所需的 Proxy 伺服器位址。
AccountID 註冊及部署執行個體的使用者。
DeviceCode 主控台 https://microsoft.com/devicelogin 中顯示的裝置代碼,用於登入裝置。

設定參數

  1. 設定註冊腳本所需的參數。

    以下範例說明如何設定初始化腳本的 Invoke-AzStackHciArcInitialization 參數。 註冊完成後,Azure Local 機器會被註冊到 Azure Arc:

    #Define the tenant you will use to register your machine as Arc device
    $Tenant = "YourTenantID"
    
    #Define the subscription where you want to register your machine as Arc device
    $Subscription = "YourSubscriptionID"
    
    #Define the resource group where you want to register your machine as Arc device
    $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 proxy address if your Azure Local deployment accesses the internet via proxy
    $ProxyServer = "http://proxyaddress:port"
    
    
    展開本節以查看範例輸出。
    PS C:\Users\SetupUser> $Tenant = "<Tenant ID>"
    PS C:\Users\SetupUser> $Subscription = "<Subscription ID>"
    PS C:\Users\SetupUser> $RG = "myashcirg"   PS C:\Users\SetupUser> $Region = "eastus"
    PS C:\Users\SetupUser> $ProxyServer = "<http://proxyserver:tcpPort>"
    
  2. 連接你的 Azure 帳號並設定訂閱。 在你用來連接機器的客戶端上開啟瀏覽器,並開啟這個頁面:https://microsoft.com/devicelogin,並在Azure CLI輸出中輸入提供的代碼進行驗證。 取得存取令牌和帳戶識別碼以進行註冊。

    #Connect to your Azure account and Subscription
    Connect-AzAccount -TenantId $Tenant -SubscriptionId $Subscription -DeviceCode
    
    #Get the Access Token for the registration
    $ARMtoken = (Get-AzAccessToken -WarningAction SilentlyContinue).Token
    
    #Get the Account ID for the registration
    $id = (Get-AzContext).Account.Id
    
    
    展開本節以查看範例輸出。
    PS C:\Users\SetupUser> Connect-AzAccount -TenantId $Tenant -SubscriptionId $Subscription -DeviceCode
    WARNING: To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code A44KHK5B5
    to authenticate.
    
    Account               SubscriptionName      TenantId                Environment
    -------               ----------------      --------                ----------- 
    guspinto@contoso.com AzureLocal_Content  <Tenant ID>             AzureCloud
    
    PS C:\Users\SetupUser> $ARMtoken = (Get-AzAccessToken).Token
    PS C:\Users\SetupUser> $id = (Get-AzContext).Account.Id
    
    

執行註冊指令碼

  1. 最後執行 Arc 註冊指令碼。 指令碼需要幾分鐘的執行時間。

    #Invoke the registration script. Use a supported region.
    Invoke-AzStackHciArcInitialization -TenantID $Tenant -SubscriptionID $Subscription -ResourceGroup $RG -Region $Region -Cloud "AzureCloud" -ArmAccessToken $ARMtoken -AccountID $id -Proxy $ProxyServer -ProxyBypass $ProxyBypassList
    

    有關支援的Azure區域列表,請參見 Azure 要求

    展開本節以查看範例輸出。
    PS C:\Users\Administrator> Invoke-AzStackHciArcInitialization -SubscriptionID $Subscription -ResourceGroup $RG -TenantID $Tenant -Region $Region -Cloud "AzureCloud" -ArmAccessToken $ARMtoken -AccountID $id
    >>
    Configuration saved to: C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap.json
    Triggering bootstrap on the device...
    Waiting for bootstrap to complete... Current Status: InProgress
    =========SNIPPED=========SNIPPED=============
    Waiting for bootstrap to complete... Current Status: InProgress
    Waiting for bootstrap to complete... Current Status: Succeeded
    Bootstrap succeeded.
    
    Triggering bootstrap log collection as a best effort.
    Version Response                                                    
    ------- --------                                                    
    V1      Microsoft.Azure.Edge.Bootstrap.ServiceContract.Data.Response
    V1      Microsoft.Azure.Edge.Bootstrap.ServiceContract.Data.Response
    
    PS C:\Users\Administrator>
    
    

確認設定成功

腳本在所有機器上順利完成之後,請確認您的計算機已向Arc註冊。

  1. 前往 Azure 入口網站。

  2. 移至與註冊相關聯的資源群組。 這些機器在指定的資源群組中以 Machine - Azure Arc 類型的資源出現。

    成功註冊後資源群組中Azure Local機器的截圖。

備註

一旦 Azure Local 機器在 Azure Arc 註冊,唯一能撤銷註冊的方法就是在該機器上重新安裝作業系統。

本文詳細說明如何在 Azure Local 上使用 Azure Arc 閘道註冊,且不使用代理設定。 您可以透過Arc腳本或 Configurator 應用程式註冊。

  • 使用腳本進行設定:使用此方法,透過腳本設定註冊設定。

  • 透過 Configurator 應用程式設定:透過使用者介面設定Azure Arc閘道。 如果您不想使用腳本,或想要以互動方式設定註冊設定,這個方法會很有用。

無需 Proxy 配置即可註冊的先決條件

在繼續之前,請確定符合下列必要條件:

這很重要

在你打算叢集的每台 Azure Local 機器上,以本地管理員的身份執行這些步驟。

檢閱指令碼參數

檢閱文稿中使用的參數:

參數 說明
TenantID 租戶 ID 是用來將你的機器註冊到 Azure Arc 的。在 Microsoft Entra ID 中,複製租戶 ID 屬性。
SubscriptionID 訂閱的 ID 是用來註冊你的機器到 Azure Arc。
ResourceGroup 為進行機器 Arc 註冊而預先建立的資源群組。 若資源群組不存在,則會建立一個新的資源群組。
Region 註冊使用的 Azure 區域。 請參閱可使用的支持區域
AccountID 註冊及部署執行個體的使用者。
DeviceCode 主控台 https://microsoft.com/devicelogin 中顯示的裝置代碼,用於登入裝置。

設定參數

  1. 設定參數。

    #Define the tenant you will use to register your machine as Arc device
    $Tenant = "YourTenantID"
    
    #Define the subscription where you want to register your machine as Arc device
    $Subscription = "YourSubscriptionID"
    
    #Define the resource group where you want to register your machine as Arc device
    $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"
    
    
    展開本節以查看範例輸出。
    PS C:\Users\SetupUser> $Tenant = "<Tenant ID>"
    PS C:\Users\SetupUser> $Subscription = "<Subscription ID>"
    PS C:\Users\SetupUser> $RG = "myashcirg"
    PS C:\Users\SetupUser> $Region = "eastus"
    
  2. 連接你的 Azure 帳號並設定訂閱。 在你用來連接機器的客戶端上開啟瀏覽器,並開啟這個頁面:https://microsoft.com/devicelogin,並在Azure CLI輸出中輸入提供的代碼進行驗證。 取得存取令牌和帳戶識別碼以進行註冊。

    #Connect to your Azure account and Subscription
    Connect-AzAccount -TenantId $Tenant -SubscriptionId $Subscription -DeviceCode
    
    #Get the Access Token for the registration
    $ARMtoken = (Get-AzAccessToken -WarningAction SilentlyContinue).Token
    
    #Get the Account ID for the registration
    $id = (Get-AzContext).Account.Id
    
    
    展開本節以查看範例輸出。
    PS C:\Users\SetupUser> Connect-AzAccount -TenantId $Tenant -SubscriptionId $Subscription -DeviceCode
    WARNING: To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code A44KHK5B5
    to authenticate.
    
    Account               SubscriptionName      TenantId                Environment
    -------               ----------------      --------                ----------- 
    guspinto@contoso.com AzureStackHCI_Content  <Tenant ID>             AzureCloud
    
    PS C:\Users\SetupUser> $ARMtoken = (Get-AzAccessToken).Token
    PS C:\Users\SetupUser> $id = (Get-AzContext).Account.Id
    
    

執行註冊指令碼

最後執行 Arc 註冊指令碼。 指令碼需要幾分鐘的執行時間。

#Invoke the registration script. Use a supported region.
Invoke-AzStackHciArcInitialization -TenantID $Tenant -SubscriptionID $Subscription -ResourceGroup $RG -Region $Region -Cloud "AzureCloud" -ArmAccessToken $ARMtoken -AccountID $id

有關支援的Azure區域列表,請參見 Azure 要求

展開本節以查看範例輸出。
PS C:\Users\Administrator> Invoke-AzStackHciArcInitialization -TenantID $Tenant -SubscriptionID $Subscription -ResourceGroup $RG -Region $Region -Cloud "AzureCloud" -ArmAccessToken $ARMtoken -AccountID $id
>>
Configuration saved to: C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap.json
Triggering bootstrap on the device...
Waiting for bootstrap to complete... Current Status: InProgress
=========SNIPPED=========SNIPPED=============
Waiting for bootstrap to complete... Current Status: InProgress
Waiting for bootstrap to complete... Current Status: Succeeded
Bootstrap succeeded.

Triggering bootstrap log collection as a best effort.
Version Response                                                    
------- --------                                                    
V1      Microsoft.Azure.Edge.Bootstrap.ServiceContract.Data.Response
V1      Microsoft.Azure.Edge.Bootstrap.ServiceContract.Data.Response

PS C:\Users\Administrator>

確認設定成功

  1. 前往 Azure 入口網站。

  2. 移至與註冊相關聯的資源群組。 這些機器在指定的資源群組中以 Machine - Azure Arc 類型的資源出現。

    成功註冊後資源群組中Azure Local機器的截圖。

備註

一旦 Azure Local 機器在 Azure Arc 註冊,唯一能撤銷註冊的方法就是在該機器上重新安裝作業系統。