向 Azure 註冊 Azure Stack Hub

向 Azure 註冊 Azure Stack Hub,以便從 Azure 下載 Azure Marketplace 項目,以及設定向 Microsoft 回報商務資料的功能。 註冊 Azure Stack Hub 之後,使用方式會回報給 Azure 商務報告,您可以在註冊所用的 Azure 計費訂用帳戶識別碼下查看報告。

本文中的資訊說明如何向 Azure 註冊 Azure Stack Hub 整合系統。 如需向 Azure 註冊 ASDK 的相關資訊,請參閱 ASDK 文件中的 Azure Stack Hub 註冊

重要

必須註冊才能支援完整的 Azure Stack Hub 功能,包括在 Marketplace 中提供項目。 如果您在使用隨用隨付計費模型時未註冊,則會違反 Azure Stack Hub 授權條款。 若要深入了解 Azure Stack Hub 授權模型,請參閱如何購買頁面

注意

針對連線註冊,會在與註冊相關聯的 Active Directory 目錄中建立Microsoft Entra應用程式和相關聯的服務主體。 此服務主體用於 Azure Stack Hub Marketplace 案例 (檢視和下載 Azure Marketplace 項目)、上傳使用量資料 (如果已啟用使用量報告)、診斷記錄集合及遠端支援。 移除或變更此應用程式或服務主體會導致這些案例無法運作,並引發警示。 如果已刪除,則可以藉由 取消註冊,然後重新向 Azure 註冊 Azure Stack Hub 來重新建立。

注意

已中斷連線的註冊無法使用線上市集摘要整合、診斷記錄集合及遠端支援。 您必須使用離線市集摘要整合

必要條件

註冊之前請先完成下列必要條件區段:

  • 確認認證。
  • 設定 PowerShell 語言模式。
  • 安裝適用於 Azure Stack Hub 的 PowerShell。
  • 下載 Azure Stack Hub 工具。
  • 判斷您的計費模型。
  • 判斷您的唯一註冊名稱。

確認您的認證

在使用 Azure 註冊 Azure Stack Hub 之前,您必須具備:

  • Azure 訂閱的訂用帳戶識別碼。 只有 EA、CSP 或 CSP 共用服務訂用帳戶支援註冊。 CSP 必須決定要使用 CSP 或 APSS 訂用帳戶

    若要取得識別碼,請移至 Azure 入口網站並選取 [所有服務] > [一般] > [訂閱],然後從清單中選擇您要使用的訂用帳戶。 在 [基本] 區段中,尋找訂用帳戶識別碼。 最佳做法是在生產環境和開發或測試環境中使用不同的訂用帳戶。
  • Azure 訂用帳戶的訂用帳戶 ID。 僅支援 EA 訂用帳戶進行註冊。

    若要取得識別碼,請移至 Azure 入口網站並選取 [所有服務] > [一般] > [訂閱],然後從清單中選擇您要使用的訂用帳戶。 在 [基本] 區段中,尋找訂用帳戶識別碼。 最佳做法是在生產環境和開發或測試環境中使用不同的訂用帳戶。

注意

目前不支援德國雲端訂用帳戶。

  • 訂用帳戶擁有者的帳戶使用者名稱和密碼。

  • 使用者帳戶必須具有 Azure 訂用帳戶的存取權,而且有權在與該訂用帳戶相關聯的目錄中建立身分識別應用程式和服務主體。 我們建議您使用最低限度的系統管理權向 Azure 註冊 Azure Stack Hub。 如需深入了解如何建立自訂角色定義,以限制註冊時存取您訂用帳戶的權限,請參閱建立 Azure Stack Hub 的註冊角色

  • 註冊 Azure Stack Hub 資源提供者 (請參閱後續的「註冊 Azure Stack Hub 資源提供者」一節以取得詳細資料)。

註冊之後,不需要Microsoft Entra全域管理員許可權。 不過,某些作業可能需要全域管理員認證 (例如,資源提供者安裝程式指令碼或需要授予權限的新功能)。 您可以暫時恢復帳戶的全域管理員權限,或使用個別的全域管理員帳戶,該帳戶是 預設提供者訂用帳戶 的擁有者。

註冊 Azure Stack Hub 的使用者是Microsoft Entra識別碼中服務主體的擁有者。 只有已註冊 Azure Stack Hub 的使用者才能修改 Azure Stack Hub 註冊。 即使他們是全域管理員,所有其他使用者都必須透過「存取控制 (IAM) 」新增至「預設提供者訂用帳戶」。 如果非系統管理員使用者 (其非註冊服務主體的擁有者) 嘗試註冊或重新註冊 Azure Stack Hub,他們可能會遇到 403 回應。 403 回應表示使用者沒有足夠的權限可完成作業。

如果您沒有符合這些需求的 Azure 訂用帳戶,則可以在這裡建立免費的 Azure 帳戶。 註冊 Azure Stack Hub 不會對您的 Azure 訂用帳戶收取任何費用。

注意

如果您有多個 Azure Stack Hub,最佳做法是將每個 Azure Stack Hub 註冊到其自己的訂用帳戶。 這可讓您更輕鬆地追蹤使用情況。

設定 PowerShell 語言模式

若要成功註冊 Azure Stack Hub,PowerShell 語言模式必須設定為 FullLanguage。 若要確認目前的語言模式是否已設定為完整,請開啟已提升權限的 PowerShell 視窗,然後執行下列 PowerShell Cmdlet:

$ExecutionContext.SessionState.LanguageMode

確定輸出有傳回 FullLanguage。 如果傳回任何其他語言模式,則必須在另一部機器上執行註冊,或必須將語言模式設定為 FullLanguage,才能繼續。

安裝適用於 Azure Stack Hub 的 PowerShell

請使用適用於 Azure Stack Hub 的最新 PowerShell 向 Azure 註冊。

如果尚未安裝最新版本,請參閱安裝適用於 Azure Stack Hub 的 PowerShell

下載 Azure Stack Hub 工具

Azure Stack Hub 工具 GitHub 存放庫包含可支援 Azure Stack Hub 功能 (包括註冊功能) 的 PowerShell 模組。 在註冊過程中,您必須匯入並使用 RegisterWithAzure.psm1 PowerShell 模組 (位於 Azure Stack Hub 工具存放庫中) 來向 Azure 註冊您的 Azure Stack Hub 執行個體。

為確保使用的是最新版本,請刪除任何現有的 Azure Stack Hub 工具版本,並從 GitHub 下載最新版本,再向 Azure 註冊。

注意

您也可以使用操作員存取工作站 (OAW),存取具有特殊權限的端點 (PEP)、適用於支援案例的管理員入口網站,以及 Azure Stack Hub GitHub 工具。 如需詳細資訊,請參閱 Azure Stack Hub 操作員存取工作站

決定您的計費模型

連結的部署可讓 Azure Stack Hub 連線到網際網路和 Azure。 您也可以使用Microsoft Entra識別碼或Active Directory 同盟服務 (AD FS) 作為身分識別存放區,並選擇兩種計費模型:隨用隨付或容量型。 您稍後會在執行註冊指令碼時指定計費模型。

中斷連線的部署則可讓您使用 Azure Stack Hub,而不必連線到網際網路。 若使用已中斷連線的部署,您會受限於 AD FS 身分識別儲存和以容量為基礎的計費模型。 您稍後會在執行註冊指令碼時指定計費模型。

判斷您的唯一註冊名稱

當您執行註冊指令碼時,必須提供唯一的註冊名稱。 讓 Azure Stack Hub 訂用帳戶與 Azure 註冊產生關聯的簡單方法,是使用您的 Azure Stack Hub 雲端識別碼

注意

若 Azure Stack Hub 註冊使用容量型計費模型,在這些年度訂用帳戶到期之後,須於重新註冊時變更唯一名稱,除非您刪除過期的註冊並重新註冊 Azure。

若要判斷 Azure Stack Hub 部署的雲端識別碼,請參閱尋找您的雲端識別碼

使用隨用隨付計費進行註冊

使用這些步驟,向 Azure 註冊「使用時付費」計費模型的 Azure Stack Hub。

注意

這些步驟全都必須從可存取具特殊權限端點 (PEP) 的電腦執行。 如需有關 PEP 的詳細資料,請參閱使用 Azure Stack Hub 中具有特殊權限的端點

已連線的環境可以存取網際網路和 Azure。 在這類環境中,您必須向 Azure 註冊 Azure Stack Hub 資源提供者,然後設定計費模型。

  1. 若要向 Azure 註冊 Azure Stack Hub 資源提供者,請以系統管理員身分啟動 PowerShell ISE,然後使用下列 PowerShell Cmdlet,其中將 EnvironmentName 參數設定為適當的 Azure 訂用帳戶類型 (請參閱下面的參數)。

  2. 新增您用來註冊 Azure Stack Hub 的 Azure 帳戶。 若要新增帳戶,請執行 Connect-AzAccount Cmdlet。 當系統提示您輸入 Azure 帳戶認證時,您可能需要根據帳戶的組態使用雙因素驗證。

    Connect-AzAccount -EnvironmentName "<environment name>"
    
    參數 描述
    EnvironmentName Azure 雲端訂用帳戶環境名稱。 支援的環境名稱為 AzureCloudAzureUSGovernment,或如果使用中國 Azure 訂用帳戶,則為 AzureChinaCloud

    注意

    如果工作階段已過期、密碼已變更,或您只是要切換帳戶,請在使用 Connect-AzAccount 登入之前執行下列 Cmdlet:Remove-AzAccount-Scope Process

  3. 如果您有多個訂用帳戶,請執行下列命令以選取您要使用的訂用帳戶:

    Get-AzSubscription -SubscriptionID '<Your Azure Subscription GUID>' | Select-AzSubscription
    
  4. 執行下列命令,在您的 Azure 訂用帳戶中註冊 Azure Stack Hub 資源提供者:

    Register-AzResourceProvider -ProviderNamespace Microsoft.AzureStack
    
  5. 以系統管理員身分啟動 PowerShell ISE,並瀏覽至您在下載 Azure Stack Hub 工具時所建立的 [AzureStack-Tools-az] 目錄中的 [註冊] 資料夾。 使用 PowerShell 匯入 RegisterWithAzure.psm1 模組:

    Import-Module .\RegisterWithAzure.psm1
    
  6. 在繼續之前,在相同的 PowerShell 工作階段中,再次確認您已登入正確的 Azure PowerShell 內容 (如果沒有,請重複步驟 2 和 3) 此內容是先前用來註冊 Azure Stack Hub 資源提供者的 Azure 帳戶。 在相同的 PowerShell 工作階段中,執行 Set-AzsRegistration Cmdlet:

    $CloudAdminCred = Get-Credential -UserName <Privileged endpoint credentials> -Message "Enter the cloud domain credentials to access the privileged endpoint."
    $RegistrationName = "<unique-registration-name>"
    Set-AzsRegistration `
       -PrivilegedEndpointCredential $CloudAdminCred `
       -PrivilegedEndpoint <PrivilegedEndPoint computer name> `
       -BillingModel PayAsYouUse `
       -RegistrationName $RegistrationName
    

    如需有關 Set-AzsRegistration Cmdlet 的詳細資訊,請參閱註冊參考

此程序需要 10 到 15 分鐘的時間。 命令完成時,您會看到 「您的環境現在已使用提供的參數註冊並啟動」 的訊息。

使用容量計費進行註冊

使用這些步驟,向 Azure 註冊容量計費模型的 Azure Stack Hub。

注意

這些步驟全都必須從可存取具特殊權限端點 (PEP) 的電腦執行。 如需有關 PEP 的詳細資料,請參閱使用 Azure Stack Hub 中具有特殊權限的端點

已連線的環境可以存取網際網路和 Azure。 在這類環境中,您必須向 Azure 註冊 Azure Stack Hub 資源提供者,然後設定計費模型。

  1. 若要向 Azure 註冊 Azure Stack Hub 資源提供者,請以系統管理員身分啟動 PowerShell ISE,然後使用下列 PowerShell Cmdlet,其中將 EnvironmentName 參數設定為適當的 Azure 訂用帳戶類型 (請參閱下面的參數)。

  2. 新增您用來註冊 Azure Stack Hub 的 Azure 帳戶。 若要新增帳戶,請執行 Connect-AzAccount Cmdlet。 當系統提示您輸入 Azure 帳戶認證時,您可能需要根據帳戶的組態使用雙因素驗證。

    Connect-AzAccount -Environment "<environment name>"
    
    參數 描述
    EnvironmentName Azure 雲端訂用帳戶環境名稱。 支援的環境名稱為 AzureCloudAzureUSGovernment,或如果使用中國 Azure 訂用帳戶,則為 AzureChinaCloud
  3. 如果您有多個訂用帳戶,請執行下列命令以選取您要使用的訂用帳戶:

    Get-AzSubscription -SubscriptionID '<Your Azure Subscription GUID>' | Select-AzSubscription
    
  4. 如需在您的 Azure 訂用帳戶中註冊 Azure Stack Hub 資源提供者,請執行下列命令:

    Register-AzResourceProvider -ProviderNamespace Microsoft.AzureStack
    
  5. 以系統管理員身分啟動 PowerShell ISE,並瀏覽至您下載 Azure Stack Hub 工具時所建立 AzureStack-Tools-az 目錄中的 Registration 資料夾。 使用 PowerShell 匯入 RegisterWithAzure.psm1 模組:

    Import-Module .\RegisterwithAzure.psm1
    
  6. 在繼續之前,請在相同的 PowerShell 工作階段中,再次確認您已登入正確的 Azure PowerShell 內容 (如果沒有,請重複步驟 2 和 3.) 此內容是用來註冊 Azure Stack Hub 資源提供者的 Azure 帳戶。 在相同的 PowerShell 工作階段中,執行 Set-AzsRegistration Cmdlet:

    $CloudAdminCred = Get-Credential -UserName <Privileged endpoint credentials> -Message "Enter the cloud domain credentials to access the privileged endpoint."
    $RegistrationName = "<unique-registration-name>"
    Set-AzsRegistration `
       -PrivilegedEndpointCredential $CloudAdminCred `
       -PrivilegedEndpoint <PrivilegedEndPoint computer name> `
       -AgreementNumber <EA agreement number> `
       -BillingModel Capacity `
       -RegistrationName $RegistrationName
    

    使用您購買容量 SKU 授權的 EA 合約編號

    注意

    您可以將參數設為 false,以此方式使用 Set-AzsRegistration Cmdlet 的 UsageReportingEnabled 參數來停用使用量報告功能。

    如需有關 Set-AzsRegistration Cmdlet 的詳細資訊,請參閱註冊參考

使用容量計費進行註冊

如果您要在中斷連線的環境中 (沒有網際網路連線) 註冊 Azure Stack Hub,您需要從 Azure Stack Hub 環境取得註冊權杖。 然後只要電腦已連線到 Azure 且已安裝適用於 Azure Stack Hub 的 PowerShell,即可使用該權杖。

從 Azure Stack Hub 環境中取得註冊權杖

  1. 以系統管理員身分啟動 PowerShell ISE,並瀏覽至您下載 Azure Stack Hub 工具時所建立 AzureStack-Tools-az 目錄中的 Registration 資料夾。 匯入 RegisterWithAzure.psm1 模組:

    Import-Module .\RegisterWithAzure.psm1
    
  2. 若要取得註冊權杖,請執行下列 PowerShell Cmdlet:

    $FilePathForRegistrationToken = "$env:SystemDrive\RegistrationToken.txt"
    $YourCloudAdminCredential = Get-Credential -UserName <Privileged endpoint credentials> -Message "Enter the cloud domain credentials to access the privileged endpoint."
    $RegistrationToken = Get-AzsRegistrationToken -PrivilegedEndpointCredential $YourCloudAdminCredential `
     -UsageReportingEnabled:$false `
     -PrivilegedEndpoint <PrivilegedEndPoint computer name> `
     -BillingModel Capacity `
     -AgreementNumber '<EA agreement number>' `
     -TokenOutputFilePath $FilePathForRegistrationToken
    

    使用您購買容量 SKU 授權的 EA 合約編號。

    如需有關 Get-AzsRegistrationToken Cmdlet 的詳細資訊,請參閱註冊參考

    提示

    註冊權杖會儲存在針對 $FilePathForRegistrationToken 指定的檔案。 您可以自行變更檔案路徑或檔名。

  3. 儲存此註冊權杖,以在連線 Azure 的機器上使用。 您可以從 $FilePathForRegistrationToken 複製檔案或文字。

連線至 Azure 並註冊

在連線至網際網路的電腦上,執行相同的步驟,以匯入 RegisterWithAzure.psm1 模組,並登入正確的 Azure PowerShell 環境。 接著,呼叫 Register-AzsEnvironment。 指定要向 Azure 註冊的註冊權杖。 如果您要使用相同的 Azure 訂用帳戶識別碼註冊多個 Azure Stack Hub 執行個體,請指定一個唯一的註冊名稱。

您會需要註冊權杖與唯一的權杖名稱。

  1. 以系統管理員身分啟動 PowerShell ISE,並瀏覽至您下載 Azure Stack Hub 工具時所建立 AzureStack-Tools-az 目錄中的 Registration 資料夾。 匯入 RegisterWithAzure.psm1 模組:

    Import-Module .\RegisterWithAzure.psm1
    
  2. 然後執行下列 PowerShell Cmdlet:

    $RegistrationToken = "<Your Registration Token>"
    $RegistrationName = "<unique-registration-name>"
    Register-AzsEnvironment -RegistrationToken $RegistrationToken -RegistrationName $RegistrationName
    

(選擇性) 您可以使用 Get-content cmdlet 來指向包含您註冊權杖的檔案。

您會需要註冊權杖與唯一的權杖名稱。

  1. 以系統管理員身分啟動 PowerShell ISE,並瀏覽至您下載 Azure Stack Hub 工具時所建立 AzureStack-Tools-az 目錄中的 Registration 資料夾。 匯入 RegisterWithAzure.psm1 模組:

    Import-Module .\RegisterWithAzure.psm1
    
  2. 然後執行下列 PowerShell Cmdlet:

    $RegistrationToken = Get-Content -Path '<Path>\<Registration Token File>'
    Register-AzsEnvironment -RegistrationToken $RegistrationToken -RegistrationName $RegistrationName
    

注意

儲存註冊資源名稱和註冊權杖,供日後參考。

從 Azure 註冊資源擷取啟用金鑰

接著,進行 Register-AzsEnvironment 時,您必須從 Azure 中建立的註冊資源中擷取啟用金鑰。

若要取得啟用金鑰,請執行下列 PowerShell Cmdlet:

$RegistrationResourceName = "<unique-registration-name>"
$KeyOutputFilePath = "$env:SystemDrive\ActivationKey.txt"
$ActivationKey = Get-AzsActivationKey -RegistrationName $RegistrationResourceName -KeyOutputFilePath $KeyOutputFilePath

提示

啟用金鑰會儲存在為 $KeyOutputFilePath 指定的檔案中。 您可以自行變更檔案路徑或檔名。

在 Azure Stack Hub 中建立啟用資源

從 Get-AzsActivationKey 建立的啟用金鑰中取得檔案或文字後,返回 Azure Stack Hub 環境。 接下來,您將使用該啟用金鑰在 Azure Stack Hub 中建立啟用資源。 若要建立啟用資源,請執行下列 PowerShell Cmdlet:

# Open the file that contains the activation key (from Azure), copy the entire contents into your clipboard, then within your PowerShell session (that will communicate with the PEP), paste the activation key contents into a string variable, enclosed by quotation marks: 
$ActivationKey = "<paste activation key here>"
$YourPrivilegedEndpoint = "<privileged_endpoint_computer_name>"
New-AzsActivationResource -PrivilegedEndpointCredential $YourCloudAdminCredential -PrivilegedEndpoint $YourPrivilegedEndpoint -ActivationKey $ActivationKey

(選擇性) 您可以使用 Get-content cmdlet 來指向包含您註冊權杖的檔案:

$ActivationKey = Get-Content -Path '<Path>\<Activation Key File>'
$YourPrivilegedEndpoint = "<privileged_endpoint_computer_name>"
New-AzsActivationResource -PrivilegedEndpointCredential $YourCloudAdminCredential -PrivilegedEndpoint $YourPrivilegedEndpoint -ActivationKey $ActivationKey

驗證 Azure Stack Hub 註冊

您可以使用 [區域管理] 圖格來確認 Azure Stack Hub 註冊是否已成功。 此圖格位於系統管理員入口網站中的預設儀表板上。 狀態可以是已註冊或未註冊。 如果是已註冊,則會一併顯示您用來註冊 Azure Stack Hub 的 Azure 訂用帳戶 ID,以及註冊資源群組和名稱。

  1. 登入 Azure Stack Hub 系統管理員入口網站 https://adminportal.local.azurestack.external

  2. 從儀表板中,選取 [Region management] \(區域管理\)。

  3. 選取 [屬性] 。 此刀鋒視窗會顯示您環境的狀態和詳細資料。 狀態可以是 [已註冊]、[未註冊] 或 [已過期]

    Azure Stack Hub 系統管理員入口網站中的區域管理圖格

    若已註冊,屬性會包括:

    • 註冊訂用帳戶識別碼:已註冊並且與 Azure Stack Hub 相關聯的 Azure 訂用帳戶識別碼。
    • 註冊資源群組:相關聯的訂用帳戶 (包含 Azure Stack Hub 資源) 中的 Azure 資源群組。
  4. 您可以使用 Azure 入口網站來檢視 Azure Stack Hub 註冊資源,然後確認註冊是否成功。 使用與您用來註冊 Azure Stack Hub 的訂用帳戶相關聯的帳戶,登入 Azure 入口網站。 選取 [所有資源]啟用 [顯示隱藏的類型] 核取方塊,然後選取註冊名稱。

  5. 如果註冊不成功,您必須遵循這裡的步驟來重新註冊,進而解決問題。

或者,您也可以使用 Marketplace 管理功能來確認註冊是否已成功。 如果您在 [Marketplace 管理] 刀鋒視窗中看到 Marketplace 項目清單,即表示您的註冊已成功。 不過,在已中斷連線的環境中,您則無法在 Marketplace 管理中看到 Marketplace 項目。

續訂或變更註冊

在下列情況下,您需要更新您的註冊:

  • 在您續訂以容量為基礎的年度訂用帳戶之後。
  • 當您變更計費模型時。
  • 當您的調整變更 (新增/移除節點時,) 容量型計費。

注意

如果已啟用主動式記錄收集,而且您更新或變更 Azure Stack Hub 註冊,則必須重新啟用主動式記錄收集。 如需主動式記錄收集的詳細資訊,請參閱 診斷記錄收集

必要條件

您在管理員入口網站中必須要有下列資訊,才能續訂或變更註冊:

系統管理員入口網站 Cmdlet 參數 注意
註冊訂用帳戶識別碼 訂用帳戶 先前註冊期間使用的訂用帳戶識別碼
註冊資源群組 resourceGroupName 先前的註冊資源所在的資源群組
註冊名稱 RegistrationName 先前註冊期間使用的註冊名稱

變更您使用的訂用帳戶

如果要變更您所使用的訂用帳戶,就必須先執行 Remove-AzsRegistration Cmdlet,然後確保您已登入正確的 Azure PowerShell 內容。 然後,使用任何已變更的參數 (包括 <billing model>) 來執行 Set-AzsRegistration。 執行 Remove-AzsRegistration 時,您必須登入在註冊期間使用的訂用帳戶,並使用管理員入口網站中顯示的 RegistrationNameResourceGroupName 參數值:

# select the subscription used during the registration (shown in portal)
Select-AzSubscription -Subscription '<Registration subscription ID from portal>'
$YourPrivilegedEndpoint = "<privileged_endpoint_computer_name>"
# unregister using the parameter values from portal
Remove-AzsRegistration -PrivilegedEndpointCredential $YourCloudAdminCredential -PrivilegedEndpoint $YourPrivilegedEndpoint -RegistrationName '<Registration name from portal>' -ResourceGroupName '<Registration resource group from portal>'
# switch to new subscription id
Select-AzSubscription -Subscription '<New subscription ID>'
# register
Set-AzsRegistration -PrivilegedEndpointCredential $YourCloudAdminCredential -PrivilegedEndpoint $YourPrivilegedEndpoint -BillingModel '<Billing model>' -RegistrationName '<Registration name>' -ResourceGroupName '<Registration resource group name>'

變更計費模型、功能的提供方式,或重新註冊您的執行個體

如果您想要變更計費模型、功能的提供方式,或想要重新註冊執行個體,請參考本節的內容。 對於前述各種案例,您都可以呼叫註冊函式以設定新值。 您不需要先移除目前的註冊。 登入管理員入口網站中顯示的訂用帳戶識別碼,然後使用新的 BillingModel 值 (但保留管理員入口網站中顯示的相同 RegistrationNameResourceGroupName 參數值) 重新執行註冊:

# select the subscription used during the registration
Select-AzSubscription -Subscription '<Registration subscription ID from portal>'
$YourPrivilegedEndpoint = "<privileged_endpoint_computer_name>"
# rerun registration with new BillingModel (or same billing model in case of re-registration) but using other parameters values from portal
Set-AzsRegistration -PrivilegedEndpointCredential $YourCloudAdminCredential -PrivilegedEndpoint $YourPrivilegedEndpoint -BillingModel '<New billing model>' -RegistrationName '<Registration name from portal>' -ResourceGroupName '<Registration resource group from portal>'

在下列情況下,您需要更新或續訂您的註冊:

  • 在您續訂以容量為基礎的年度訂用帳戶之後。
  • 當您變更計費模型時。
  • 當您調整以容量為基礎的計費變更 (新增/移除節點) 時。

從 Azure Stack Hub 中移除啟用資源

您必須先從 Azure Stack Hub 中移除啟用資源,然後再移除 Azure 中的註冊資源。

若要移除 Azure Stack Hub 中的啟用資源,請在您的 Azure Stack Hub 環境中執行下列 PowerShell Cmdlet:

$YourPrivilegedEndpoint = "<privileged_endpoint_computer_name>"
Remove-AzsActivationResource -PrivilegedEndpointCredential $YourCloudAdminCredential -PrivilegedEndpoint $YourPrivilegedEndpoint

接下來,若要移除 Azure 中的註冊資源,請確定您的電腦已與 Azure 連線,然後登入正確的 Azure PowerShell 環境,並執行適當的 PowerShell Cmdlet,如下所述。

您可以使用用來建立資源的註冊權杖:

$RegistrationToken = "<registration token>"
Unregister-AzsEnvironment -RegistrationToken $RegistrationToken

或者,您可以使用管理員入口網站中的註冊名稱和註冊資源群組名稱:

Unregister-AzsEnvironment -RegistrationName '<Registration name from portal>' -ResourceGroupName '<Registration resource group from portal>'

使用已連線的步驟重新註冊

如果您要將計費模型從已中斷線上狀態的容量計費變更為已線上狀態的耗用量計費,請遵循 已連線的模型步驟重新註冊。

注意

這不會變更身分識別模型,所變更的只有計費機制,您仍會使用 AD FS 來作為身分識別來源。

使用未連線的步驟重新註冊

您現在已在未連線的狀況下完成取消註冊,而您必須在未連線的狀況下,執行重複的步驟來註冊 Azure Stack Hub 環境。

停用或啟用使用量報告功能

針對使用容量計費模型的 Azure Stack Hub 環境,請使用 Set-AzsRegistrationGet-AzsRegistrationToken Cmdlet 搭配 UsageReportingEnabled 參數來關閉使用量報告功能。 Azure Stack Hub 預設會回報使用計量。 操作員若使用容量或支援已中斷連線的環境,將必須關閉使用量報告功能。

執行下列 PowerShell Cmdlet:

$CloudAdminCred = Get-Credential -UserName <Privileged endpoint credentials> -Message "Enter the cloud domain credentials to access the privileged endpoint."
$RegistrationName = "<unique-registration-name>"
Set-AzsRegistration `
   -PrivilegedEndpointCredential $CloudAdminCred `
   -PrivilegedEndpoint <PrivilegedEndPoint computer name> `
   -BillingModel Capacity
   -RegistrationName $RegistrationName
   -UsageReportingEnabled:$false
  1. 若要變更註冊權杖,請執行下列 PowerShell Cmdlet:

    $YourPrivilegedEndpoint = "<privileged_endpoint_computer_name>"
    $FilePathForRegistrationToken = $env:SystemDrive\RegistrationToken.txt
    $RegistrationToken = Get-AzsRegistrationToken -PrivilegedEndpointCredential $YourCloudAdminCredential -UsageReportingEnabled:$false -PrivilegedEndpoint $YourPrivilegedEndpoint -BillingModel Capacity -AgreementNumber '<EA agreement number>' -TokenOutputFilePath $FilePathForRegistrationToken
    

    使用您購買容量 SKU 授權的 EA 合約編號

    提示

    註冊權杖會儲存在針對 $FilePathForRegistrationToken 指定的檔案。 您可以自行變更檔案路徑或檔名。

  2. 儲存此註冊權杖,以在連線 Azure 的電腦上使用。 您可以從 $FilePathForRegistrationToken 複製檔案或文字。

移動註冊資源

對於所有環境均支援在相同的訂用帳戶下的資源群組之間移動註冊資源。 不過,如果兩個訂用帳戶解析為相同的合作夥伴識別碼,則僅針對 CSP 支援在訂用帳戶之間移動註冊資源。 如需將資源移到新資源群組的詳細資訊,請參閱將資源移到新的資源群組或訂用帳戶

重要

若要防止在入口網站上意外刪除註冊資源,註冊指令碼會將鎖定自動新增至資源。 您必須先移除此鎖定,才能加以移動或刪除。 建議您將鎖定新增至您的註冊資源,以防止意外刪除。

註冊參考

Set-AzsRegistration

您可以使用 Set-AzsRegistration 向 Azure 註冊 Azure Stack Hub,以及啟用或停用在市集中提供項目的功能和使用量報告功能。

若要執行此 Cmdlet,您需要:

  • 一個任何類型的全域 Azure 訂用帳戶。
  • 使用該訂用帳戶擁有者或參與者身分的帳戶來登入 Azure PowerShell。
Set-AzsRegistration [-PrivilegedEndpointCredential] <PSCredential> [-PrivilegedEndpoint] <String> [[-AzureContext]
    <PSObject>] [[-ResourceGroupName] <String>] [[-ResourceGroupLocation] <String>] [[-BillingModel] <String>]
    [-MarketplaceSyndicationEnabled] [-UsageReportingEnabled] [[-AgreementNumber] <String>] [[-RegistrationName]
    <String>] [<CommonParameters>]
參數 類型 描述
PrivilegedEndpointCredential PSCredential 用來存取具有特殊權限的端點的認證。 使用者名稱的格式為 AzureStackDomain\CloudAdmin
PrivilegedEndpoint String 一個預先設定的遠端 PowerShell 主控台,可為您提供記錄收集和其他後續部署工作之類的功能。 若要深入了解,請參閱使用具有特殊權限的端點一文。
AzureContext PSObject
resourceGroupName String
ResourceGroupLocation String
BillingModel String 您的訂用帳戶所使用的計費模型。 此參數允許的值:Capacity、PayAsYouUse 和 Development。
MarketplaceSyndicationEnabled True/False 判斷是否可在入口網站中使用 Marketplace 管理功能。 如果在有網際網路連線的情況下註冊,則設定為 True。 如果在已中斷連線的環境中註冊,則設定為 False。 若為中斷連線的註冊,離線摘要整合工具可用於下載 Marketplace 項目。
UsageReportingEnabled True/False Azure Stack Hub 預設會回報使用計量。 操作員若使用容量或支援已中斷連線的環境,將必須關閉使用量報告功能。 此參數允許的值:True、False。
AgreementNumber String 用來排序此 Azure Stack 容量 SKU 的 EA 合約編號。
RegistrationName String 如果您要在多個 Azure Stack Hub 執行個體上,使用相同的 Azure 訂用帳戶識別碼執行註冊指令碼,請為註冊設定唯一的名稱。 此參數的預設值是 AzureStackRegistration。 不過,如果您在多個 Azure Stack Hub 執行個體上使用相同的名稱,指令碼將會失敗。

Get-AzsRegistrationToken

Get-AzsRegistrationToken 會從輸入參數產生註冊權杖。

Get-AzsRegistrationToken [-PrivilegedEndpointCredential] <PSCredential> [-PrivilegedEndpoint] <String>
    [-BillingModel] <String> [[-TokenOutputFilePath] <String>] [-UsageReportingEnabled] [[-AgreementNumber] <String>]
    [<CommonParameters>]
參數 類型 描述
PrivilegedEndpointCredential PSCredential 用來存取具有特殊權限的端點的認證。 使用者名稱的格式為 AzureStackDomain\CloudAdmin
PrivilegedEndpoint String 一個預先設定的遠端 PowerShell 主控台,可為您提供記錄收集和其他後續部署工作之類的功能。 若要深入了解,請參閱使用具有特殊權限的端點一文。
AzureContext PSObject
resourceGroupName String
ResourceGroupLocation String
BillingModel String 您的訂用帳戶所使用的計費模型。 此參數的允許值為:容量、自訂和開發。
MarketplaceSyndicationEnabled True/False
UsageReportingEnabled True/False Azure Stack Hub 預設會回報使用計量。 操作員若使用容量或支援已中斷連線的環境,將必須關閉使用量報告功能。 此參數允許的值:True、False。
AgreementNumber String

註冊失敗

嘗試註冊 Azure Stack Hub 時,您可能會看到下列其中一種錯誤:

  • 無法擷取 的必要 $hostName 硬體資訊。 請檢查實體主機和連線能力,然後嘗試重新執行註冊。

  • 無法連線到 $hostName 以取得硬體資訊。 請檢查實體主機和連線能力,然後嘗試重新執行註冊。

    原因:我們嘗試從主機取得 UUID、Bios 和 CPU 等硬體詳細資料,嘗試啟用,而且因為無法連線到實體主機而無法連線。

  • 雲端識別碼 [GUID] 已註冊。 不允許重複使用雲端識別碼。

    原因:如果您的 Azure Stack 環境已註冊,就會發生這種情況。 如果您想要使用不同的訂用帳戶或計費模型來重新註冊環境,請遵循續訂或變更註冊的步驟

  • 存取 Marketplace 管理時,當您嘗試同步發佈產品時發生錯誤。

    原因:當 Azure Stack Hub 無法存取註冊資源時,通常會發生這種情況。 常見的原因是,Azure 訂用帳戶的目錄租用戶發生變更,因而重設註冊。 如果您變更了訂用帳戶的目錄租用戶,您將無法存取 Azure Stack Hub Marketplace 或使用報表。 您需要重新註冊來修正此問題。

  • 即使您已使用中斷連線的處理程序來註冊戳記,Marketplace 管理仍會要求您註冊並啟用 Azure Stack Hub。

    原因:這是已中斷連線環境的已知問題,而且需要您 確認您的註冊狀態。 若要使用 Marketplace 管理,請使用離線工具

後續步驟

從 Azure 下載市集項目