Share via


強制通道案例中的 Windows 啟用失敗

本文說明如何解決在站對站 VPN 連線或 ExpressRoute 案例中啟用強制通道時,可能會遇到的 KMS 啟用問題。

徵兆

您可以在 Azure 虛擬網路子網上啟用 強制通道 ,以將所有因特網系結流量導向回內部部署網路。 在此案例中,執行 Windows 的 Azure 虛擬機 (VM) 無法啟用 Windows。

原因

Azure Windows VM 必須連線到 Azure KMS 伺服器以進行 Windows 啟用。 啟用需要啟用要求來自 Azure 公用 IP 位址。 在強制通道案例中,啟用會失敗,因為啟用要求來自您的內部部署網路,而不是來自 Azure 公用 IP 位址。

解決方案

若要解決此問題,請使用 Azure 自定義路由將啟用流量路由傳送至 Azure KMS 伺服器。

Azure 全域雲端之 KMS 伺服器的第一個 DNS 名稱具有azkms.core.windows.net兩個 IP 位址:和 40.83.235.5320.118.99.224 Azure 全域雲端之 KMS 伺服器的第二個 DNS 名稱是 kms.core.windows.net IP 位址為 23.102.135.246。 如果您使用 Azure 德國等其他 Azure 平臺,則必須使用對應 KMS 伺服器的 IP 位址。 如需詳細資訊,請參閱下表:

平台 KMS DNS KMS IP
Azure 全域 azkms.core.windows.net
kms.core.windows.net
20.118.99.224, 40.83.235.53
23.102.135.246
Azure 德國 kms.core.cloudapi.de 51.4.143.248
Azure 美國政府 kms.core.usgovcloudapi.net
azkms.core.usgovcloudapi.net
23.97.0.13
52.126.105.2
Azure China 21Vianet azkms.core.chinacloudapi.cn
kms.core.chinacloudapi.cn
159.27.28.100, 163.228.64.161
42.159.7.249

注意事項

Azure 全球雲端和 Azure 中國的所有三個 IP 位址,以及 Azure 美國政府的兩個 IP 位址都應該新增至自定義路由。

若要新增自定義路由,請遵循下列步驟:

針對 Resource Manager VM

注意事項

啟用會使用公用IP位址,並會受到標準SKU Load Balancer組態的影響。 請仔細檢閱 Azure 中的輸出連線 ,以瞭解需求。

  1. 開啟 Azure PowerShell,然後登入您的 Azure 訂用帳戶

  2. 執行下列命令:

    # First, get the virtual network that hosts the VMs that have activation problems. In this case, we get virtual network ArmVNet-DM in Resource Group ArmVNet-DM:
    $vnet = Get-AzVirtualNetwork -ResourceGroupName "ArmVNet-DM" -Name "ArmVNet-DM"
    
    # Next, create a route table:
    $RouteTable = New-AzRouteTable -Name "ArmVNet-DM-KmsDirectRoute" -ResourceGroupName "ArmVNet-DM" -Location "centralus"
    
    # Next, configure the route table:
    Add-AzRouteConfig -Name "DirectRouteToKMS" -AddressPrefix 23.102.135.246/32 -NextHopType Internet -RouteTable $RouteTable
    Add-AzRouteConfig -Name "DirectRouteToAZKMS01" -AddressPrefix 20.118.99.224/32 -NextHopType Internet -RouteTable $RouteTable
    Add-AzRouteConfig -Name "DirectRouteToAZKMS02" -AddressPrefix 40.83.235.53/32 -NextHopType Internet -RouteTable $RouteTable
    
    Set-AzRouteTable -RouteTable $RouteTable
    
    # Next, attach the route table to the subnet that hosts the VMs:
    Set-AzVirtualNetworkSubnetConfig -Name "Subnet01" -VirtualNetwork $vnet -AddressPrefix "10.0.0.0/24" -RouteTable $RouteTable
    
    Set-AzVirtualNetwork -VirtualNetwork $vnet
    
  3. 移至有啟用問題的 VM。 使用 PsPing 測試是否可以連線到 KMS 伺服器:

    psping kms.core.windows.net:1688
    psping azkms.core.windows.net:1688
    
  4. 嘗試啟用 Windows,並查看問題是否已解決。

針對傳統 VM

重要事項

傳統 VM 將於 2023 年 9 月 1 日淘汰

如果您使用 ASM 的 IaaS 資源,請在 2023 年 9 月 1 日前完成移轉。 我們鼓勵您更快進行切換,以利用 Azure Resource Manager 中的許多功能增強功能。

如需詳細資訊,請參閱在 2023 年 9 月 1 日前將 IaaS 資源遷移至 Azure Resource Manager

  1. 開啟 Azure PowerShell,然後登入您的 Azure 訂用帳戶

  2. 執行下列命令:

    # First, create a new route table:
    New-AzureRouteTable -Name "VNet-DM-KmsRouteGroup" -Label "Route table for KMS" -Location "Central US"
    
    # Next, get the route table that was created:
    $rt = Get-AzureRouteTable -Name "VNet-DM-KmsRouteTable"
    
    # Next, create routes:
    Set-AzureRoute -RouteTable $rt -RouteName "AzureKMS" -AddressPrefix "23.102.135.246/32" -NextHopType Internet
    Set-AzureRoute -RouteTable $rt -RouteName "AzureAZKMS01" -AddressPrefix "20.118.99.224/32" -NextHopType Internet
    Set-AzureRoute -RouteTable $rt -RouteName "AzureAZKMS02" -AddressPrefix "40.83.235.53/32" -NextHopType Internet
    
    # Apply the KMS route table to the subnet that hosts the problem VMs (in this case, we apply it to the subnet that's named Subnet-1):
    Set-AzureSubnetRouteTable -VirtualNetworkName "VNet-DM" -SubnetName "Subnet-1" 
    -RouteTableName "VNet-DM-KmsRouteTable"
    
    
  3. 移至有啟用問題的 VM。 使用 PsPing 測試是否可以連線到 KMS 伺服器:

    psping kms.core.windows.net:1688
    psping azkms.core.windows.net:1688
    
  4. 嘗試啟用 Windows,並查看問題是否已解決。

後續步驟

與我們連絡,以取得說明

如果您有問題或需要相關協助,請建立支援要求,或詢問 Azure community 支援。 您也可以將產品意見反應提交給 Azure 意應見反社群