2.9 KiB
title, intro, versions
| title | intro | versions | ||
|---|---|---|---|---|
| Creating custom images | You can create custom images for {% data variables.actions.hosted_runner %}s. |
|
{% 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.
-
Provision a new VM in your tenant using a marketplace image or a virtual hard drive(VHD).
-
Optionally, install your required software on the VM.
-
Deprovision the VM:
- For Linux:
sshto the VM and run:$ sudo waagent -deprovision+user - For Windows: Follow the steps described at "Generalize the source VM by using Sysprep."
- For Linux:
-
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- Replace
octo-vmwith the name of your virtual machine. - For more information regarding these steps, see "How to create a managed image of a virtual machine or VHD."
- Replace
-
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)to86400(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-vmwith the name of your virtual machine.
- Replace
- Using the Azure Portal: On the disk resource, navigate to Disk Export, set
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".