1
0
mirror of synced 2025-12-21 19:06:49 -05:00
Files
docs/content/actions/using-github-hosted-runners/creating-custom-images.md

2.9 KiB

title, intro, versions
title intro versions
Creating custom images You can create custom images for {% data variables.actions.hosted_runner %}s.
ghae
*

{% data reusables.actions.ae-hosted-runners-beta %} {% data reusables.actions.ae-beta %}

Creating an {% data variables.actions.hosted_runner %} with a custom image

{% data variables.actions.hosted_runner %}s can use operating system images that you've customized to suit your needs. This article includes the high level steps for creating the image in Azure and preparing it for {% data variables.product.prodname_ghe_managed %}. For more information, refer to the Azure documentation.

During this beta, to be able to create a custom image for {% data variables.actions.hosted_runner %}s, you will need an Azure subscription that is able to provision a virtual machine.

  1. Provision a new VM in your tenant using a marketplace image or a virtual hard drive(VHD).

  2. Optionally, install your required software on the VM.

  3. Deprovision the VM:

  4. Use the Azure CLI to deallocate and generalize the VM:

    $resourceGroupName = "octocat-testgroup"
    $vmName = "octo-vm"
    
    Stop-AzVM -ResourceGroupName $resourceGroupName -Name $vmName
    Set-AzVM -ResourceGroupName $resourceGroupName -Name $vmName -Generalized
    
  5. Generate a SAS URI for the VM's operating system disk.

    • Using the Azure Portal: On the disk resource, navigate to Disk Export, set URL expires in (seconds) to 86400 (24 hours), and generate the URL.
    • Using the Azure CLI:
      $resourceGroupName = "octocat-testgroup"
      $vmName = "octo-vm"
      
      $vm = Get-AzVM -ResourceGroupName $resourceGroupName -Name $vmName
      Grant-AzDiskAccess `
          -ResourceGroupName $resourceGroupName `
          -DiskName $vm.StorageProfile.OsDisk.Name `
          -Access Read `
          -DurationInSecond 86400
      
      • Replace octo-vm with the name of your virtual machine.

Once you've created the image, you can have it added to {% data variables.product.prodname_ghe_managed %}. For more information, see "Adding an {% data variables.actions.hosted_runner %} with a custom image".