vCenter

 View Only
  • 1.  Set Secure Boot using api

    Posted Aug 23, 2023 06:58 AM

    Any way to specify Boot Options: EFI and enable Secure boot when creating vm in API?



  • 2.  RE: Set Secure Boot using api

    Posted Aug 25, 2023 04:48 AM
    1. VMware: If you're using VMware, you can create a virtual machine using the vSphere API. To enable Secure Boot and specify boot options, you would need to provide the appropriate parameters in the API call. Refer to the VMware vSphere API documentation for creating virtual machines and configuring Secure Boot settings.

    2. Hyper-V: If you're using Hyper-V, you can utilize the Hyper-V Management API to create virtual machines. Similar to VMware, you'll need to include the necessary parameters to enable Secure Boot and specify boot options in your API call.

    3. KVM/QEMU: If you're using KVM/QEMU, you can create virtual machines using libvirt. Secure Boot and boot options can often be configured through the XML definition of the virtual machine. You would need to set the appropriate XML attributes to enable Secure Boot and specify boot options.

    4. Azure/AWS/GCP: Cloud providers like Microsoft Azure, Amazon Web Services (AWS), and Google Cloud Platform (GCP) also offer APIs for creating virtual machines. Depending on the cloud provider, you would need to look into their API documentation to see how to enable Secure Boot and specify boot options during virtual machine creation.

    It's important to note that Secure Boot and boot options might have dependencies on the underlying hardware, firmware, and virtualization technology. Ensure that your virtualization platform and the specific virtual machine template or image you're using support these features.



  • 3.  RE: Set Secure Boot using api

    Posted Aug 25, 2023 09:58 AM

    Yes, you can specify Boot Options: EFI and enable Secure boot when creating a VM in the API using the following steps:

    1. Create a JSON object that defines the VM configuration:
    {
      "name": "my-vm",
      "guestId": "centos7",
      "bootOptions": {
        "firmware": "efi",
        "secureBoot": true
      }
    }
    1. Use the VMware vSphere API to create the VM:
    POST https://vcenter.example.com/api/vsphere/vcenter/vms
    Content-Type: application/json
    
    {
      "spec": {
        "name": "my-vm",
        "guestId": "centos7",
        "bootOptions": {
          "firmware": "efi",
          "secureBoot": true
        }
      }
    }

     

    1. The vSphere API will create the VM and configure it to boot in EFI mode with Secure boot enabled.


  • 4.  RE: Set Secure Boot using api

    Posted Dec 11, 2023 01:01 PM

    Thanks and sorry for late reply

    We are using vCenter REST APIs and can't find the possibility to use the settings you mention

    Do you know what we can use here?

    vCenter REST APIs API Reference Documentation (vmware.com)