Agrega una licencia de SQL Server a un servidor de Windows existente
Compute Engine te permite instalar SQL Server en instancias de Windows y usar licencias de pago por uso (PAYG). En este documento, se describe cómo realizar las siguientes acciones:
Después de agregar una cadena de licencia al disco de arranque de la instancia de Windows, se te facturará de acuerdo con los precios de las imágenes de SQL Server.
Limitaciones
Solo puedes adjuntar licencias de PAYG para las siguientes ediciones de SQL Server:
SQL Server Web Edition
SQL Server Standard Edition
SQL Server Enterprise Edition
Agrega una licencia de SQL Server
Los metadatos de licencia de SQL Server en un disco de arranque permiten que Trusted Cloud realice un seguimiento, informe y facture con precisión sobre el uso de la licencia de SQL Server. Estos metadatos son obligatorios cuando se usan licencias de PAYG SQL Server. Agrega una licencia de SQL Server a un disco de arranque existente mediante el siguiente procedimiento:
Identifica la licencia que deseas agregar a una instancia. Para SQL Server, la licencia debe coincidir con la versión y la edición que deseas ejecutar. Para obtener la lista de strings de licencia de SQL Server válidas, consulta la pestaña Strings de licencia en el documento Detalles del sistema operativo de SQL Server.
Detén la instancia:
gcloud compute instances stop VM_NAME
Reemplaza VM_NAME por el nombre de la instancia que se detendrá.
Identifica el disco de arranque:
gcloud compute instances describe VM_NAME
Reemplaza VM_NAME por el nombre de la instancia.
Verifica que el resultado sea similar al siguiente:
CLONED_BOOT_DISK_NAME: El nombre que deseas asignar al disco del libro clonado.
SQL_SERVER_LICENSE: la licencia de SQL Server que deseas agregar al disco de arranque. Para obtener información sobre las licencias de SQL Server, consulta la pestaña Licencia en la sección SQL Server en Windows
BOOT_DISK_NAME: El nombre del disco de arranque de origen que deseas clonar.
BOOT_DISK_ZONE: La zona del disco de arranque.
CLONED_BOOT_DISK_ZONE: La zona en la que deseas crear el disco de arranque clonado.
Verifica que el disco nuevo tenga la licencia correcta:
VM_INSTANCE_NAME: Es el nombre de la instancia a la que deseas conectar el disco multimedia de SQL Server.
SQL_SERVER_MEDIA_DISK_NAME: el nombre del disco multimedia de SQL Server
SQL_SERVER_ZONE: Es la zona de la instancia.
Una vez que el disco multimedia de SQL Server esté conectado a una instancia, en la máquina de Windows, abre la página Administración de discos para ver si el disco tiene asignada una letra de unidad. De lo contrario, haz clic derecho en el disco y selecciona En línea para ponerlo en línea. El disco multimedia de SQL Server ahora es la unidad D: en la página Administración de discos y en Windows Explorer.
Verifica que el disco de arranque de tu instancia tenga al menos 5 GB de espacio libre en el disco y copia los medios de SQL Server en el disco de arranque:
Aplica una clave de producto de SQL Server a una instancia de Compute Engine
Para actualizar el medio de instalación de SQL Server, debes obtener y aplicar una clave de producto a la instancia de Compute Engine en la que se instala SQL Server. Para obtener la clave de producto y actualizar el medio de instalación de SQL Server, sigue los siguientes pasos:
Obtén la clave de producto del medio de instalación de SQL Server:
C:\> type C:\sql_server_install\x64\DefaultSetup.ini
Conéctate a la instancia en la que está instalado SQL Server a través del escritorio remoto y accede con el usuario de tu dominio.
Haz clic con el botón derecho en Inicio (o presiona Win + X) y selecciona Ejecutar.
Para confirmar el símbolo de elevación, haz clic en Sí.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Falta la información que necesito","missingTheInformationINeed","thumb-down"],["Muy complicado o demasiados pasos","tooComplicatedTooManySteps","thumb-down"],["Desactualizado","outOfDate","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Problema con las muestras o los códigos","samplesCodeIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-08-19 (UTC)"],[[["\u003cp\u003eCompute Engine allows you to install SQL Server on Windows virtual machines (VMs) with pay-as-you-go (PAYG) licensing, which is tracked and billed through license metadata on the boot disk.\u003c/p\u003e\n"],["\u003cp\u003eAdding a SQL Server license to a VM's boot disk involves stopping the VM, detaching the existing boot disk, cloning it with the new license, and reattaching the cloned disk as the new boot disk, noting that once a license is added, it cannot be removed.\u003c/p\u003e\n"],["\u003cp\u003eSQL Server installation media can be obtained by creating a new disk from a SQL Server image, attaching it to a VM, and then copying the installation files to the VM's boot disk, after which the SQL server media disk can be detached.\u003c/p\u003e\n"],["\u003cp\u003eUpgrading the SQL Server edition on a VM requires obtaining a new product key from the installation media and applying it through the SQL Server setup process.\u003c/p\u003e\n"],["\u003cp\u003ePAYG SQL Server licenses are available for Web, Standard, and Enterprise editions.\u003c/p\u003e\n"]]],[],null,["# Add a SQL Server license to an existing Windows server\n\nWindows\n\n*** ** * ** ***\n\nCompute Engine lets you install SQL Server on Windows instances and use\npay-as-you-go (PAYG) licenses. This document describes how you can perform the\nfollowing:\n\n1. [Add SQL Server license metadata to a boot disk](#add-sql-server-license)\n2. [Obtain SQL Server media and install SQL Server](#obtain-sql-server-media)\n3. [Apply a SQL server product key to a Compute Engine instance](#apply-sql-server-product-key)\n\nBilling\n-------\n\nAfter adding a license string to the Windows instance's boot disk, you are\nbilled according to the pricing of [SQL Server images](/compute/disks-image-pricing#sql_server_pricing).\n\nLimitations\n-----------\n\n- You can only add PAYG licenses for the following editions of SQL Server:\n\n - SQL Server Web edition\n - SQL Server Standard edition\n - SQL Server Enterprise edition\n\nAdd a SQL Server license\n------------------------\n\nSQL Server license metadata on a boot disk allows Google Cloud to accurately\ntrack, bill, and report on SQL Server license usage. This metadata is required\nwhen using PAYG SQL Server licenses. Add a SQL Server license to an existing boot\ndisk using the following procedure:\n| **Caution:** After you add a license to an instance, the license is bound to the instance and you cannot remove the license from the instance.\n\n1. Identify the license you want to add to an instance. For SQL Server, the\n license needs to match both the version and edition you want to run. For the\n list of valid SQL Server license strings, see the **License strings** tab in\n the [operating system details for SQL Server](/compute/docs/images/os-details#sql_server)\n document.\n\n2. Stop the instance:\n\n ```\n gcloud compute instances stop VM_NAME\n ```\n\n Replace \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e with the name of the instance to\n stop.\n3. Identify the boot disk:\n\n ```\n gcloud compute instances describe VM_NAME\n ```\n\n Replace \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e with the name of the instance.\n4. Verify that the output is similar to the following:\n\n disks:\n - autoDelete: true\n boot: true\n deviceName: \u003cvar translate=\"no\"\u003eBOOT_DISK_NAME\u003c/var\u003e\n diskSizeGb: '20'\n guestOsFeatures:\n - type: UEFI_COMPATIBLE\n index: 0\n interface: SCSI\n kind: compute#attachedDisk\n licenses:\n - \u003cvar translate=\"no\"\u003eBOOT_DISK_LICENSE_STRING\u003c/var\u003e\n mode: READ_WRITE\n source: https://www.googleapis.com/compute/v1/projects/\u003cvar translate=\"no\"\u003ePROJECT_NAME\u003c/var\u003e/zones/\u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e/disks/\u003cvar translate=\"no\"\u003eBOOT_DISK_NAME\u003c/var\u003e\n type: PERSISTENT\n\n5. Detach the boot disk:\n\n ```\n gcloud compute instances detach-disk VM_NAME --disk=BOOT_DISK_NAME\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e: the name of the instance\n - \u003cvar translate=\"no\"\u003eBOOT_DISK_NAME\u003c/var\u003e: the name of the boot disk\n6. Clone the boot disk and add the additional license:\n\n ```\n gcloud compute disks create CLONED_BOOT_DISK_NAME \\\n --licenses=SQL_SERVER_LICENSE \\\n --source-disk=BOOT_DISK_NAME \\\n --source-disk-zone=BOOT_DISK_ZONE \\\n --zone=CLONED_BOOT_DISK_ZONE\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eCLONED_BOOT_DISK_NAME\u003c/var\u003e: the name you want to give the cloned book disk\n - \u003cvar translate=\"no\"\u003eSQL_SERVER_LICENSE\u003c/var\u003e: the SQL Server license you want to add to the boot disk. For information on SQL Server licenses, see the License tab in section [SQL Server on Windows](/compute/docs/images/os-details#sql_server_on_windows)\n - \u003cvar translate=\"no\"\u003eBOOT_DISK_NAME\u003c/var\u003e: the name of the source boot disk that you want to clone\n - \u003cvar translate=\"no\"\u003eBOOT_DISK_ZONE\u003c/var\u003e: the zone of the source boot disk\n - \u003cvar translate=\"no\"\u003eCLONED_BOOT_DISK_ZONE\u003c/var\u003e: the zone in which you want to create the cloned boot disk\n7. Verify that the new disk has the correct license:\n\n ```\n gcloud compute disks describe CLONED_BOOT_DISK_NAME \\\n --zone=CLONED_BOOT_DISK_ZONE\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eCLONED_BOOT_DISK_NAME\u003c/var\u003e: the name of the cloned book disk\n - \u003cvar translate=\"no\"\u003eCLONED_BOOT_DISK_ZONE\u003c/var\u003e: the zone of the cloned boot disk\n8. Attach the new disk as the boot disk for the instance:\n\n ```\n gcloud compute instances attach-disk VM_NAME \\\n --disk=CLONED_BOOT_DISK_NAME\n --boot\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e: the name of the instance to which you want to attach the cloned boot disk\n - \u003cvar translate=\"no\"\u003eCLONED_BOOT_DISK_NAME\u003c/var\u003e: the name of the cloned book disk\n9. Verify that the instance's boot disk is the new cloned disk with SQL Server\n licensing.\n\n ```\n gcloud compute instances describe VM_NAME\n ```\n\n Replace \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e with the name of the instance.\n10. Start the instance.\n\n ```\n gcloud compute instances start VM_NAME\n ```\n\n Replace \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e with the name of the instance.\n11. (Optional) When you are sure that you don't want to revert back to the earlier\n boot disk, you can delete the disk.\n\n ```\n gcloud compute disks delete BOOT_DISK_NAME \\\n --zone=BOOT_DISK_ZONE\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eBOOT_DISK_NAME\u003c/var\u003e: the name of the boot disk that you want to delete\n - \u003cvar translate=\"no\"\u003eBOOT_DISK_ZONE\u003c/var\u003e: the zone of the boot disk\n\nObtain the SQL Server media and install SQL Server\n--------------------------------------------------\n\nTo obtain the SQL Server installation media and copy it to a Compute Engine\ninstance boot disk, do the following:\n\n1. Create a new disk containing the SQL Server installation media using any\n version of SQL server (for example, 2019 Enterprise):\n\n ```\n gcloud compute disks create SQL_SERVER_MEDIA_DISK_NAME \\\n --image-family=sql-ent-2019-win-2022 \\\n --image-project=windows-sql-cloud \\\n --zone=SQL_SERVER_ZONE\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eSQL_SERVER_MEDIA_DISK_NAME\u003c/var\u003e: the name of the SQL Server media disk that you want to create\n - \u003cvar translate=\"no\"\u003eSQL_SERVER_ZONE\u003c/var\u003e: the zone in which you want to create the SQL Server media disk\n2. Attach the disk to any existing Compute Engine instance:\n\n ```\n gcloud compute instances attach-disk VM_INSTANCE_NAME \\\n --disk=SQL_SERVER_MEDIA_DISK_NAME\n --zone=SQL_SERVER_ZONE\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eVM_INSTANCE_NAME\u003c/var\u003e: the name of the instance to which you want to attach the SQL Server media disk\n - \u003cvar translate=\"no\"\u003eSQL_SERVER_MEDIA_DISK_NAME\u003c/var\u003e: the name of the SQL Server media disk\n - \u003cvar translate=\"no\"\u003eSQL_SERVER_ZONE\u003c/var\u003e: the zone of the instance\n\n After the SQL Server media disk is attached to a instance, on your Windows\n machine, open the **Disk Management** page to see if the disk has a drive\n letter assigned to it. If not, right-click on the disk and select **Online**\n to bring it online. The SQL Server media disk is now the `D:` drive on the\n **Disk Management** page and in Windows Explorer.\n3. Verify that the boot disk of your instance has at least 5 GB of free disk\n space and copy the SQL Server media to your boot disk:\n\n ```\n robocopy /mir d:\\sql_server_install\\ c:\\sql_server_install\n ```\n4. Detach the SQL Server media disk from the instance:\n\n ```\n gcloud compute instances detach-disk VM_INSTANCE_NAME \\\n --disk=SQL_SERVER_MEDIA_DISK_NAME\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eVM_INSTANCE_NAME\u003c/var\u003e: the name of the instance you from which you want to detach the SQL Server media disk\n - \u003cvar translate=\"no\"\u003eSQL_SERVER_MEDIA_DISK_NAME\u003c/var\u003e: the name of the SQL Server media disk that you want to detach from the instance\n\nFor more information, see [Microsoft SQL Server installation guide](https://learn.microsoft.com/en-us/sql/database-engine/install-windows/install-sql-server?view=sql-server-ver16#sql-server-installation).\n\nApply a SQL server product key to a Compute Engine instance\n-----------------------------------------------------------\n\nIn order to upgrade the SQL Server installation media, you must obtain and apply\na product key to the Compute Engine instance on which the SQL Server is\ninstalled. To obtain the product key and upgrade the SQL Server installation\nmedia, do the following:\n\n1. Obtain the product key from the SQL Server installation media:\n\n ```\n C:\\\u003e type C:\\sql_server_install\\x64\\DefaultSetup.ini\n ```\n2. Connect to the instance on which the SQL Server is installed [using Remote Desktop](/compute/docs/instances/connecting-to-windows) and sign in using your domain user.\n\n3. Right-click the **Start** button (or press **Win+X** ) and select **Run**.\n\n4. Confirm the elevation prompt by clicking **Yes**.\n\n5. Start the SQL Server setup:\n\n ```\n & c:\\sql_server_install\\setup.exe\n ```\n\nWhat's next\n-----------\n\n- [Learn about licenses](/compute/docs/licenses/about)\n\n- [View the SQL Server tutorials](/compute/docs/tutorials#sql-server)\n\n- [View the supported editions of SQL Server](/compute/docs/images/os-details#sql_server)"]]