適用於 Windows Server 的 Azure Hybrid BenefitAzure Hybrid Benefit for Windows Server

對於擁有軟體保證的客戶,適用於 Windows Server 的 Azure Hybrid Benefit 讓您能夠以較低的成本來使用內部部署 Windows Server 授權,以及在 Azure 上執行 Windows 虛擬機器。For customers with Software Assurance, Azure Hybrid Benefit for Windows Server allows you to use your on-premises Windows Server licenses and run Windows virtual machines on Azure at a reduced cost. 您可以使用適用於 Windows Server 的 Azure Hybrid Benefit 部署具有 Windows OS 的新虛擬機器。You can use Azure Hybrid Benefit for Windows Server to deploy new virtual machines with Windows OS. 本文章會詳述使用適用於 Windows Server 的 Azure Hybrid Benefit 來部署新 VM 的步驟,以及您如何更新現有的執行中 VM。This article goes over the steps on how to deploy new VMs with Azure Hybrid Benefit for Windows Server and how you can update existing running VMs. 如需有關適用於 Windows Server 之 Azure Hybrid Benefit 的授權和節省成本詳細資訊,請參閱適用於 Windows Server 的 Azure Hybrid Benefit 授權頁面For more information about Azure Hybrid Benefit for Windows Server licensing and cost savings, see the Azure Hybrid Benefit for Windows Server licensing page.

每份 2 處理器授權或每組 16 核心授權能獲得兩個最多 8 核心的執行個體,或一個最多 16 核心的執行個體。Each 2-processor license or each set of 16-core licenses are entitled to two instances of up to 8 cores, or one instance of up to 16 cores. Standard 版本授權的 Azure Hybrid Benefit 只能在內部部署或 Azure 中使用一次。The Azure Hybrid Benefit for Standard Edition licenses can only be used once either on-premises or in Azure. Datacenter 版本的權益則允許同時用在內部部署與 Azure。Datacenter Edition benefits allow for simultaneous usage both on-premises and in Azure.

在所有區域中,現在支援使用適用於 Windows Server 的 Azure Hybrid Benefit 搭配執行 Windows Server OS 的任何 VM,包括具有其他軟體 (例如 SQL Server 或協力廠商 Marketplace 軟體) 的 VM。Using Azure Hybrid Benefit for Windows Server with any VMs running Windows Server OS are now supported in all regions, including VMs with additional software such as SQL Server or third-party marketplace software.

傳統 VMClassic VMs

對於經典 VM,僅支援從本地自訂映射部署新 VM。For classic VMs, only deploying new VM from on premises custom images is supported. 若要充分利用本文章所支援的功能,您必須先將傳統 VM 移轉至 Resource Manager 模型。To take advantage of the capabilities supported in this article, you must first migrate classic VMs to Resource Manager model.

重要

經典 VM 將于 2023 年 3 月 1 日停用。Classic VMs will be retired on March 1, 2023.

如果您使用 ASM 中的 IaaS 資源,請在 2023 年 3 月 1 日前完成遷移。If you use IaaS resources from ASM, please complete your migration by March 1, 2023. 我們鼓勵您儘早進行切換,以利用 Azure 資源管理器中的許多功能增強功能。We encourage you to make the switch sooner to take advantage of the many feature enhancements in Azure Resource Manager.

有關詳細資訊,請參閱在2023 年 3 月 1 日前將 IaaS 資源遷移到 Azure 資源管理器For more information, see Migrate your IaaS resources to Azure Resource Manager by March 1, 2023.

使用適用於 Windows Server 的 Azure Hybrid Benefit 的方式Ways to use Azure Hybrid Benefit for Windows Server

有幾種方式可以搭配 Azure Hybrid Benefit 使用 Windows 虛擬機器:There are few ways to use Windows virtual machines with the Azure Hybrid Benefit:

  1. 您可以從 Azure Marketplace 上所提供的其中一個 Windows Server 映像部署 VMYou can deploy VMs from one of the provided Windows Server images on the Azure Marketplace
  2. 您可以上傳自訂 VM,並使用 Resource Manager 範本或 Azure PowerShell 進行部署You can upload a custom VM and deploy using a Resource Manager template or Azure PowerShell
  3. 您可以在使用 Azure Hybrid Benefit 執行或支付 Windows Server 的隨選成本之間,切換及轉換現有的 VMYou can toggle and convert existing VM between running with Azure Hybrid Benefit or pay on-demand cost for Windows Server
  4. 您也可以在虛擬機器擴展集上套用適用於 Windows Server 的 Azure Hybrid BenefitYou can also apply Azure Hybrid Benefit for Windows Server on virtual machine scale set as well

使用適用於 Windows Server 的 Azure Hybrid Benefit 建立 VMCreate a VM with Azure Hybrid Benefit for Windows Server

適用於 Windows Server 的 Azure Hybrid Benefit 支援所有 Windows Server OS 型映像。All Windows Server OS based images are supported for Azure Hybrid Benefit for Windows Server. 您可以使用 Azure 平台支援映像,或上傳您自己的自訂 Windows Server 映像。You can use Azure platform support images or upload your own custom Windows Server images.

入口網站Portal

若要使用適用於 Windows Server 的 Azure Hybrid Benefit 建立 VM,請使用 [省錢] 區段底下的切換開關。To create a VM with Azure Hybrid Benefit for Windows Server, use the toggle under the "Save money" section.

PowerShellPowerShell

New-AzVm `
    -ResourceGroupName "myResourceGroup" `
    -Name "myVM" `
    -Location "East US" `
    -ImageName "Win2016Datacenter" `
    -LicenseType "Windows_Server"

CLICLI

az vm create \
    --resource-group myResourceGroup \
    --name myVM \
    --location eastus \
    --license-type Windows_Server

[範本]Template

在 Resource Manager 範本內,必須指定 licenseType 的額外參數。Within your Resource Manager templates, an additional parameter licenseType must be specified. 您可以進一步了解如何製作 Azure Resource Manager 範本You can read more about authoring Azure Resource Manager templates

"properties": {
    "licenseType": "Windows_Server",
    "hardwareProfile": {
        "vmSize": "[variables('vmSize')]"
    }

轉換使用適用於 Windows Server 的 Azure Hybrid Benefit 的現有 VMConvert an existing VM using Azure Hybrid Benefit for Windows Server

如果您有想要將其轉換為利用適用於 Windows Server 的 Azure Hybrid Benefit 的現有 VM,您可以依照下列指示更新 VM 的授權類型。If you have an existing VM that you would like to convert to take advantage of Azure Hybrid Benefit for Windows Server, you can update your VM's license type by following the instructions below.

注意

變更 VM 的授權類型並不會使系統重新開機或導致服務中斷。Changing the license type on the VM does not cause the system to reboot or cause a service interuption. 這只是對中繼資料旗標的更新。It is simply an update to a metadata flag.

入口網站Portal

您可以從入口網站 VM 刀鋒視窗中,藉由選取 [設定] 選項並且切換 [Azure Hybrid Benefit] 選項,將 VM 更新為使用 Azure Hybrid BenefitFrom portal VM blade, you can update the VM to use Azure Hybrid Benefit by selecting "Configuration" option and toggle the "Azure hybrid benefit" option

PowerShellPowerShell

  • 將現有的 Windows Server VM 轉換為適用於 Windows Server 的 Azure Hybrid BenefitConvert existing Windows Server VMs to Azure Hybrid Benefit for Windows Server

    $vm = Get-AzVM -ResourceGroup "rg-name" -Name "vm-name"
    $vm.LicenseType = "Windows_Server"
    Update-AzVM -ResourceGroupName rg-name -VM $vm
    
  • 將具有權益的 Windows Server VM 轉換回隨用隨付Convert Windows Server VMs with benefit back to pay-as-you-go

    $vm = Get-AzVM -ResourceGroup "rg-name" -Name "vm-name"
    $vm.LicenseType = "None"
    Update-AzVM -ResourceGroupName rg-name -VM $vm
    

CLICLI

  • 將現有的 Windows Server VM 轉換為適用於 Windows Server 的 Azure Hybrid BenefitConvert existing Windows Server VMs to Azure Hybrid Benefit for Windows Server

    az vm update --resource-group myResourceGroup --name myVM --set licenseType=Windows_Server
    

如何確認您的 VM 可享受授權權益How to verify your VM is utilizing the licensing benefit

透過 PowerShell、Resource Manager 範本或入口網站部署 VM 之後,您可以使用下列方式驗證設定。Once you have deployed your VM through either PowerShell, Resource Manager template or portal, you can verify the setting in the following methods.

入口網站Portal

從入口網站 VM 刀鋒視窗中,您可以選取 [設定] 索引標籤以檢視適用於 Windows Server 的 Azure Hybrid Benefit 切換開關。From portal VM blade, you can view the toggle for Azure Hybrid Benefit for Windows Server by selecting "Configuration" tab.

PowerShellPowerShell

下列範例顯示單一 VM 的授權類型The following example shows the license type for a single VM

Get-AzVM -ResourceGroup "myResourceGroup" -Name "myVM"

輸出:Output:

Type                     : Microsoft.Compute/virtualMachines
Location                 : westus
LicenseType              : Windows_Server

此輸出和下列在沒有適用於 Windows Server 的 Azure Hybrid Benefit 授權下所部署的 VM 之間,有著顯著的差異:This output contrasts with the following VM deployed without Azure Hybrid Benefit for Windows Server licensing:

Type                     : Microsoft.Compute/virtualMachines
Location                 : westus
LicenseType              :

CLICLI

az vm get-instance-view -g MyResourceGroup -n MyVM --query "[?licenseType=='Windows_Server']" -o table

注意

變更 VM 的授權類型並不會使系統重新開機或導致服務中斷。Changing the license type on the VM does not cause the system to reboot or cause a service interuption. 這只是中繼資料授權旗標。It is a metadata licensing flag only.

列出訂用帳戶中具有適用於 Windows Server 的 Azure Hybrid Benefit 的所有 VMList all VMs with Azure Hybrid Benefit for Windows Server in a subscription

若要查看和計算利用適用於 Windows Server 的 Azure Hybrid Benefit 部署的所有虛擬機器,您可以從訂用帳戶執行下列命令:To see and count all virtual machines deployed with Azure Hybrid Benefit for Windows Server, you can run the following command from your subscription:

入口網站Portal

從虛擬機器或虛擬機器擴展集資源刀鋒視窗中,您可以將資料表資料行設定為包含 "Azure Hybrid Benefit",以檢視所有 VM 和授權類型的清單。From the Virtual Machine or Virtual machine scale sets resource blade, you can view a list of all your VM(s) and licensing type by configuring the table column to include "Azure Hybrid Benefit". VM 設定可以處於「已啟用」、「未啟用」或「不支援」狀態。The VM setting can either be in "Enabled", "Not enabled" or "Not supported" state.

PowerShellPowerShell

$vms = Get-AzVM
$vms | ?{$_.LicenseType -like "Windows_Server"} | select ResourceGroupName, Name, LicenseType

CLICLI

az vm list --query "[?licenseType=='Windows_Server']" -o table

使用適用於 Windows Server 的 Azure Hybrid Benefit 部署虛擬機器擴展集Deploy a Virtual Machine Scale Set with Azure Hybrid Benefit for Windows Server

在虛擬機器擴展集 Resource Manager 範本內,必須在 VirtualMachineProfile 屬性中指定額外參數 licenseTypeWithin your virtual machine scale set Resource Manager templates, an additional parameter licenseType must be specified within your VirtualMachineProfile property. 您可以通過 ARM 範本、PowerShell、Azure CLI 或 REST 為規模集創建或更新期間執行此操作。You can do this during create or update for your scale set through ARM template, PowerShell, Azure CLI or REST.

下列範例使用 ARM 範本搭配 Windows Server 2016 Datacenter 映像︰The following example uses ARM template with a Windows Server 2016 Datacenter image:

"virtualMachineProfile": {
    "storageProfile": {
        "osDisk": {
            "createOption": "FromImage"
        },
        "imageReference": {
            "publisher": "MicrosoftWindowsServer",
            "offer": "WindowsServer",
            "sku": "2016-Datacenter",
            "version": "latest"
        }
    },
    "licenseType": "Windows_Server",
    "osProfile": {
            "computerNamePrefix": "[parameters('vmssName')]",
            "adminUsername": "[parameters('adminUsername')]",
            "adminPassword": "[parameters('adminPassword')]"
    }

您也可以深入了解如何修改虛擬機器擴展集以便取得更多更新擴展集的方式。You can also learn more about how to Modify a virtual machine scale set for more ways to update your scale set.

後續步驟Next steps