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

Galleries - Create Or Update

创建或更新共享图像库。

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

URI 参数

名称 必需 类型 说明
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

资源所在的地理位置

identity

GalleryIdentity

库的标识(如果已配置)。

properties.description

string

此共享映像库资源的说明。 此属性可更新。

properties.identifier

GalleryIdentifier

描述库唯一名称。

properties.sharingProfile

SharingProfile

用于将库共享到订阅或租户的配置文件

properties.softDeletePolicy

SoftDeletePolicy

包含有关库的软删除策略的信息。

tags

object

资源标记。

响应

名称 类型 说明
200 OK

Gallery

资源“库”更新作成功

201 Created

Gallery

资源“库”创建作成功

标头

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

Gallery

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

标头

  • 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 模拟用户帐户

示例

Create a community gallery.
Create or update a simple gallery with sharing profile.
Create or update a simple gallery with soft deletion enabled.
Create or update a simple gallery with system-assigned and user-assigned managed identities.
Create or update a simple gallery.

Create a community gallery.

示例请求

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

{
  "location": "West US",
  "properties": {
    "description": "This is the gallery description.",
    "sharingProfile": {
      "permissions": "Community",
      "communityGalleryInfo": {
        "publisherUri": "uri",
        "publisherContact": "pir@microsoft.com",
        "eula": "eula",
        "publicNamePrefix": "PirPublic"
      }
    }
  }
}

示例响应

{
  "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName",
  "properties": {
    "description": "This is the gallery description.",
    "identifier": {
      "uniqueName": "{subscription-id}-MYGALLERYNAME"
    },
    "provisioningState": "Updating",
    "sharingProfile": {
      "permissions": "Community",
      "communityGalleryInfo": {
        "publisherUri": "uri",
        "publisherContact": "pir@microsoft.com",
        "eula": "eula",
        "publicNamePrefix": "PirPublic"
      }
    }
  },
  "location": "West US",
  "name": "myGalleryName"
}
{
  "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName",
  "properties": {
    "description": "This is the gallery description.",
    "identifier": {
      "uniqueName": "{subscription-id}-MYGALLERYNAME"
    },
    "provisioningState": "Creating",
    "sharingProfile": {
      "permissions": "Community",
      "communityGalleryInfo": {
        "publisherUri": "uri",
        "publisherContact": "pir@microsoft.com",
        "eula": "eula",
        "publicNamePrefix": "PirPublic"
      }
    }
  },
  "location": "West US",
  "name": "myGalleryName"
}
{
  "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName",
  "properties": {
    "description": "This is the gallery description.",
    "identifier": {
      "uniqueName": "{subscription-id}-MYGALLERYNAME"
    },
    "provisioningState": "Updating",
    "sharingProfile": {
      "permissions": "Community",
      "communityGalleryInfo": {
        "publisherUri": "uri",
        "publisherContact": "pir@microsoft.com",
        "eula": "eula",
        "publicNamePrefix": "PirPublic"
      }
    }
  },
  "location": "West US",
  "name": "myGalleryName"
}

示例请求

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

{
  "location": "West US",
  "properties": {
    "description": "This is the gallery description.",
    "sharingProfile": {
      "permissions": "Groups"
    }
  }
}

示例响应

{
  "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName",
  "properties": {
    "description": "This is the gallery description.",
    "identifier": {
      "uniqueName": "{subscription-id}-MYGALLERYNAME"
    },
    "provisioningState": "Updating",
    "sharingProfile": {
      "permissions": "Groups"
    }
  },
  "location": "West US",
  "name": "myGalleryName"
}
{
  "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName",
  "properties": {
    "description": "This is the gallery description.",
    "identifier": {
      "uniqueName": "{subscription-id}-MYGALLERYNAME"
    },
    "provisioningState": "Creating",
    "sharingProfile": {
      "permissions": "Groups"
    }
  },
  "location": "West US",
  "name": "myGalleryName"
}
{
  "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName",
  "properties": {
    "description": "This is the gallery description.",
    "identifier": {
      "uniqueName": "{subscription-id}-MYGALLERYNAME"
    },
    "provisioningState": "Updating",
    "sharingProfile": {
      "permissions": "Groups"
    }
  },
  "location": "West US",
  "name": "myGalleryName"
}

示例请求

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

{
  "location": "West US",
  "properties": {
    "description": "This is the gallery description.",
    "softDeletePolicy": {
      "isSoftDeleteEnabled": true
    }
  }
}

示例响应

{
  "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName",
  "properties": {
    "description": "This is the gallery description.",
    "identifier": {
      "uniqueName": "{subscription-id}-MYGALLERYNAME"
    },
    "provisioningState": "Updating",
    "softDeletePolicy": {
      "isSoftDeleteEnabled": true
    }
  },
  "location": "West US",
  "name": "myGalleryName"
}
{
  "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName",
  "properties": {
    "description": "This is the gallery description.",
    "identifier": {
      "uniqueName": "{subscription-id}-MYGALLERYNAME"
    },
    "provisioningState": "Creating",
    "softDeletePolicy": {
      "isSoftDeleteEnabled": true
    }
  },
  "location": "West US",
  "name": "myGalleryName"
}
{
  "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName",
  "properties": {
    "description": "This is the gallery description.",
    "identifier": {
      "uniqueName": "{subscription-id}-MYGALLERYNAME"
    },
    "provisioningState": "Updating",
    "softDeletePolicy": {
      "isSoftDeleteEnabled": true
    }
  },
  "location": "West US",
  "name": "myGalleryName"
}

示例请求

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

{
  "location": "West US",
  "identity": {
    "type": "SystemAssigned, UserAssigned",
    "userAssignedIdentities": {
      "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity": {}
    }
  },
  "properties": {
    "description": "This is the gallery description."
  }
}

示例响应

{
  "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName",
  "identity": {
    "type": "SystemAssigned, UserAssigned",
    "principalId": "00000000-0000-0000-0000-000000000000",
    "tenantId": "00000000-0000-0000-0000-000000000000",
    "userAssignedIdentities": {
      "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity": {}
    }
  },
  "properties": {
    "description": "This is the gallery description.",
    "identifier": {
      "uniqueName": "{subscription-id}-MYGALLERYNAME"
    },
    "provisioningState": "Updating"
  },
  "location": "West US",
  "name": "myGalleryName"
}
{
  "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName",
  "identity": {
    "type": "SystemAssigned, UserAssigned",
    "principalId": "00000000-0000-0000-0000-000000000000",
    "tenantId": "00000000-0000-0000-0000-000000000000",
    "userAssignedIdentities": {
      "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity": {}
    }
  },
  "properties": {
    "description": "This is the gallery description.",
    "identifier": {
      "uniqueName": "{subscription-id}-MYGALLERYNAME"
    },
    "provisioningState": "Creating",
    "softDeletePolicy": {
      "isSoftDeleteEnabled": true
    }
  },
  "location": "West US",
  "name": "myGalleryName"
}
{
  "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName",
  "identity": {
    "type": "SystemAssigned, UserAssigned",
    "principalId": "00000000-0000-0000-0000-000000000000",
    "tenantId": "00000000-0000-0000-0000-000000000000",
    "userAssignedIdentities": {
      "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity": {}
    }
  },
  "properties": {
    "description": "This is the gallery description.",
    "identifier": {
      "uniqueName": "{subscription-id}-MYGALLERYNAME"
    },
    "provisioningState": "Updating",
    "softDeletePolicy": {
      "isSoftDeleteEnabled": true
    }
  },
  "location": "West US",
  "name": "myGalleryName"
}

Create or update a simple gallery.

示例请求

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

{
  "location": "West US",
  "properties": {
    "description": "This is the gallery description."
  }
}

示例响应

{
  "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGallery",
  "properties": {
    "description": "This is the gallery description.",
    "identifier": {
      "uniqueName": "{subscription-id}-MYGALLERYNAME"
    },
    "provisioningState": "Updating"
  },
  "location": "West US",
  "name": "myGalleryName"
}
{
  "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGallery",
  "properties": {
    "description": "This is the gallery description.",
    "identifier": {
      "uniqueName": "{subscription-id}-MYGALLERYNAME"
    },
    "provisioningState": "Creating"
  },
  "location": "West US",
  "name": "myGalleryName"
}
{
  "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGallery",
  "properties": {
    "description": "This is the gallery description.",
    "identifier": {
      "uniqueName": "{subscription-id}-MYGALLERYNAME"
    },
    "provisioningState": "Updating"
  },
  "location": "West US",
  "name": "myGalleryName"
}

定义

名称 说明
ApiError

API 错误。

ApiErrorBase

Api 错误库。

CloudError

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

CommunityGalleryInfo

如果将当前图库共享到社区,则社区图库的信息

createdByType

创建资源的标识的类型。

Gallery

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

GalleryIdentifier

描述库唯一名称。

GalleryIdentity

虚拟机的标识。

GalleryProvisioningState

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

GallerySharingPermissionTypes

此属性允许指定共享库的权限。 可能的值包括:Private、GroupsCommunity。

InnerError

内部错误详细信息。

RegionalSharingStatus

图库区域共享状态

ResourceIdentityType

用于库的标识类型。 类型“SystemAssigned,UserAssigned”包括隐式创建的标识和一组用户分配的标识。 类型“None”将从库中删除所有标识。

SharingProfile

用于将库共享到订阅或租户的配置文件

SharingProfileGroup

图库共享个人资料的组

SharingProfileGroupTypes

此属性允许您指定共享组的类型。 可能的值为: Subscriptions、AADTenants。

SharingState

库的共享状态,仅显示在响应中。

SharingStatus

当前图库的共享状态。

SoftDeletePolicy

包含有关库的软删除策略的信息。

systemData

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

UserAssignedIdentitiesValue

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 错误。

CommunityGalleryInfo

如果将当前图库共享到社区,则社区图库的信息

名称 类型 说明
communityGalleryEnabled

boolean

包含有关是否启用社区库共享的信息。

eula

string

社区库映像的最终用户许可协议。

publicNamePrefix

string

将公开显示的库名称的前缀。 对所有用户可见。

publicNames

string[]

社区库公共名称列表。

publisherContact

string

社区库发布者支持电子邮件。 发布者的电子邮件地址。 对所有用户可见。

publisherUri

string

指向发布者网站的链接。 对所有用户可见。

createdByType

创建资源的标识的类型。

说明
User
Application
ManagedIdentity
Key

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

名称 类型 说明
id

string

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

identity

GalleryIdentity

库的标识(如果已配置)。

location

string

资源所在的地理位置

name

string

资源的名称

properties.description

string

此共享映像库资源的说明。 此属性可更新。

properties.identifier

GalleryIdentifier

描述库唯一名称。

properties.provisioningState

GalleryProvisioningState

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

properties.sharingProfile

SharingProfile

用于将库共享到订阅或租户的配置文件

properties.sharingStatus

SharingStatus

当前图库的共享状态。

properties.softDeletePolicy

SoftDeletePolicy

包含有关库的软删除策略的信息。

systemData

systemData

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

tags

object

资源标记。

type

string

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

GalleryIdentifier

描述库唯一名称。

名称 类型 说明
uniqueName

string

共享映像库的唯一名称。 此名称由 Azure 自动生成。

GalleryIdentity

虚拟机的标识。

名称 类型 说明
principalId

string

库标识的主体 ID。 此属性仅针对系统分配的标识提供。

tenantId

string

库标识的 AAD 租户 ID。 此属性仅针对系统分配的标识提供。

type

ResourceIdentityType

用于库的标识类型。 类型“SystemAssigned,UserAssigned”包括隐式创建的标识和一组用户分配的标识。 类型“None”将从库中删除所有标识。

userAssignedIdentities

<string,  UserAssignedIdentitiesValue>

与库关联的用户标识列表。 用户标识字典密钥引用的格式为 ARM 资源 ID:“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}”。

GalleryProvisioningState

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

说明
Creating
Updating
Failed
Succeeded
Deleting
Migrating

GallerySharingPermissionTypes

此属性允许指定共享库的权限。 可能的值包括:Private、GroupsCommunity。

说明
Private
Groups
Community

InnerError

内部错误详细信息。

名称 类型 说明
errordetail

string

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

exceptiontype

string

异常类型。

RegionalSharingStatus

图库区域共享状态

名称 类型 说明
details

string

图库区域共享失败的详细信息。

region

string

区域名称

state

SharingState

当前区域中的库共享状态

ResourceIdentityType

用于库的标识类型。 类型“SystemAssigned,UserAssigned”包括隐式创建的标识和一组用户分配的标识。 类型“None”将从库中删除所有标识。

说明
SystemAssigned
UserAssigned
SystemAssigned, UserAssigned
None

SharingProfile

用于将库共享到订阅或租户的配置文件

名称 类型 说明
communityGalleryInfo

CommunityGalleryInfo

如果当前库共享到社区,则社区库的信息。

groups

SharingProfileGroup[]

共享配置文件组的列表。

permissions

GallerySharingPermissionTypes

此属性允许指定共享库的权限。 可能的值包括:Private、GroupsCommunity。

SharingProfileGroup

图库共享个人资料的组

名称 类型 说明
ids

string[]

库要共享到的订阅/租户 ID 列表。

type

SharingProfileGroupTypes

此属性允许您指定共享组的类型。 可能的值为: Subscriptions、AADTenants。

SharingProfileGroupTypes

此属性允许您指定共享组的类型。 可能的值为: Subscriptions、AADTenants。

说明
Subscriptions
AADTenants

SharingState

库的共享状态,仅显示在响应中。

说明
Succeeded
InProgress
Failed
Unknown

SharingStatus

当前图库的共享状态。

名称 类型 说明
aggregatedState

SharingState

当前库的聚合共享状态。

summary

RegionalSharingStatus[]

所有区域共享状况摘要。

SoftDeletePolicy

包含有关库的软删除策略的信息。

名称 类型 说明
isSoftDeleteEnabled

boolean

为此库中的资源启用软删除,允许在保留期内恢复这些资源。

systemData

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

名称 类型 说明
createdAt

string (date-time)

资源创建时间戳(UTC)。

createdBy

string

创建资源的标识。

createdByType

createdByType

创建资源的标识的类型。

lastModifiedAt

string (date-time)

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

lastModifiedBy

string

上次修改资源的标识。

lastModifiedByType

createdByType

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

UserAssignedIdentitiesValue

名称 类型 说明
clientId

string

用户分配标识的客户端 ID。

principalId

string

用户分配标识的主体 ID。