Table: azure_compute_image - Query Azure Compute Images using SQL
Azure Compute Images are pre-configured operating system images used to create virtual machines within the Azure platform. These images include a set of pre-installed applications and configurations, which can be used to quickly deploy new virtual machines. Azure Compute Images provide a convenient way to manage and maintain consistent configurations across multiple virtual machines.
Table Usage Guide
The azure_compute_image
table provides insights into Azure Compute Images within Azure. As a DevOps engineer, explore image-specific details through this table, including image versions, operating system types, and associated metadata. Utilize it to uncover information about images, such as those with specific versions, the operating system types, and the verification of configurations.
Examples
Basic compute image info
This query allows you to gain insights into the basic information of your Azure compute images, including their name, type, and region. It's particularly useful when you need to understand the specifics of the source virtual machine associated with each image.
select name, type, region, hyper_v_generation, split_part(source_virtual_machine_id, '/', 9) as source_virtual_machinefrom azure_compute_image;
Error: SQLite does not support split_part function.
Storage profile's OS disk info of each compute image
Determine the size, type, and status of your operating system disk within each compute image in Azure. This query can help you manage your storage resources more effectively by identifying potential areas for optimization.
select name, storage_profile_os_disk_size_gb, storage_profile_os_disk_snapshot_id, storage_profile_os_disk_storage_account_type, storage_profile_os_disk_state, storage_profile_os_disk_typefrom azure_compute_image;
select name, storage_profile_os_disk_size_gb, storage_profile_os_disk_snapshot_id, storage_profile_os_disk_storage_account_type, storage_profile_os_disk_state, storage_profile_os_disk_typefrom azure_compute_image;
List of compute images where disk storage type is Premium_LRS
This example helps you identify the compute images that use Premium_LRS as their disk storage type. Understanding the storage type of your compute images can assist in optimizing performance and cost in your Azure environment.
select name, split_part(disk -> 'managedDisk' ->> 'id', '/', 9) as disk_name, disk ->> 'storageAccountType' as storage_account_type, disk ->> 'diskSizeGB' as disk_size_gb, disk ->> 'caching' as cachingfrom azure_compute_image cross join jsonb_array_elements(storage_profile_data_disks) as diskwhere disk ->> 'storageAccountType' = 'Premium_LRS';
Error: SQLite does not support splitor string_to_array functions.
List of compute images which do not have owner or app_id tag key
Explore which Azure compute images lack either an owner or app_id tag, helping to identify potential issues with image management and organization. This can be useful for maintaining a clean and efficient cloud environment.
select id, namefrom azure_compute_imagewhere tags -> 'owner' is null or tags -> 'app_id' is null;
select id, namefrom azure_compute_imagewhere json_extract(tags, '$.owner') is null or json_extract(tags, '$.app_id') is null;
Query examples
Schema for azure_compute_image
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
akas | jsonb | Array of globally unique identifier strings (also known as) for the resource. | |
cloud_environment | text | The Azure Cloud Environment. | |
hyper_v_generation | text | Gets the HyperVGenerationType of the VirtualMachine created from the image | |
id | text | Contains ID to identify a image uniquely | |
name | text | = | The friendly name that identifies the image |
provisioning_state | text | The provisioning state of the image resource | |
region | text | The Azure region/location in which the resource is located. | |
resource_group | text | = | The resource group which holds this resource. |
source_virtual_machine_id | text | Contains the id of the virtual machine | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
storage_profile_data_disks | jsonb | A list of parameters that are used to add a data disk to a virtual machine | |
storage_profile_os_disk_blob_uri | text | Contains uri of the virtual hard disk | |
storage_profile_os_disk_caching | text | Specifies the caching requirements | |
storage_profile_os_disk_encryption_set | text | Specifies the customer managed disk encryption set resource id for the managed image disk | |
storage_profile_os_disk_managed_disk_id | text | Contains the id of the managed disk | |
storage_profile_os_disk_size_gb | bigint | Specifies the size of empty data disks in gigabytes | |
storage_profile_os_disk_snapshot_id | text | Contains the id of the snapshot | |
storage_profile_os_disk_state | text | Contains state of the OS | |
storage_profile_os_disk_storage_account_type | text | Specifies the storage account type for the managed disk | |
storage_profile_os_disk_type | text | Specifies the type of the OS that is included in the disk if creating a VM from a custom image | |
storage_profile_zone_resilient | boolean | Specifies whether an image is zone resilient or not | |
subscription_id | text | =, !=, ~~, ~~*, !~~, !~~* | The Azure Subscription ID in which the resource is located. |
tags | jsonb | A map of tags for the resource. | |
title | text | Title of the resource. | |
type | text | Type of the resource |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- azure
You can pass the configuration to the command with the --config
argument:
steampipe_export_azure --config '<your_config>' azure_compute_image