通过


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

Gallery Script Versions - Update

更新图库脚本版本。

PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/scripts/{galleryScriptName}/versions/{galleryScriptVersionName}?api-version=2025-03-03

URI 参数

名称 必需 类型 说明
galleryName
path True

string

pattern: ^[^_\W][\w-._]{0,79}(?

共享映像库的名称。

galleryScriptName
path True

string

pattern: ^[a-zA-Z0-9]+([_]?[a-zA-Z0-9]+)*$

画廊名称 脚本定义 待检索。

galleryScriptVersionName
path True

string

pattern: ^[0-9]+\.[0-9]+\.[0-9]+$

画廊名称 剧本版本待检索。

resourceGroupName
path True

string

minLength: 1
maxLength: 90

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

subscriptionId
path True

string

minLength: 1

目标订阅的 ID。

api-version
query True

string

minLength: 1

要用于此操作的 API 版本。

请求正文

名称 必需 类型 说明
properties.publishingProfile True

GalleryScriptVersionPublishingProfile

库映像版本的发布配置文件。

properties.safetyProfile

GalleryScriptVersionSafetyProfile

图库脚本版本的安全规格。

tags

object

资源标记

响应

名称 类型 说明
200 OK

GalleryScriptVersion

Azure作已成功完成。

202 Accepted

接受资源更新请求。

标头

  • Azure-AsyncOperation: string
  • 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 模拟用户帐户

示例

示例请求

PATCH https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroupName/providers/Microsoft.Compute/galleries/myGalleryName/scripts/myGalleryScriptName/versions/1.0.0?api-version=2025-03-03

{
  "properties": {
    "publishingProfile": {
      "source": {
        "scriptLink": "https://mystorageaccount.blob.core.windows.net/mycontainer/myScript.ps1?{sasKey}",
        "parameters": [
          {
            "name": "location",
            "required": true,
            "defaultValue": "westus",
            "type": "String"
          },
          {
            "name": "myGalleryScriptParameter1",
            "required": true,
            "type": "String",
            "defaultValue": "default value of parameter",
            "description": "description of the parameter"
          },
          {
            "name": "myGalleryScriptParameter2",
            "required": false,
            "type": "String",
            "defaultValue": "default value of parameter",
            "description": "description of the parameter"
          },
          {
            "name": "numberOfUnits",
            "required": true,
            "type": "Int",
            "defaultValue": "3",
            "description": "description of the parameter",
            "minValue": "1",
            "maxValue": "5"
          },
          {
            "name": "weightOfUnit",
            "required": true,
            "type": "Double",
            "defaultValue": "0.6",
            "description": "description of the parameter",
            "minValue": "0.1",
            "maxValue": "2"
          },
          {
            "name": "typeOfProduct",
            "required": false,
            "type": "Enum",
            "defaultValue": "Fruit",
            "description": "description of the parameter",
            "enumValues": [
              "Fruit",
              "Vegetable",
              "Greens",
              "Nuts"
            ]
          }
        ]
      },
      "targetRegions": [
        {
          "name": "West US",
          "regionalReplicaCount": 2,
          "storageAccountType": "Standard_LRS",
          "excludeFromLatest": false
        }
      ],
      "replicaCount": 2,
      "endOfLifeDate": "2027-07-01T07:00:00Z",
      "storageAccountType": "Standard_LRS"
    },
    "safetyProfile": {
      "allowDeletionOfReplicatedLocations": false
    }
  }
}

示例响应

{
  "location": "West US",
  "name": "1.0.0",
  "type": "Microsoft.Compute/galleries/scripts/versions",
  "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroupName/providers/Microsoft.Compute/galleries/myGalleryName/scripts/myGalleryScriptName/versions/1.0.0",
  "properties": {
    "publishingProfile": {
      "source": {
        "scriptLink": "https://mystorageaccount.blob.core.windows.net/mycontainer/myScript.ps1",
        "parameters": [
          {
            "name": "location",
            "required": true,
            "defaultValue": "westus",
            "type": "String"
          },
          {
            "name": "myGalleryScriptParameter1",
            "required": true,
            "type": "String",
            "defaultValue": "default value of parameter",
            "description": "description of the parameter"
          },
          {
            "name": "myGalleryScriptParameter2",
            "required": false,
            "type": "String",
            "defaultValue": "default value of parameter",
            "description": "description of the parameter"
          },
          {
            "name": "numberOfUnits",
            "required": true,
            "type": "Int",
            "defaultValue": "3",
            "description": "description of the parameter",
            "minValue": "1",
            "maxValue": "5"
          },
          {
            "name": "weightOfUnit",
            "required": true,
            "type": "Double",
            "defaultValue": "0.6",
            "description": "description of the parameter",
            "minValue": "0.1",
            "maxValue": "2"
          },
          {
            "name": "typeOfProduct",
            "required": false,
            "type": "Enum",
            "defaultValue": "Fruit",
            "description": "description of the parameter",
            "enumValues": [
              "Fruit",
              "Vegetable",
              "Greens",
              "Nuts"
            ]
          }
        ]
      },
      "targetRegions": [
        {
          "name": "West US",
          "regionalReplicaCount": 2,
          "storageAccountType": "Standard_LRS",
          "excludeFromLatest": false
        }
      ],
      "replicaCount": 2,
      "excludeFromLatest": false,
      "publishedDate": "2025-06-21T17:13:57.5972568+00:00",
      "endOfLifeDate": "2027-07-01T07:00:00+00:00",
      "storageAccountType": "Standard_LRS"
    },
    "safetyProfile": {
      "allowDeletionOfReplicatedLocations": false
    },
    "provisioningState": "Updating"
  }
}
Azure-AsyncOperation: https://management.azure.com/subscriptions/000000-8de3-42e7-b00e-8970003527749a/providers/Microsoft.Compute/locations/eastus/capsOperations/0012b61c-2d36-40bc-b7ed-1f0e48757277?api-version=2025-03-03
Location: https://management.azure.com/subscriptions/000000-8de3-42e7-b00e-8970003527749a/providers/Microsoft.Compute/locations/eastus/capsOperations/0012b61c-2d36-40bc-b7ed-1f0e48757277?monitor=true&api-version=2025-03-03

定义

名称 说明
AdditionalReplicaSet

描述其他副本集信息。

AggregatedReplicationState

这是基于所有区域复制状态标志的聚合复制状态。

ApiError

API 错误。

ApiErrorBase

Api 错误库。

CloudError

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

ConfidentialVMEncryptionType

机密 VM 加密类型

createdByType

创建资源的标识的类型。

DataDiskImageEncryption

包含数据磁盘映像的加密设置。

EdgeZoneStorageAccountType

指定要用于存储映像的存储帐户类型。 此属性不可更新。

EncryptionImages

可选。 允许用户提供客户管理的密钥,用于加密库项目中的 OS 和数据磁盘。

GalleryExtendedLocation

扩展位置的名称。

GalleryExtendedLocationType

它是扩展位置的类型。

GalleryProvisioningState

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

GalleryScriptParameter

定义一个参数,可以传递给画廊脚本版本的脚本。

GalleryScriptParameterType

指定 Gallery Script 参数的类型。 可能的值有:字符串、整数、双重、布尔值、枚举

GalleryScriptVersion

具体跟踪的资源类型可以通过使用特定属性类型将此类型别名创建。

GalleryScriptVersionProperties

描述画廊脚本版本的属性。

GalleryScriptVersionPublishingProfile

库映像版本的发布配置文件。

GalleryScriptVersionSafetyProfile

图库脚本版本的安全规格。

GalleryScriptVersionUpdate

指定你想更新的图库脚本版本信息。

GalleryTargetExtendedLocation
InnerError

内部错误详细信息。

OSDiskImageEncryption

包含 OS 磁盘映像的加密设置。

OSDiskImageSecurityProfile

包含 OS 磁盘映像的安全配置文件。

RegionalReplicationStatus

这是区域复制状态。

ReplicationMode

可选参数,用于指定要用于复制的模式。 此属性不可更新。

ReplicationState

这是区域复制状态。

ReplicationStatus

这是库映像版本的复制状态。

ScriptSource

脚本版本将从源脚本中创建。

StorageAccountStrategy

指定选择存储账户类型时应采用的策略。 不能与 storageAccountType 一起指定,但可以通过指定 targetRegions[].storageAccountType 来覆盖每个区域。 此属性不可更新。

StorageAccountType

指定要用于存储映像的存储帐户类型。 此属性不可更新。

systemData

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

TargetRegion

描述目标区域信息。

AdditionalReplicaSet

描述其他副本集信息。

名称 类型 说明
regionalReplicaCount

integer (int32)

要创建的映像版本的直接驱动器副本数。此属性可更新

storageAccountType

StorageAccountType

指定要用于创建直接驱动器副本的存储帐户类型

AggregatedReplicationState

这是基于所有区域复制状态标志的聚合复制状态。

说明
Unknown
InProgress
Completed
Failed

ApiError

API 错误。

名称 类型 说明
code

string

错误代码。

details

ApiErrorBase[]

Api 错误详细信息

innererror

InnerError

Api 内部错误

message

string

错误消息。

target

string

特定错误的目标。

ApiErrorBase

Api 错误库。

名称 类型 说明
code

string

错误代码。

message

string

错误消息。

target

string

特定错误的目标。

CloudError

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

名称 类型 说明
error

ApiError

API 错误。

ConfidentialVMEncryptionType

机密 VM 加密类型

说明
EncryptedVMGuestStateOnlyWithPmk
EncryptedWithPmk
EncryptedWithCmk
NonPersistedTPM

createdByType

创建资源的标识的类型。

说明
User
Application
ManagedIdentity
Key

DataDiskImageEncryption

包含数据磁盘映像的加密设置。

名称 类型 说明
diskEncryptionSetId

string

包含磁盘加密集的资源 ID 的相对 URI。

lun

integer (int32)

此属性指定数据磁盘的逻辑单元号。 此值用于标识虚拟机中的数据磁盘,因此对于附加到虚拟机的每个数据磁盘必须是唯一的。

EdgeZoneStorageAccountType

指定要用于存储映像的存储帐户类型。 此属性不可更新。

说明
Standard_LRS
Standard_ZRS
StandardSSD_LRS
Premium_LRS

EncryptionImages

可选。 允许用户提供客户管理的密钥,用于加密库项目中的 OS 和数据磁盘。

名称 类型 说明
dataDiskImages

DataDiskImageEncryption[]

数据磁盘映像的加密规范列表。

osDiskImage

OSDiskImageEncryption

包含 OS 磁盘映像的加密设置。

GalleryExtendedLocation

扩展位置的名称。

名称 类型 说明
name

string

type

GalleryExtendedLocationType

它是扩展位置的类型。

GalleryExtendedLocationType

它是扩展位置的类型。

说明
EdgeZone
Unknown

GalleryProvisioningState

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

说明
Creating
Updating
Failed
Succeeded
Deleting
Migrating

GalleryScriptParameter

定义一个参数,可以传递给画廊脚本版本的脚本。

名称 类型 说明
defaultValue

string

参数的默认值只适用于字符串类型。

description

string

帮助用户了解此参数的含义的说明

enumValues

string[]

一份允许的数值清单。 只有适用的值来自“GalleryScriptParameter”中定义的“enum”值。

maxValue

string

参数的最小值。

minValue

string

参数的最小值。

name

string

参数的名称。

required

boolean

表示是否必须传递该参数。

type

GalleryScriptParameterType

指定 Gallery Script 参数的类型。 可能的值有:字符串、整数、双重、布尔值、枚举

GalleryScriptParameterType

指定 Gallery Script 参数的类型。 可能的值有:字符串、整数、双重、布尔值、枚举

说明
String

字符串画廊脚本参数类型

Int

整数画廊脚本参数类型

Double

双图库脚本参数类型

Boolean

布尔画廊脚本参数类型

Enum

枚库脚本参数类型

GalleryScriptVersion

具体跟踪的资源类型可以通过使用特定属性类型将此类型别名创建。

名称 类型 说明
id

string

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

location

string

资源所在的地理位置

name

string

资源的名称

properties

GalleryScriptVersionProperties

描述画廊脚本版本的属性。

systemData

systemData

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

tags

object

资源标记。

type

string

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

GalleryScriptVersionProperties

描述画廊脚本版本的属性。

名称 类型 说明
provisioningState

GalleryProvisioningState

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

publishingProfile

GalleryScriptVersionPublishingProfile

库映像版本的发布配置文件。

replicationStatus

ReplicationStatus

这是库映像版本的复制状态。

safetyProfile

GalleryScriptVersionSafetyProfile

图库脚本版本的安全规格。

GalleryScriptVersionPublishingProfile

库映像版本的发布配置文件。

名称 类型 说明
endOfLifeDate

string (date-time)

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

excludeFromLatest

boolean

如果设置为 true,则从最新版本的映像定义部署的虚拟机不会使用此映像版本。

publishedDate

string (date-time)

发布库映像版本的时间戳。

replicaCount

integer (int32)

要为每个区域创建的映像版本的副本数。 如果未指定 regionReplicaCount,此属性将对区域生效。 此属性可更新。

replicationMode

ReplicationMode

可选参数,用于指定要用于复制的模式。 此属性不可更新。

source

ScriptSource

脚本版本将从源脚本中创建。

storageAccountStrategy

StorageAccountStrategy

指定选择存储账户类型时应采用的策略。 不能与 storageAccountType 一起指定,但可以通过指定 targetRegions[].storageAccountType 来覆盖每个区域。 此属性不可更新。

storageAccountType

StorageAccountType

指定要用于存储映像的存储帐户类型。 无法与storageAccountStrategy一起指定。 此属性不可更新。

targetExtendedLocations

GalleryTargetExtendedLocation[]

要将映像版本复制到的目标扩展位置。 此属性可更新。

targetRegions

TargetRegion[]

要将映像版本复制到的目标区域。 此属性可更新。

GalleryScriptVersionSafetyProfile

图库脚本版本的安全规格。

名称 类型 说明
allowDeletionOfReplicatedLocations

boolean

指示是否允许从复制区域删除此库映像版本。

GalleryScriptVersionUpdate

指定你想更新的图库脚本版本信息。

名称 类型 说明
id

string

资源 ID

name

string

资源名称

properties.provisioningState

GalleryProvisioningState

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

properties.publishingProfile

GalleryScriptVersionPublishingProfile

库映像版本的发布配置文件。

properties.replicationStatus

ReplicationStatus

这是库映像版本的复制状态。

properties.safetyProfile

GalleryScriptVersionSafetyProfile

图库脚本版本的安全规格。

tags

object

资源标记

type

string

资源类型

GalleryTargetExtendedLocation

名称 类型 说明
encryption

EncryptionImages

可选。 允许用户提供客户管理的密钥,用于加密库项目中的 OS 和数据磁盘。

extendedLocation

GalleryExtendedLocation

扩展位置的名称。

extendedLocationReplicaCount

integer (int32)

要按扩展位置创建的映像版本的副本数。 此属性可更新。

name

string

区域的名称。

storageAccountType

EdgeZoneStorageAccountType

指定要用于存储映像的存储帐户类型。 此属性不可更新。

InnerError

内部错误详细信息。

名称 类型 说明
errordetail

string

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

exceptiontype

string

异常类型。

OSDiskImageEncryption

包含 OS 磁盘映像的加密设置。

名称 类型 说明
diskEncryptionSetId

string

包含磁盘加密集的资源 ID 的相对 URI。

securityProfile

OSDiskImageSecurityProfile

此属性指定 OS 磁盘映像的安全配置文件。

OSDiskImageSecurityProfile

包含 OS 磁盘映像的安全配置文件。

名称 类型 说明
confidentialVMEncryptionType

ConfidentialVMEncryptionType

机密 VM 加密类型

secureVMDiskEncryptionSetId

string

安全 VM 磁盘加密集 ID

RegionalReplicationStatus

这是区域复制状态。

名称 类型 说明
details

string

复制状态的详细信息。

progress

integer (int32)

它指示复制作业的进度。

region

string

要将库映像版本复制到的区域。

state

ReplicationState

这是区域复制状态。

ReplicationMode

可选参数,用于指定要用于复制的模式。 此属性不可更新。

说明
Full
Shallow

ReplicationState

这是区域复制状态。

说明
Unknown
Replicating
Completed
Failed

ReplicationStatus

这是库映像版本的复制状态。

名称 类型 说明
aggregatedState

AggregatedReplicationState

这是基于所有区域复制状态标志的聚合复制状态。

summary

RegionalReplicationStatus[]

这是每个区域的复制状态摘要。

ScriptSource

脚本版本将从源脚本中创建。

名称 类型 说明
parameters

GalleryScriptParameter[]

可选。 任何需要传递给脚本并在脚本内访问以执行的输入参数。

scriptLink

string

必填。 源脚本的链接必须是带有SAS URI或启用公开访问URI或管理身份的可读存储blob。

StorageAccountStrategy

指定选择存储账户类型时应采用的策略。 不能与 storageAccountType 一起指定,但可以通过指定 targetRegions[].storageAccountType 来覆盖每个区域。 此属性不可更新。

说明
PreferStandard_ZRS

如果区域支持,选择Standard_ZRS存储,否则选择Standard_LRS存储,除非指定区域storageAccountType覆盖。 如果没有指定storageAccountStrategy,则默认策略为(从API版本2025-03-03起)。

DefaultStandard_LRS

除非被指定区域storageAccountType覆盖,否则选择Standard_LRS存储。

StorageAccountType

指定要用于存储映像的存储帐户类型。 此属性不可更新。

说明
Standard_LRS
Standard_ZRS
Premium_LRS
PremiumV2_LRS

systemData

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

名称 类型 说明
createdAt

string (date-time)

资源创建时间戳(UTC)。

createdBy

string

创建资源的标识。

createdByType

createdByType

创建资源的标识的类型。

lastModifiedAt

string (date-time)

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

lastModifiedBy

string

上次修改资源的标识。

lastModifiedByType

createdByType

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

TargetRegion

描述目标区域信息。

名称 类型 说明
additionalReplicaSets

AdditionalReplicaSet[]

包含副本计数的存储 SKU 列表,用于创建直接驱动器副本。

encryption

EncryptionImages

可选。 允许用户提供客户管理的密钥,用于加密库项目中的 OS 和数据磁盘。

excludeFromLatest

boolean

包含当用户指定 version='latest' 时隐藏映像的标志设置

name

string

区域的名称。

regionalReplicaCount

integer (int32)

要为每个区域创建的映像版本的副本数。 此属性可更新。

storageAccountType

StorageAccountType

指定要用于存储映像的存储帐户类型。 此属性不可更新。