在 Azure Stack Hub 中準備延伸主機

延伸主機可藉由減少所需的 TCP/IP 連接埠數目來保護 Azure Stack Hub。 本文將探討如何準備 Azure Stack Hub 以使用延伸主機,此功能會透過 1808 更新之後的 Azure Stack Hub 更新套件自動啟用。 本文適用於 Azure Stack Hub 更新 1808、1809 和 1811。

憑證需求

延伸主機會實作兩個新網域命名空間,以確保每個入口網站延伸模組都有唯一的主機項目。 新網域命名空間需要兩個額外的萬用字元憑證,如此才能確保通訊安全。

下表顯示新的命名空間和相關聯的憑證:

部署資料夾 必要的憑證主體和主體別名 (SAN) 範圍 (每個區域) 子網域命名空間
管理員延伸主機 *.adminhosting.<region>.<fqdn> (萬用字元 SSL 憑證) 管理員延伸主機 adminhosting.<region>.<fqdn>
公用延伸主機 *.hosting.<region>.<fqdn> (萬用字元 SSL 憑證) 公用延伸主機 hosting.<region>.<fqdn>

如需詳細的憑證需求,請參閱 Azure Stack Hub 公開金鑰基礎結構憑證需求

建立憑證簽署要求

Azure Stack Hub 整備檢查工具可讓您為兩個必要的新 SSL 憑證建立憑證簽署要求。 請遵循 Azure Stack Hub 憑證簽署要求產生一文中的步驟。

注意

視您要求 SSL 憑證的方式而定,您也許可以略過此步驟。

驗證新的憑證

  1. 使用提升的權限在硬體生命週期主機或 Azure Stack Hub 管理工作站上開啟 PowerShell。

  2. 執行下列 Cmdlet 以安裝 Azure Stack Hub 整備檢查工具:

    Install-Module -Name Microsoft.AzureStack.ReadinessChecker
    
  3. 執行下列指令碼來建立必要的資料夾結構。

    New-Item C:\Certificates -ItemType Directory
    
    $directories = 'ACSBlob','ACSQueue','ACSTable','Admin Portal','ARM Admin','ARM Public','KeyVault','KeyVaultInternal','Public Portal', 'Admin extension host', 'Public extension host'
    
    $destination = 'c:\certificates'
    
    $directories | % { New-Item -Path (Join-Path $destination $PSITEM) -ItemType Directory -Force}
    

    注意

    如果您使用Microsoft Entra識別碼同盟服務部署, (AD FS) 下列目錄必須新增至腳本中的$directoriesADFSGraph

  4. 將現有憑證 (亦即您目前在 Azure Stack Hub 中使用的憑證) 放在適當的目錄中。 例如,將管理員 ARM 憑證放入 資料夾。 然後,將新建立的裝載憑證放入 Admin extension hostPublic extension host 目錄。

  5. 執行下列 Cmdlet 來啟動憑證檢查:

    $pfxPassword = Read-Host -Prompt "Enter PFX Password" -AsSecureString 
    
    Start-AzsReadinessChecker -CertificatePath c:\certificates -pfxPassword $pfxPassword -RegionName east -FQDN azurestack.contoso.com -IdentitySystem AAD
    
  6. 檢查輸出,確認是否所有憑證都通過所有測試。

匯入延伸主機憑證

針對後續步驟,請使用可以連線至 Azure Stack Hub 特殊權限端點的電腦。 請確定您可以從該電腦存取新的的憑證檔案。

  1. 針對後續步驟,請使用可以連線至 Azure Stack Hub 特殊權限端點的電腦。 請確定您可以從該電腦存取新的的憑證檔案。

  2. 開啟 PowerShell ISE 來執行後續的指令碼區塊。

  3. 匯入管理員主機端點的憑證。

    
    $CertPassword = read-host -AsSecureString -prompt "Certificate Password"
    
    $CloudAdminCred = Get-Credential -UserName <Privileged endpoint credentials> -Message "Enter the cloud domain credentials to access the privileged endpoint."
    
    [Byte[]]$AdminHostingCertContent = [Byte[]](Get-Content c:\certificate\myadminhostingcertificate.pfx -Encoding Byte)
    
    Invoke-Command -ComputerName <PrivilegedEndpoint computer name> `
    -Credential $CloudAdminCred `
    -ConfigurationName "PrivilegedEndpoint" `
    -ArgumentList @($AdminHostingCertContent, $CertPassword) `
    -ScriptBlock {
            param($AdminHostingCertContent, $CertPassword)
            Import-AdminHostingServiceCert $AdminHostingCertContent $certPassword
    }
    
  4. 匯入主機端點的憑證。

    $CertPassword = read-host -AsSecureString -prompt "Certificate Password"
    
    $CloudAdminCred = Get-Credential -UserName <Privileged endpoint credentials> -Message "Enter the cloud domain credentials to access the privileged endpoint."
    
    [Byte[]]$HostingCertContent = [Byte[]](Get-Content c:\certificate\myhostingcertificate.pfx  -Encoding Byte)
    
    Invoke-Command -ComputerName <PrivilegedEndpoint computer name> `
    -Credential $CloudAdminCred `
    -ConfigurationName "PrivilegedEndpoint" `
    -ArgumentList @($HostingCertContent, $CertPassword) `
    -ScriptBlock {
            param($HostingCertContent, $CertPassword)
            Import-UserHostingServiceCert $HostingCertContent $certPassword
    }
    

更新 DNS 組態

注意

如果您已使用 DNS 整合的 DNS 區域委派,則不需執行此步驟。 如果已設定個別主機 A 記錄來發佈 Azure Stack Hub 端點,則您需要建立兩個額外的主機 A 記錄:

IP Hostname (主機名稱) 類型
<IP> *.Adminhosting.<Region>.<FQDN> A
<IP> *.Hosting.<Region>.<FQDN> A

您可以透過執行 Get AzureStackStampInformation Cmdlet,使用特殊權限端點來擷取已配置的 IP。

連接埠和通訊協定

Azure Stack Hub 資料中心整合 - 發佈端點一文中,會說明推出延伸主機之前需進行輸入通訊以發佈 Azure Stack Hub 的連接埠和通訊協定。

發佈新端點

有兩個新端點需透過您的防火牆來發佈。 您可使用下列程式碼來擷取來自公用 VIP 集區的已配置 IP;您必須從您 Azure Stack Hub 環境的特殊權限端點來執行該程式碼。

# Create a PEP Session
winrm s winrm/config/client '@{TrustedHosts= "<IpOfERCSMachine>"}'
$PEPCreds = Get-Credential
$PEPSession = New-PSSession -ComputerName <IpOfERCSMachine> -Credential $PEPCreds -ConfigurationName "PrivilegedEndpoint" -SessionOption (New-PSSessionOption -Culture en-US -UICulture en-US)

# Obtain DNS Servers and extension host information from Azure Stack Hub Stamp Information and find the IPs for the Host Extension Endpoints
$StampInformation = Invoke-Command $PEPSession {Get-AzureStackStampInformation} | Select-Object -Property ExternalDNSIPAddress01, ExternalDNSIPAddress02, @{n="TenantHosting";e={($_.TenantExternalEndpoints.TenantHosting) -replace "https://*.","testdnsentry"-replace "/"}},  @{n="AdminHosting";e={($_.AdminExternalEndpoints.AdminHosting)-replace "https://*.","testdnsentry"-replace "/"}},@{n="TenantHostingDNS";e={($_.TenantExternalEndpoints.TenantHosting) -replace "https://",""-replace "/"}},  @{n="AdminHostingDNS";e={($_.AdminExternalEndpoints.AdminHosting)-replace "https://",""-replace "/"}}
If (Resolve-DnsName -Server $StampInformation.ExternalDNSIPAddress01 -Name $StampInformation.TenantHosting -ErrorAction SilentlyContinue) {
    Write-Host "Can access AZS DNS" -ForegroundColor Green
    $AdminIP = (Resolve-DnsName -Server $StampInformation.ExternalDNSIPAddress02 -Name $StampInformation.AdminHosting).IPAddress
    Write-Host "The IP for the Admin Extension Host is: $($StampInformation.AdminHostingDNS) - is: $($AdminIP)" -ForegroundColor Yellow
    Write-Host "The Record to be added in the DNS zone: Type A, Name: $($StampInformation.AdminHostingDNS), Value: $($AdminIP)" -ForegroundColor Green
    $TenantIP = (Resolve-DnsName -Server $StampInformation.ExternalDNSIPAddress01 -Name $StampInformation.TenantHosting).IPAddress
    Write-Host "The IP address for the Tenant Extension Host is $($StampInformation.TenantHostingDNS) - is: $($TenantIP)" -ForegroundColor Yellow
    Write-Host "The Record to be added in the DNS zone: Type A, Name: $($StampInformation.TenantHostingDNS), Value: $($TenantIP)" -ForegroundColor Green
}
Else {
    Write-Host "Cannot access AZS DNS" -ForegroundColor Yellow
    $AdminIP = (Resolve-DnsName -Name $StampInformation.AdminHosting).IPAddress
    Write-Host "The IP for the Admin Extension Host is: $($StampInformation.AdminHostingDNS) - is: $($AdminIP)" -ForegroundColor Yellow
    Write-Host "The Record to be added in the DNS zone: Type A, Name: $($StampInformation.AdminHostingDNS), Value: $($AdminIP)" -ForegroundColor Green
    $TenantIP = (Resolve-DnsName -Name $StampInformation.TenantHosting).IPAddress
    Write-Host "The IP address for the Tenant Extension Host is $($StampInformation.TenantHostingDNS) - is: $($TenantIP)" -ForegroundColor Yellow
    Write-Host "The Record to be added in the DNS zone: Type A, Name: $($StampInformation.TenantHostingDNS), Value: $($TenantIP)" -ForegroundColor Green
}
Remove-PSSession -Session $PEPSession

範例輸出

Can access AZS DNS
The IP for the Admin Extension Host is: *.adminhosting.\<region>.\<fqdn> - is: xxx.xxx.xxx.xxx
The Record to be added in the DNS zone: Type A, Name: *.adminhosting.\<region>.\<fqdn>, Value: xxx.xxx.xxx.xxx
The IP address for the Tenant Extension Host is *.hosting.\<region>.\<fqdn> - is: xxx.xxx.xxx.xxx
The Record to be added in the DNS zone: Type A, Name: *.hosting.\<region>.\<fqdn>, Value: xxx.xxx.xxx.xxx

注意

請先進行這項變更,再啟用延伸主機。 這可讓 Azure Stack Hub 入口網站維持可存取的狀態。

端點 (VIP) 通訊協定 連接埠
管理員主機 HTTPS 443
裝載 HTTPS 443

更新現有的發佈規則 (延伸主機的啟用後動作)

注意

1808 Azure Stack Hub 更新套件尚未啟用延伸主機。 它可讓您匯入必要的憑證來為延伸主機做好準備。 在延伸主機透過 1808 更新之後的 Azure Stack Hub 更新套件自動啟用之前,請勿關閉任何連接埠。

您必須關閉現有防火牆規則中的下列現有端點連接埠。

注意

建議您在驗證成功之後,再關閉這些連接埠。

端點 (VIP) 通訊協定 連接埠
入口網站 (系統管理員) HTTPS 12495
12499
12646
12647
12648
12649
12650
13001
13003
13010
13011
13012
13020
13021
13026
30015
入口網站 (使用者) HTTPS 12495
12649
13001
13010
13011
13012
13020
13021
30015
13003
Azure Resource Manager (系統管理員) HTTPS 30024
Azure Resource Manager (使用者) HTTPS 30024

後續步驟