在 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 就绪情况检查器工具允许你为这两个新的和必需的 SSL 证书创建证书签名请求。 按照 Azure Stack Hub 证书签名请求生成一文中的步骤进行操作。
注意
可以跳过此步骤,具体取决于请求 SSL 证书的方式。
验证新证书
在硬件生命周期主机或 Azure Stack Hub 管理工作站上打开具有提升权限的 PowerShell。
运行以下 cmdlet 以安装 Azure Stack Hub 就绪性检查器工具:
Install-Module -Name Microsoft.AzureStack.ReadinessChecker
运行以下脚本以创建所需的文件夹结构:
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 ID Federated Services (AD FS)进行部署,则必须在脚本中将以下目录添加到 $directories:
ADFS
,Graph
。将当前正在使用的现有证书放置在 Azure Stack Hub 中的相应目录中。 例如,将 管理员 ARM 证书放在
Arm Admin
文件夹中。 然后将新创建的托管证书放入Admin extension host
和Public extension host
目录中。运行以下 cmdlet 以启动证书检查:
$pfxPassword = Read-Host -Prompt "Enter PFX Password" -AsSecureString Start-AzsReadinessChecker -CertificatePath c:\certificates -pfxPassword $pfxPassword -RegionName east -FQDN azurestack.contoso.com -IdentitySystem AAD
检查输出以查看所有证书是否通过所有测试。
导入扩展主机证书
使用可连接到 Azure Stack Hub 特权终结点的计算机执行后续步骤。 请确保你有权从该计算机访问新证书文件。
使用可连接到 Azure Stack Hub 特权终结点的计算机执行后续步骤。 请确保从该计算机访问新证书文件。
打开 PowerShell ISE 以执行下一个脚本块。
导入管理员托管终结点的证书。
$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 }
导入托管终结点的证书:
$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 | 主机名 | 类型 |
---|---|---|
<IP> | *.Adminhosting.<Region>.<FQDN> | A |
<IP> | *.Hosting.<Region>.<FQDN> | A |
可以通过运行 cmdlet Get-AzureStackStampInformation 使用特权终结点检索已分配的 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 资源管理器(管理员) | HTTPS | 30024 |
Azure 资源管理器(用户) | HTTPS | 30024 |
后续步骤
- 了解防火墙集成。
- 了解 Azure Stack Hub 证书签名请求生成。