There could be various reasons why you are encountering this error while trying to export the image to the Azure Compute gallery. Here are some things you can try:
- Check your permissions: Ensure that you have the necessary permissions to perform the export operation. Check that you are assigned the Contributor role or have been granted the necessary permissions on the target Azure subscription. If not, ask your Azure administrator to grant you the necessary permissions.
- Check the image name: Ensure that the name of the image that you are trying to export does not contain special characters or exceeds the maximum allowed length (64 characters). Also, ensure that the image name is unique within the Azure Compute gallery.
- Check the image status: Ensure that the status of the image is "Generalized" before exporting it to the Azure Compute gallery. If the image status is "Specialized", you will need to generalize the image before exporting it.
- Check the image size: Ensure that the size of the image does not exceed the maximum allowed size (128GB). If the image size exceeds this limit, you will need to reduce the size of the image before exporting it.
- Check the network connectivity: Ensure that you have a stable internet connection and that you are not behind a proxy or firewall that might be blocking the export operation.
If none of the above solutions work, you can try exporting the image using the Azure CLI or PowerShell. Here are some resources that can help you with that:
- Export a VM image to the Azure gallery using Azure CLI: https://docs.microsoft.com/en-us/azure/virtual-machines/linux/shared-image-galleries#export-a-vm-image-to-a-shared-image-gallery
- Export a VM image to the Azure gallery using PowerShell: https://docs.microsoft.com/en-us/azure/virtual-machines/windows/shared-image-galleries#export-a-vm-image-to-a-shared-image-gallery