This document shows you how to resolve issues related to importing and migrating
virtual machine (VM) instances to Compute Engine that have a misapplied
license.

For example, learn how to resolve issues with a VM that has an on-demand license
instead of a bring your own license (BYOL). For information about the different
types of licenses, see [About licenses](https://docs.cloud.google.com/compute/docs/licenses/about).

## Mitigate incorrect license imports or migrations

If you tried to import or migrate a VM into Compute Engine with a BYOL or BYOS
license, but the VM's [license string](https://docs.cloud.google.com/compute/docs/images/os-details#license-strings)
is not appended with `byol` or `byos`, then your license was not successfully
imported or migrated with the VM.

To resolve this issue, do one of the following depending on how you imported or
migrated the VM:

- If you imported the VM using the
  [`gcloud compute instances import` command](https://docs.cloud.google.com/sdk/gcloud/reference/compute/instances/import)
  or the Cloud Build API, import the VM again, and specify the
  [`--os` flag](https://docs.cloud.google.com/sdk/gcloud/reference/compute/instances/import#--os) with the
  `byol` version of the OS.

- If you imported the VM using the
  [`gcloud beta compute machine-images import` command](https://docs.cloud.google.com/sdk/gcloud/reference/beta/compute/machine-images/import),
  import the VM again, and specify the
  [`--byol` flag](https://docs.cloud.google.com/sdk/gcloud/reference/beta/compute/machine-images/import#--byol).

- If you imported the VM using the
  [`gcloud beta compute images import` command](https://docs.cloud.google.com/sdk/gcloud/reference/beta/compute/images/import),
  import the VM again, and specify the
  [`--byol` flag](https://docs.cloud.google.com/sdk/gcloud/reference/beta/compute/images/import#--byol).

- If you migrated the VM using Migrate to Virtual Machines, contact
  Cloud Customer Care to help you resolve the issue. For more information, see
  [Getting support with Cloud Customer Care](https://docs.cloud.google.com/support/docs).

## What's next

- [Learn how to view and append license strings](https://docs.cloud.google.com/compute/docs/licenses/view-append)