anjuna-azure-cli disk upload

anjuna-azure-cli disk upload \
  --image-gallery <image-gallery> \
  --image-version <image-version> \
  --resource-group <resource-group> \
  --storage-account <storage-account> \
  --storage-container <storage-container> [OPTIONS...]

Uploads the local disk image to an Azure Storage Container and creates a shared image in an Azure Shared Image Gallery. The Shared Image is saved as an Image Version of a pre-existing Image Definition.

You need to have the following resources ready before issuing the upload command. The anjuna-azure-cli command does not create the resources.

  • Resource Group

  • Storage Account

  • Storage Container

  • Image Gallery

  • Image Definition (settings shown below)

You must be logged in to a valid Azure account permitted to access the cloud storage. Use the az account show command to confirm that you are logged in. If you are not logged in, consider using the az login command to initialize your az session.
Azure requires some resources to be created in the same region/location. Uploading the disk is a two-step operation, with step one uploading the disk to the storage container, and step two creating an Image Version. anjuna-azure-cli combines these steps. Azure requires the disk and the Image Version to be in the same region. The disk is associated with the location of the storage container. If no location or region is set, the Image Version is associated with an inherited location. Therefore, to prevent unexpected errors, it is advisable to provide an explicit location or target-region on the anjuna-azure-cli command line.

Image Definition settings

The Azure Image Definition must have the following settings to be used with anjuna-azure-cli disk upload:

Architecture: "x64"
Features: {
    SecurityType: "ConfidentialVmSupported"
}
HyperVGeneration: "V2"
OsState: "Specialized"
OsType:  "Linux"

Options

Usage

anjuna-azure-cli disk upload \
  --image-gallery <image-gallery> \
  --image-version <image-version> \
  --resource-group <resource-group> \
  --storage-account <storage-account> \
  --storage-container <storage-container> [OPTIONS...]

--disk

Path to the local disk to upload (default: disk.vhd)

--image-definition

The Azure Image Definition to be updated (default: uses the value passed by --image-name)

(Required) The Azure Image Definition’s parent shared image gallery

--image-name

Name of the uploaded disk image (default: disk.vhd)

--image-version

(Required) The image version to be created

--resource-group

(Required) The Azure resource group to be used for the artifacts needed for this operation

-a, --storage-account

(Required) Storage account for the uploaded images

--storage-container

(Required) Storage container to upload the disks to

--location

The location to associate with your resources

--subscription-id

Azure subscription ID to use

--target-regions <region>[=<replica count>][=<storage account type>]

Use <region>[=<replica count>][=<storage account type>] to set regions and associated properties

Global options

The following options are available for all anjuna-azure-cli subcommands.

Global options

-h, --help

Prints the help information for the command

--debug

Prints debug messaging

-v, --version

Prints the anjuna-azure-cli version

Also read:

  • Use az account show --query id to retrieve the subscription ID in use, or az account list --query [].id to get a list of all your subscription IDs.

  • Use az group list --output table to get a list of your available resource groups.

Exit status

  • 0 on success

  • 1 on error

Examples

$ az sig image-definition show -g my-tests -r my_image_gallery --gallery-image-definition my_linux_image
{
  "architecture": "x64",
  "description": "",
  "disallowed": {
    "diskTypes": []
  },
  "endOfLifeDate": null,
  "eula": null,
  "features": [
    {
      "name": "SecurityType",
      "value": "ConfidentialVmSupported"
    }
  ],
  "hyperVGeneration": "V2",
  "id": "/subscriptions/****/resourceGroups/my-tests/providers/Microsoft.Compute/galleries/my_image_gallery/images/my_linux_image",
  "identifier": {
    "offer": "CVMGA",
    "publisher": "Anjuna",
    "sku": "mylinuxos"
  },
  "location": "eastus",
  "name": "my_linux_image",
  "osState": "Specialized",
  "osType": "Linux",
  "privacyStatementUri": null,
  "provisioningState": "Succeeded",
  "purchasePlan": null,
  "recommended": {
    "memory": {
      "max": null,
      "min": null
    },
    "vCpUs": {
      "max": null,
      "min": null
    }
  },
  "releaseNoteUri": null,
  "resourceGroup": "my-tests",
  "tags": {},
  "type": "Microsoft.Compute/galleries/images"
}

$ anjuna-azure-cli disk upload \
  --disk hello-world-disk.vhd \
  --image-name hello-world-disk.vhd \
  --storage-account mystorageaccount \
  --storage-container mystoragecontainer \
  --resource-group myresourcegroup \
  --image-gallery my_image_gallery \
  --image-definition my_linux_image \
  --image-version 0.1.0 \
  --location eastus \
  --subscription-id 123abcde-1234-1234-1234-12345678