The following arguments are supported:
Note:
zone_resilient can only be set to true if the image is stored in a region that supports availability zones.
The os_disk block supports the following:
The data_disk block supports the following:
resource "azurerm_resource_group" "example" {
name = "example-resources"
location = "West Europe"
}
resource "azurerm_network_interface" "example" {
name = "test-nic"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
ip_configuration {
name = "testconfiguration1"
private_ip_address_allocation = "Static"
}
}
resource "azurerm_virtual_machine" "example" {
name = "acctestvm"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
network_interface_ids = [azurerm_network_interface.example.id]
vm_size = "Standard_D1_v2"
storage_os_disk {
name = "myosdisk1"
create_option = "FromImage"
}
}
resource "azurerm_image" "example" {
name = "acctest"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
os_disk {
os_type = "Linux"
os_state = "Generalized"
blob_uri = azurerm_virtual_machine.example.storage_os_disk[0].vhd_uri
size_gb = 30
}
}
az image create --name
--resource-group
--source
[--data-disk-caching {None, ReadOnly, ReadWrite}]
[--data-disk-sources]
[--edge-zone]
[--hyper-v-generation {V1, V2}]
[--location]
[--os-disk-caching {None, ReadOnly, ReadWrite}]
[--os-type {Linux, Windows}]
[--storage-sku {PremiumV2_LRS, Premium_LRS, Premium_ZRS, StandardSSD_LRS, StandardSSD_ZRS, Standard_LRS, UltraSSD_LRS}]
[--tags]
[--zone-resilient {false, true}]
az image create -g MyResourceGroup -n image1 --os-type Linux \
--source /subscriptions/db5eb68e-73e2-4fa8-b18a-0123456789999/resourceGroups/rg1/providers/Microsoft.Compute/snapshots/s1
Categorized by Availability, Security & Compliance and Cost