共用方式為


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 參數

名稱 位於 必要 類型 Description
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

目標訂用帳戶的標識碼。

api-version
query True

string

minLength: 1

用於此作業的 API 版本。

要求本文

名稱 必要 類型 Description
properties.publishingProfile True

GalleryScriptVersionPublishingProfile

資源庫映像版本的發行配置檔。

properties.safetyProfile

GalleryScriptVersionSafetyProfile

畫廊腳本版本的安全規格。

tags

object

資源標籤

回應

名稱 類型 Description
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
Flow: implicit
授權 URL: https://login.microsoftonline.com/common/oauth2/authorize

範圍

名稱 Description
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

定義

名稱 Description
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

描述其他副本集資訊。

名稱 類型 Description
regionalReplicaCount

integer (int32)

要建立之映像版本的直接磁碟驅動器複本數目。此屬性是可更新的

storageAccountType

StorageAccountType

指定要用來建立直接磁碟驅動器複本的記憶體帳戶類型

AggregatedReplicationState

這是根據所有區域復寫狀態旗標的匯總複寫狀態。

Description
Unknown
InProgress
Completed
Failed

ApiError

Api 錯誤。

名稱 類型 Description
code

string

錯誤碼。

details

ApiErrorBase[]

Api 錯誤詳細數據

innererror

InnerError

Api 內部錯誤

message

string

錯誤訊息。

target

string

特定錯誤的目標。

ApiErrorBase

API 錯誤基底。

名稱 類型 Description
code

string

錯誤碼。

message

string

錯誤訊息。

target

string

特定錯誤的目標。

CloudError

來自計算服務的錯誤回應。

名稱 類型 Description
error

ApiError

Api 錯誤。

ConfidentialVMEncryptionType

機密 VM 加密類型

Description
EncryptedVMGuestStateOnlyWithPmk
EncryptedWithPmk
EncryptedWithCmk
NonPersistedTPM

createdByType

建立資源的身分識別類型。

Description
User
Application
ManagedIdentity
Key

DataDiskImageEncryption

包含數據磁碟映像的加密設定。

名稱 類型 Description
diskEncryptionSetId

string

包含磁碟加密集資源標識碼的相對URI。

lun

integer (int32)

這個屬性會指定數據磁碟的邏輯單位編號。 此值是用來識別虛擬機內的數據磁碟,因此對於連結至虛擬機的每個數據磁碟而言都必須是唯一的。

EdgeZoneStorageAccountType

指定要用來儲存映像的記憶體帳戶類型。 這個屬性無法更新。

Description
Standard_LRS
Standard_ZRS
StandardSSD_LRS
Premium_LRS

EncryptionImages

選擇性。 允許使用者提供客戶管理的金鑰,以加密資源庫成品中的 OS 和數據磁碟。

名稱 類型 Description
dataDiskImages

DataDiskImageEncryption[]

數據磁碟映像的加密規格清單。

osDiskImage

OSDiskImageEncryption

包含 OS 磁碟映像的加密設定。

GalleryExtendedLocation

擴充位置的名稱。

名稱 類型 Description
name

string

type

GalleryExtendedLocationType

它是擴充位置的類型。

GalleryExtendedLocationType

它是擴充位置的類型。

Description
EdgeZone
Unknown

GalleryProvisioningState

只出現在回應中的布建狀態。

Description
Creating
Updating
Failed
Succeeded
Deleting
Migrating

GalleryScriptParameter

定義一個參數,可傳遞給畫廊腳本版本的腳本。

名稱 類型 Description
defaultValue

string

參數的預設值只適用於字串類型。

description

string

說明,可協助使用者瞭解此參數的意義

enumValues

string[]

一份允許的數值清單。 只有適用的值來自「GalleryScriptParameter」中定義的「enum」值。

maxValue

string

參數的最小值。

minValue

string

參數的最小值。

name

string

參數的名稱。

required

boolean

表示是否必須傳遞此參數。

type

GalleryScriptParameterType

指定 Gallery Script 參數的類型。 可能的值包括:字串、整數、雙重、布林值、枚舉

GalleryScriptParameterType

指定 Gallery Script 參數的類型。 可能的值包括:字串、整數、雙重、布林值、枚舉

Description
String

字串畫廊腳本參數類型

Int

整數畫廊腳本參數類型

Double

雙重畫廊腳本參數類型

Boolean

布林畫廊腳本參數類型

Enum

Enum gallery 腳本參數類型

GalleryScriptVersion

您可以使用特定屬性類型來建立具象追蹤的資源類型。

名稱 類型 Description
id

string

資源的完整資源標識碼。 例如 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

location

string

資源所在的地理位置

name

string

資源的名稱

properties

GalleryScriptVersionProperties

描述圖庫腳本版本的特性。

systemData

systemData

包含 createdBy 和 modifiedBy 資訊的 Azure Resource Manager 中繼資料。

tags

object

資源標籤。

type

string

資源的類型。 例如「Microsoft.Compute/virtualMachines」或「Microsoft.Storage/storageAccounts」

GalleryScriptVersionProperties

描述畫廊劇本版本的特性。

名稱 類型 Description
provisioningState

GalleryProvisioningState

只出現在回應中的布建狀態。

publishingProfile

GalleryScriptVersionPublishingProfile

資源庫映像版本的發行配置檔。

replicationStatus

ReplicationStatus

這是資源庫映像版本的復寫狀態。

safetyProfile

GalleryScriptVersionSafetyProfile

畫廊腳本版本的安全規格。

GalleryScriptVersionPublishingProfile

資源庫映像版本的發行配置檔。

名稱 類型 Description
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

畫廊腳本版本的安全規格。

名稱 類型 Description
allowDeletionOfReplicatedLocations

boolean

指出是否允許從復寫區域移除此資源庫映像版本。

GalleryScriptVersionUpdate

指定你想更新的圖庫腳本版本資訊。

名稱 類型 Description
id

string

資源標識碼

name

string

資源名稱

properties.provisioningState

GalleryProvisioningState

只出現在回應中的布建狀態。

properties.publishingProfile

GalleryScriptVersionPublishingProfile

資源庫映像版本的發行配置檔。

properties.replicationStatus

ReplicationStatus

這是資源庫映像版本的復寫狀態。

properties.safetyProfile

GalleryScriptVersionSafetyProfile

畫廊腳本版本的安全規格。

tags

object

資源標籤

type

string

資源類型

GalleryTargetExtendedLocation

名稱 類型 Description
encryption

EncryptionImages

選擇性。 允許使用者提供客戶管理的金鑰,以加密資源庫成品中的 OS 和數據磁碟。

extendedLocation

GalleryExtendedLocation

擴充位置的名稱。

extendedLocationReplicaCount

integer (int32)

每個擴充位置要建立之映像版本的複本數目。 這個屬性是可更新的。

name

string

區域的名稱。

storageAccountType

EdgeZoneStorageAccountType

指定要用來儲存映像的記憶體帳戶類型。 這個屬性無法更新。

InnerError

內部錯誤詳細數據。

名稱 類型 Description
errordetail

string

內部錯誤訊息或例外狀況傾印。

exceptiontype

string

例外狀況類型。

OSDiskImageEncryption

包含 OS 磁碟映像的加密設定。

名稱 類型 Description
diskEncryptionSetId

string

包含磁碟加密集資源標識碼的相對URI。

securityProfile

OSDiskImageSecurityProfile

此屬性會指定 OS 磁碟映像的安全性設定檔。

OSDiskImageSecurityProfile

包含 OS 磁碟映像的安全性設定檔。

名稱 類型 Description
confidentialVMEncryptionType

ConfidentialVMEncryptionType

機密 VM 加密類型

secureVMDiskEncryptionSetId

string

安全的 VM 磁碟加密集標識符

RegionalReplicationStatus

這是區域復寫狀態。

名稱 類型 Description
details

string

復寫狀態的詳細數據。

progress

integer (int32)

指出複寫作業的進度。

region

string

正在復寫資源庫映像版本的區域。

state

ReplicationState

這是區域復寫狀態。

ReplicationMode

選擇性參數,指定要用於複寫的模式。 這個屬性無法更新。

Description
Full
Shallow

ReplicationState

這是區域復寫狀態。

Description
Unknown
Replicating
Completed
Failed

ReplicationStatus

這是資源庫映像版本的復寫狀態。

名稱 類型 Description
aggregatedState

AggregatedReplicationState

這是根據所有區域復寫狀態旗標的匯總複寫狀態。

summary

RegionalReplicationStatus[]

這是每個區域的復寫狀態摘要。

ScriptSource

就是用來建立腳本版本的原始腳本。

名稱 類型 Description
parameters

GalleryScriptParameter[]

選擇性。 任何需要傳遞給腳本的輸入參數,並在腳本內被存取以執行。

scriptLink

string

必須的。 原始腳本的連結必須是可讀的儲存區塊,且啟用 SAS URI,或啟用公開可存取的 URI 或受管理身份。

StorageAccountStrategy

指定選擇儲存帳戶類型時應採用的策略。 無法與 storageAccountType 一起指定,但可依區域設定 targetRegions[].storageAccountType 來覆蓋。 這個屬性無法更新。

Description
PreferStandard_ZRS

如果區域支援,請選擇Standard_ZRS儲存,否則選擇Standard_LRS儲存,除非指定區域儲存帳戶類型(regional storageAccountType)覆蓋。 若未指定 storageAccountStrategy,則預設策略為此(自 API 版本 2025-03-03 起)。

DefaultStandard_LRS

選擇Standard_LRS儲存,除非被指定區域儲存帳戶類型覆蓋。

StorageAccountType

指定要用來儲存映像的記憶體帳戶類型。 這個屬性無法更新。

Description
Standard_LRS
Standard_ZRS
Premium_LRS
PremiumV2_LRS

systemData

與建立和上次修改資源相關的元數據。

名稱 類型 Description
createdAt

string (date-time)

資源建立的時間戳(UTC)。

createdBy

string

建立資源的身分識別。

createdByType

createdByType

建立資源的身分識別類型。

lastModifiedAt

string (date-time)

上次修改的資源時間戳 (UTC)

lastModifiedBy

string

上次修改資源的身分識別。

lastModifiedByType

createdByType

上次修改資源的身分識別類型。

TargetRegion

描述目標區域資訊。

名稱 類型 Description
additionalReplicaSets

AdditionalReplicaSet[]

具有復本計數來建立直接磁碟驅動器複本的記憶體 SKU 清單。

encryption

EncryptionImages

選擇性。 允許使用者提供客戶管理的金鑰,以加密資源庫成品中的 OS 和數據磁碟。

excludeFromLatest

boolean

包含當使用者指定 version='latest' 時隱藏映射的旗標設定

name

string

區域的名稱。

regionalReplicaCount

integer (int32)

要為每個區域建立之映像版本的複本數目。 這個屬性是可更新的。

storageAccountType

StorageAccountType

指定要用來儲存映像的記憶體帳戶類型。 這個屬性無法更新。