steampipe plugin install azure

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_machine
from
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_type
from
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_type
from
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 caching
from
azure_compute_image
cross join jsonb_array_elements(storage_profile_data_disks) as disk
where
disk ->> 'storageAccountType' = 'Premium_LRS';
Error: SQLite does not support split
or 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,
name
from
azure_compute_image
where
tags -> 'owner' is null
or tags -> 'app_id' is null;
select
id,
name
from
azure_compute_image
where
json_extract(tags, '$.owner') is null
or json_extract(tags, '$.app_id') is null;

Schema for azure_compute_image

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
cloud_environmenttextThe Azure Cloud Environment.
hyper_v_generationtextGets the HyperVGenerationType of the VirtualMachine created from the image
idtextContains ID to identify a image uniquely
nametext=The friendly name that identifies the image
provisioning_statetextThe provisioning state of the image resource
regiontextThe Azure region/location in which the resource is located.
resource_grouptext=The resource group which holds this resource.
source_virtual_machine_idtextContains the id of the virtual machine
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
storage_profile_data_disksjsonbA list of parameters that are used to add a data disk to a virtual machine
storage_profile_os_disk_blob_uritextContains uri of the virtual hard disk
storage_profile_os_disk_cachingtextSpecifies the caching requirements
storage_profile_os_disk_encryption_settextSpecifies the customer managed disk encryption set resource id for the managed image disk
storage_profile_os_disk_managed_disk_idtextContains the id of the managed disk
storage_profile_os_disk_size_gbbigintSpecifies the size of empty data disks in gigabytes
storage_profile_os_disk_snapshot_idtextContains the id of the snapshot
storage_profile_os_disk_statetextContains state of the OS
storage_profile_os_disk_storage_account_typetextSpecifies the storage account type for the managed disk
storage_profile_os_disk_typetextSpecifies the type of the OS that is included in the disk if creating a VM from a custom image
storage_profile_zone_resilientbooleanSpecifies whether an image is zone resilient or not
subscription_idtext=, !=, ~~, ~~*, !~~, !~~*The Azure Subscription ID in which the resource is located.
tagsjsonbA map of tags for the resource.
titletextTitle of the resource.
typetextType 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