你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Gallery Images - Create Or Update

创建或更新库图像定义。

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

URI 参数

名称 必需 类型 说明
galleryImageName
path True

string

要检索的库图像定义的名称。

galleryName
path True

string

共享映像库的名称。

resourceGroupName
path True

string

minLength: 1
maxLength: 90

资源组的名称。 此名称不区分大小写。

subscriptionId
path True

string

minLength: 1

目标订阅的 ID。

api-version
query True

string

minLength: 1

要用于此操作的 API 版本。

请求正文

名称 必需 类型 说明
location True

string

资源所在的地理位置

properties.identifier True

GalleryImageIdentifier

这是库映像定义标识符。

properties.osState True

OperatingSystemStateTypes

此属性允许用户指定在此映像下创建的虚拟机是“通用化”还是“专用”。

properties.osType True

OperatingSystemTypes

此属性允许指定从托管映像创建 VM 时磁盘中包含的 OS 的类型。 可能的值包括:Windows、Linux。

properties.allowUpdateImage

boolean

可选。 如果库映像功能正在更新,则必须设置为 true。

properties.architecture

Architecture

映像的体系结构。 仅适用于 OS 磁盘。

properties.description

string

此库映像定义资源的说明。 此属性可更新。

properties.disallowed

Disallowed

描述不允许的磁盘类型。

properties.endOfLifeDate

string (date-time)

库映像定义的生命周期结束日期。 此属性可用于解除授权目的。 此属性可更新。

properties.eula

string

库映像定义的 Eula 协议。

properties.features

GalleryImageFeature[]

库映像功能的列表。

properties.hyperVGeneration

HyperVGeneration

虚拟机的虚拟机监控程序生成。 仅适用于 OS 磁盘。

properties.privacyStatementUri

string

隐私声明 URI。

properties.purchasePlan

ImagePurchasePlan

描述库映像定义购买计划。 市场映像使用此映像。

properties.recommended

RecommendedMachineConfiguration

这些属性描述此映像定义的推荐计算机配置。 这些属性是可更新的。

properties.releaseNoteUri

string

发行说明 URI。

tags

object

资源标记。

响应

名称 类型 说明
200 OK

GalleryImage

资源“GalleryImage”更新作成功

201 Created

GalleryImage

资源“GalleryImage”创建作成功

标头

  • Location: string
  • Retry-After: integer
202 Accepted

GalleryImage

已接受请求进行处理,但尚未完成处理。

标头

  • Location: string
  • Retry-After: integer
Other Status Codes

CloudError

意外错误响应。

安全性

azure_auth

Azure Active Directory OAuth2 Flow。

类型: oauth2
流向: implicit
授权 URL: https://login.microsoftonline.com/common/oauth2/authorize

作用域

名称 说明
user_impersonation 模拟用户帐户

示例

示例请求

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

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

示例响应

{
  "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"
}

定义

名称 说明
ApiError

API 错误。

ApiErrorBase

Api 错误库。

Architecture

映像的体系结构。 仅适用于 OS 磁盘。

CloudError

来自计算服务的错误响应。

createdByType

创建资源的标识的类型。

Disallowed

描述不允许的磁盘类型。

GalleryImage

指定有关要创建或更新的库映像定义的信息。

GalleryImageFeature

图库图像的功能。

GalleryImageIdentifier

这是库映像定义标识符。

GalleryProvisioningState

预配状态,仅出现在响应中。

HyperVGeneration

虚拟机的虚拟机监控程序生成。 仅适用于 OS 磁盘。

ImagePurchasePlan

描述库映像定义购买计划。 市场映像使用此映像。

InnerError

内部错误详细信息。

OperatingSystemStateTypes

此属性允许用户指定在此映像下创建的虚拟机是“通用化”还是“专用”。

OperatingSystemTypes

此属性允许指定应用程序为其构建的 OS 支持的类型。 可能的值包括:Windows、Linux。

RecommendedMachineConfiguration

这些属性描述此映像定义的推荐计算机配置。 这些属性是可更新的。

ResourceRange

描述资源范围。

systemData

与创建和上次修改资源相关的元数据。

ApiError

API 错误。

名称 类型 说明
code

string

错误代码。

details

ApiErrorBase[]

Api 错误详细信息

innererror

InnerError

Api 内部错误

message

string

错误消息。

target

string

特定错误的目标。

ApiErrorBase

Api 错误库。

名称 类型 说明
code

string

错误代码。

message

string

错误消息。

target

string

特定错误的目标。

Architecture

映像的体系结构。 仅适用于 OS 磁盘。

说明
x64
Arm64

CloudError

来自计算服务的错误响应。

名称 类型 说明
error

ApiError

API 错误。

createdByType

创建资源的标识的类型。

说明
User
Application
ManagedIdentity
Key

Disallowed

描述不允许的磁盘类型。

名称 类型 说明
diskTypes

string[]

磁盘类型的列表。

GalleryImage

指定有关要创建或更新的库映像定义的信息。

名称 类型 说明
id

string

资源的完全限定资源 ID。 例如 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

location

string

资源所在的地理位置

name

string

资源的名称

properties.allowUpdateImage

boolean

可选。 如果库映像功能正在更新,则必须设置为 true。

properties.architecture

Architecture

映像的体系结构。 仅适用于 OS 磁盘。

properties.description

string

此库映像定义资源的说明。 此属性可更新。

properties.disallowed

Disallowed

描述不允许的磁盘类型。

properties.endOfLifeDate

string (date-time)

库映像定义的生命周期结束日期。 此属性可用于解除授权目的。 此属性可更新。

properties.eula

string

库映像定义的 Eula 协议。

properties.features

GalleryImageFeature[]

库映像功能的列表。

properties.hyperVGeneration

HyperVGeneration

虚拟机的虚拟机监控程序生成。 仅适用于 OS 磁盘。

properties.identifier

GalleryImageIdentifier

这是库映像定义标识符。

properties.osState

OperatingSystemStateTypes

此属性允许用户指定在此映像下创建的虚拟机是“通用化”还是“专用”。

properties.osType

OperatingSystemTypes

此属性允许指定从托管映像创建 VM 时磁盘中包含的 OS 的类型。 可能的值包括:Windows、Linux。

properties.privacyStatementUri

string

隐私声明 URI。

properties.provisioningState

GalleryProvisioningState

预配状态,仅出现在响应中。

properties.purchasePlan

ImagePurchasePlan

描述库映像定义购买计划。 市场映像使用此映像。

properties.recommended

RecommendedMachineConfiguration

这些属性描述此映像定义的推荐计算机配置。 这些属性是可更新的。

properties.releaseNoteUri

string

发行说明 URI。

systemData

systemData

包含 createdBy 和 modifiedBy 信息的 Azure 资源管理器元数据。

tags

object

资源标记。

type

string

资源类型。 例如,“Microsoft.Compute/virtualMachines”或“Microsoft.Storage/storageAccounts”

GalleryImageFeature

图库图像的功能。

名称 类型 说明
name

string

库映像功能的名称。

startsAtVersion

string

支持此功能的最低库映像版本。

value

string

库映像功能的值。

GalleryImageIdentifier

这是库映像定义标识符。

名称 类型 说明
offer

string

库映像定义产品/服务的名称。

publisher

string

库映像定义发布者的名称。

sku

string

库映像定义 SKU 的名称。

GalleryProvisioningState

预配状态,仅出现在响应中。

说明
Creating
Updating
Failed
Succeeded
Deleting
Migrating

HyperVGeneration

虚拟机的虚拟机监控程序生成。 仅适用于 OS 磁盘。

说明
V1
V2

ImagePurchasePlan

描述库映像定义购买计划。 市场映像使用此映像。

名称 类型 说明
name

string

计划 ID。

product

string

产品 ID。

publisher

string

发布者 ID。

InnerError

内部错误详细信息。

名称 类型 说明
errordetail

string

内部错误消息或异常转储。

exceptiontype

string

异常类型。

OperatingSystemStateTypes

此属性允许用户指定在此映像下创建的虚拟机是“通用化”还是“专用”。

说明
Generalized
Specialized

OperatingSystemTypes

此属性允许指定应用程序为其构建的 OS 支持的类型。 可能的值包括:Windows、Linux。

说明
Windows
Linux

RecommendedMachineConfiguration

这些属性描述此映像定义的推荐计算机配置。 这些属性是可更新的。

名称 类型 说明
memory

ResourceRange

描述资源范围。

vCPUs

ResourceRange

描述资源范围。

ResourceRange

描述资源范围。

名称 类型 说明
max

integer (int32)

资源的最大数目。

min

integer (int32)

资源的最小数目。

systemData

与创建和上次修改资源相关的元数据。

名称 类型 说明
createdAt

string (date-time)

资源创建时间戳(UTC)。

createdBy

string

创建资源的标识。

createdByType

createdByType

创建资源的标识的类型。

lastModifiedAt

string (date-time)

上次修改的资源时间戳(UTC)

lastModifiedBy

string

上次修改资源的标识。

lastModifiedByType

createdByType

上次修改资源的标识的类型。