Compartir a través de


Gallery Images - Create Or Update

Create or update a gallery image definition.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}?api-version=2023-07-03

URI Parameters

Name In Required Type Description
galleryImageName
path True

string

The name of the gallery image definition to be created or updated. The allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 characters.

galleryName
path True

string

The name of the Shared Image Gallery in which the Image Definition is to be created.

resourceGroupName
path True

string

The name of the resource group.

subscriptionId
path True

string

Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.

api-version
query True

string

Client Api Version.

Request Body

Name Required Type Description
location True

string

Resource location

properties.identifier True

GalleryImageIdentifier

This is the gallery image definition identifier.

properties.osState True

OperatingSystemStateTypes

This property allows the user to specify whether the virtual machines created under this image are 'Generalized' or 'Specialized'.

properties.osType True

OperatingSystemTypes

This property allows you to specify the type of the OS that is included in the disk when creating a VM from a managed image. Possible values are: Windows, Linux.

properties.architecture

Architecture

The architecture of the image. Applicable to OS disks only.

properties.description

string

The description of this gallery image definition resource. This property is updatable.

properties.disallowed

Disallowed

Describes the disallowed disk types.

properties.endOfLifeDate

string

The end of life date of the gallery image definition. This property can be used for decommissioning purposes. This property is updatable.

properties.eula

string

The Eula agreement for the gallery image definition.

properties.features

GalleryImageFeature[]

A list of gallery image features.

properties.hyperVGeneration

HyperVGeneration

The hypervisor generation of the Virtual Machine. Applicable to OS disks only.

properties.privacyStatementUri

string

The privacy statement uri.

properties.purchasePlan

ImagePurchasePlan

Describes the gallery image definition purchase plan. This is used by marketplace images.

properties.recommended

RecommendedMachineConfiguration

The properties describe the recommended machine configuration for this Image Definition. These properties are updatable.

properties.releaseNoteUri

string

The release note uri.

tags

object

Resource tags

Responses

Name Type Description
200 OK

GalleryImage

OK

201 Created

GalleryImage

Created

202 Accepted

GalleryImage

Accepted

Other Status Codes

CloudError

Error response describing why the operation failed.

Security

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

Sample request

PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/images/myGalleryImageName?api-version=2023-07-03

{
  "location": "West US",
  "properties": {
    "osType": "Windows",
    "osState": "Generalized",
    "hyperVGeneration": "V1",
    "identifier": {
      "publisher": "myPublisherName",
      "offer": "myOfferName",
      "sku": "mySkuName"
    }
  }
}

Sample response

{
  "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGallery/Images/myGalleryImageName",
  "properties": {
    "osType": "Windows",
    "osState": "Generalized",
    "hyperVGeneration": "V1",
    "identifier": {
      "publisher": "myPublisherName",
      "offer": "myOfferName",
      "sku": "mySkuName"
    },
    "provisioningState": "Updating"
  },
  "location": "West US",
  "name": "myGalleryImageName"
}
{
  "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGallery/Images/myGalleryImageName",
  "properties": {
    "osType": "Windows",
    "osState": "Generalized",
    "hyperVGeneration": "V1",
    "identifier": {
      "publisher": "myPublisherName",
      "offer": "myOfferName",
      "sku": "mySkuName"
    },
    "provisioningState": "Creating"
  },
  "location": "West US",
  "name": "myGalleryImageName"
}
{
  "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGallery/Images/myGalleryImageName",
  "properties": {
    "osType": "Windows",
    "osState": "Generalized",
    "hyperVGeneration": "V1",
    "identifier": {
      "publisher": "myPublisherName",
      "offer": "myOfferName",
      "sku": "mySkuName"
    },
    "provisioningState": "Updating"
  },
  "location": "West US",
  "name": "myGalleryImageName"
}

Definitions

Name Description
ApiError

Api error.

ApiErrorBase

Api error base.

Architecture

The architecture of the image. Applicable to OS disks only.

CloudError

An error response from the Compute service.

Disallowed

Describes the disallowed disk types.

GalleryImage

Specifies information about the gallery image definition that you want to create or update.

GalleryImageFeature

A feature for gallery image.

GalleryImageIdentifier

This is the gallery image definition identifier.

GalleryProvisioningState

The current state of the gallery or gallery artifact.

HyperVGeneration

The hypervisor generation of the Virtual Machine. Applicable to OS disks only.

ImagePurchasePlan

Describes the gallery image definition purchase plan. This is used by marketplace images.

InnerError

Inner error details.

OperatingSystemStateTypes

This property allows the user to specify whether the virtual machines created under this image are 'Generalized' or 'Specialized'.

OperatingSystemTypes

This property allows you to specify the supported type of the OS that application is built for. Possible values are: Windows, Linux.

RecommendedMachineConfiguration

The properties describe the recommended machine configuration for this Image Definition. These properties are updatable.

ResourceRange

Describes the resource range.

ApiError

Api error.

Name Type Description
code

string

The error code.

details

ApiErrorBase[]

The Api error details

innererror

InnerError

The Api inner error

message

string

The error message.

target

string

The target of the particular error.

ApiErrorBase

Api error base.

Name Type Description
code

string

The error code.

message

string

The error message.

target

string

The target of the particular error.

Architecture

The architecture of the image. Applicable to OS disks only.

Name Type Description
Arm64

string

x64

string

CloudError

An error response from the Compute service.

Name Type Description
error

ApiError

Api error.

Disallowed

Describes the disallowed disk types.

Name Type Description
diskTypes

string[]

A list of disk types.

GalleryImage

Specifies information about the gallery image definition that you want to create or update.

Name Type Description
id

string

Resource Id

location

string

Resource location

name

string

Resource name

properties.architecture

Architecture

The architecture of the image. Applicable to OS disks only.

properties.description

string

The description of this gallery image definition resource. This property is updatable.

properties.disallowed

Disallowed

Describes the disallowed disk types.

properties.endOfLifeDate

string

The end of life date of the gallery image definition. This property can be used for decommissioning purposes. This property is updatable.

properties.eula

string

The Eula agreement for the gallery image definition.

properties.features

GalleryImageFeature[]

A list of gallery image features.

properties.hyperVGeneration

HyperVGeneration

The hypervisor generation of the Virtual Machine. Applicable to OS disks only.

properties.identifier

GalleryImageIdentifier

This is the gallery image definition identifier.

properties.osState

OperatingSystemStateTypes

This property allows the user to specify whether the virtual machines created under this image are 'Generalized' or 'Specialized'.

properties.osType

OperatingSystemTypes

This property allows you to specify the type of the OS that is included in the disk when creating a VM from a managed image. Possible values are: Windows, Linux.

properties.privacyStatementUri

string

The privacy statement uri.

properties.provisioningState

GalleryProvisioningState

The current state of the gallery or gallery artifact.
The provisioning state, which only appears in the response.

properties.purchasePlan

ImagePurchasePlan

Describes the gallery image definition purchase plan. This is used by marketplace images.

properties.recommended

RecommendedMachineConfiguration

The properties describe the recommended machine configuration for this Image Definition. These properties are updatable.

properties.releaseNoteUri

string

The release note uri.

tags

object

Resource tags

type

string

Resource type

GalleryImageFeature

A feature for gallery image.

Name Type Description
name

string

The name of the gallery image feature.

value

string

The value of the gallery image feature.

GalleryImageIdentifier

This is the gallery image definition identifier.

Name Type Description
offer

string

The name of the gallery image definition offer.

publisher

string

The name of the gallery image definition publisher.

sku

string

The name of the gallery image definition SKU.

GalleryProvisioningState

The current state of the gallery or gallery artifact.

Name Type Description
Creating

string

Deleting

string

Failed

string

Migrating

string

Succeeded

string

Updating

string

HyperVGeneration

The hypervisor generation of the Virtual Machine. Applicable to OS disks only.

Name Type Description
V1

string

V2

string

ImagePurchasePlan

Describes the gallery image definition purchase plan. This is used by marketplace images.

Name Type Description
name

string

The plan ID.

product

string

The product ID.

publisher

string

The publisher ID.

InnerError

Inner error details.

Name Type Description
errordetail

string

The internal error message or exception dump.

exceptiontype

string

The exception type.

OperatingSystemStateTypes

This property allows the user to specify whether the virtual machines created under this image are 'Generalized' or 'Specialized'.

Name Type Description
Generalized

string

Specialized

string

OperatingSystemTypes

This property allows you to specify the supported type of the OS that application is built for. Possible values are: Windows, Linux.

Name Type Description
Linux

string

Windows

string

RecommendedMachineConfiguration

The properties describe the recommended machine configuration for this Image Definition. These properties are updatable.

Name Type Description
memory

ResourceRange

Describes the resource range.

vCPUs

ResourceRange

Describes the resource range.

ResourceRange

Describes the resource range.

Name Type Description
max

integer

The maximum number of the resource.

min

integer

The minimum number of the resource.