# Import images

> An Azure server is provisioned from an image that has been imported into its region

---

Site [llms.txt](/llms.txt)

---

Import images from the handler's **Images** tab, which lists each imported region and the images already available in it. Import the regions you need on the **Regions** tab first: an image can only be imported into a region Cloud Management Platform (CMP) knows about.

## Import public images

Azure publishes a large number of images, so CMP imports them in two steps. The **Fetch and Cache Available Azure Images** rule caches Azure's offering, and **Import Images** on the Images tab picks from that cache. Until the rule has run at least once, the import dialog has nothing to show.

Run the rule from the Rules page when you need fresh images:

1. Go to **Admin** > **Rules**.
1. Select **Fetch and Cache Available Azure Images**.
1. Select **Execute**, then select **Run**. The rule runs as a job you can follow to completion.

<div class="alert alert-info" role="alert">


To run the rule on a schedule instead, enable the **Execute all Rules** recurring job under **Admin** > **Recurring Jobs**. It runs every enabled rule.
</div>


Once the cache holds images, add them to a region:

1. Go to **Admin** > **Resource Handlers** and select your Azure handler.
1. Select the **Images** tab.
1. Select **Import Images** beside the target region.
1. Choose images from the list, then select **Next**.
1. Map each image to an OS build, then select **Import selected Images**.

The imported images are added to each environment associated with that region, ready to provision.

## Limit what the rule fetches

The rule fetches a CloudBolt-provided list of common images rather than everything Azure offers. The rule's **Use whitelist** action input controls this and is True by default. The Execute dialog exposes the same input, so you can change it for a single run without editing the rule.

To replace the built-in list with your own, define `AZURE_IMAGE_WHITELIST` in `customer_settings.py` as a list of tuples giving the publisher, offer, SKU, and version of each image. Use `latest` as the version to always take the newest release.

```python
AZURE_IMAGE_WHITELIST = [
    # (publisher, offer, SKU, version)
    ('redhat', 'RHEL', '8-LVM', 'latest'),
    ('canonical', '0001-com-ubuntu-server-focal', '20_04-lts', 'latest'),
    ('MicrosoftWindowsServer', 'WindowsServer', '2022-Datacenter', 'latest'),
]
```

<div class="alert alert-warning" role="alert">


**Fetching every image takes hours.** If you set **Use whitelist** to False, the rule fetches the full catalog: Azure takes around 20 minutes per region, and the job pauses for 30 minutes before the next region to stay within Azure's API rate limit. Leave the list in place unless you need an image it omits.
</div>


## Import a single public image

When you know the image you want, add it directly instead of caching the catalog.

1. On the **Images** tab, select **Add Image Manually**.
1. In the **Add Public Image** dialog, enter the image's publisher, offer, SKU, and version, and select the regions to import it into.
1. Submit the dialog.

The image is added to each environment associated with each selected region.

## Import private images

CMP imports every private image in the subscription in one action.

1. On the **Images** tab, select **Import Private Images**.
1. Confirm the dialog with **Import**.

The import runs as a job. Each image found is imported into its own region and added to the environments in that region. Images in regions you have not imported are skipped; import those regions first.

## Import shared gallery images

Azure shared image galleries allow images to be shared across subscriptions. CMP imports images from every gallery the handler's account can access into each region where an image has been replicated. As with private images, regions not imported are skipped.

1. On the **Images** tab, select **Import Shared Gallery Images**.
1. Confirm the dialog with **Import**.

The import runs as a job, and shared images appear under their region with a **Publisher** of `shared`. If a gallery you expect is missing, check that the application registered in Azure has permission to read resources in the subscription that owns it.

## Related

- [Azure](/docs/cmp/configure/infrastructure/resource-handlers/azure/): create the resource handler and import its regions.
- [Provisioning](/docs/cmp/configure/infrastructure/resource-handlers/azure/provisioning/): the parameters that shape an Azure order.
- [OS builds](/docs/cmp/configure/infrastructure/os-builds/): how images map to the operating systems users order.
- [Rules](/docs/cmp/use/orchestration/rules/): how rules are enabled, scheduled, and run.
