You can switch your Windows Server virtual machine (VM) instances from a bring-your-own-license (BYOL) model to a pay-as-you-go (PAYG) model. License changes from PAYG to BYOL are not supported. For more details on Windows Server licensing on Cloud de Confiance by S3NS, see Microsoft Licensing on Cloud de Confiance by S3NS.
For details on license references, license codes, and how to determine allowed license modifications, see License changes and restrictions.
Before you begin
-
If you haven't already, set up authentication.
Authentication verifies your identity for access to Cloud de Confiance by S3NS services and APIs. To run
code or samples from a local development environment, you can authenticate to
Compute Engine by selecting one of the following options:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Cloud de Confiance console to access Cloud de Confiance by S3NS services and APIs, you don't need to set up authentication.
gcloud
-
Install the Google Cloud CLI, and then sign in to the gcloud CLI with your federated identity. After signing in, initialize the Google Cloud CLI by running the following command:
gcloud init - Set a default region and zone.
-
Prepare to update a disk's license
To update the disk's license while the disk is attached to a running instance, first either stop the instance or detach the disk.
- Stop the instance. Temporarily shuts down the instance before updating the disk's license.
- Detach the disk. This detaches the disk from the instance before updating the disk's license.
Change a BYOL license to a PAYG license
To replace a BYOL license with a PAYG license, use the Google Cloud CLI or the Compute Engine API.
gcloud
To replace a disk's license with a license reference or code, use the
gcloud compute disks update command:
gcloud compute disks update DISK_NAME \
--replace-license=PREVIOUS_LICENSE,NEW_LICENSE
Replace the following:
DISK_NAME: the name of the disk to replace.PREVIOUS_LICENSE: the previous license reference being replaced, for example,"projects/windows-cloud/global/licenses/windows-server-2016-byol","projects/windows-cloud/global/licenses/windows-server-2019-byol".NEW_LICENSE: the new license reference, for example,"projects/windows-cloud/global/licenses/windows-server-2016-dc","projects/windows-cloud/global/licenses/windows-server-2019-dc".
REST
To replace a disk's license, add the new license to the request body and
omit the previous license. Call the following
disks.update v1 method:
PATCH https://compute.googleapis.com/compute/v1/projects/PROJECT/zones/ZONE/disks/DISK_NAME?paths=licenses --data '{"name":"DISK_NAME", "licenses":["https://www.googleapis.com/compute/v1/NEW_LICENSE"]}'
Replace the following:
PROJECT: the name of the projectZONE: the zone containing the VMDISK_NAME: the name of the diskNEW_LICENSE: the new license reference, for example,"projects/windows-cloud/global/licenses/windows-server-2016-dc","projects/windows-cloud/global/licenses/windows-server-2019-dc", or license code, for example,"1000213","3389558045860892917".
Activate the new PAYG license
After you replace the license on the disk, you must activate the operating system using the Cloud de Confiance by S3NS Key Management Service (KMS).
To activate the license, complete the following steps on the Windows VM:
- Connect to the Windows VM.
- Open a PowerShell terminal as an administrator.
Update the Google Compute Engine sysprep package. This ensures you have the latest version of the activation script containing the required license codes.
googet -noconfirm update google-compute-engine-sysprep
Run the
activate_instance.ps1script. This script detects the new PAYG license and configures the correct KMS server.& "C:\Program Files\Google\Compute Engine\sysprep\activate_instance.ps1"
Validate the license change
To validate that your license has been changed on the boot disk, use the following procedure:
Get information about the boot disk by running the
gcloud compute disks describecommand:gcloud compute disks describe DISK_NAME \ --zone=ZONE \ --format="value(licenses)"Replace the following:
DISK_NAME: the name of the boot disk to validate the license ofZONE: the zone containing the boot disk to validate the license of
Verify that the output is similar to the following:
https://www.googleapis.com/compute/v1/projects/windows-cloud/global/licenses/windows-server-2019-dc