你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
- Latest
- 2025-10-01-预览
- 2025-07-01-preview
- 2025-04-01-preview
- 2025-02-01
- 2024-10-01-preview
- 2024-08-01-preview
- 2024-07-01-preview
- 2024-06-01-preview
- 2024-05-01-preview
- 2024-02-01
- 2023-10-01-preview
- 2023-08-01-preview
- 2023-04-01
- 2023-01-01-preview
- 2022-11-11-preview
- 2022-10-12-preview
- 2022-09-01-preview
- 2022-08-01-preview
Bicep 资源定义
可以使用目标操作部署开发中心/库资源类型:
有关每个 API 版本中已更改属性的列表,请参阅 更改日志。
资源格式
若要创建 Microsoft.DevCenter/devcenters/galleries 资源,请将以下 Bicep 添加到模板。
resource symbolicname 'Microsoft.DevCenter/devcenters/galleries@2025-10-01-preview' = {
parent: resourceSymbolicName
name: 'string'
properties: {
galleryResourceId: 'string'
}
}
属性值
Microsoft.DevCenter/devcenters/galleries
| Name | Description | Value |
|---|---|---|
| name | 资源名称 | string Constraints: 最小长度 = 3 最大长度 = 63 模式 = ^[a-zA-Z0-9][a-zA-Z0-9-_.]{2,62}$ (必需) |
| 父级 | 在 Bicep 中,可以为子资源指定父资源。 仅当子资源在父资源外部声明时,才需要添加此属性。 有关详细信息,请参阅 父资源外部的子资源。 |
类型资源的符号名称:开发中心 |
| properties | 库属性。 | GalleryProperties |
GalleryProperties
| Name | Description | Value |
|---|---|---|
| galleryResourceId | 支持 Azure 计算库的资源 ID。 | string (必需) |
用法示例
Azure 快速入门示例
以下 Azure 快速入门模板 包含用于部署此资源类型的 Bicep 示例。
| Bicep 文件 | Description |
|---|---|
| 配置 Dev Box 服务 | 此模板将按照 Dev Box 快速入门指南(/azure/dev-box/quickstart-create-dev-box)创建所有 Dev Box 管理员资源。 可以查看创建的所有资源,也可以直接转到 DevPortal.microsoft.com 创建第一个 Dev Box。 |
ARM 模板资源定义
可以使用目标操作部署开发中心/库资源类型:
有关每个 API 版本中已更改属性的列表,请参阅 更改日志。
资源格式
若要创建 Microsoft.DevCenter/devcenters/galleries 资源,请将以下 JSON 添加到模板。
{
"type": "Microsoft.DevCenter/devcenters/galleries",
"apiVersion": "2025-10-01-preview",
"name": "string",
"properties": {
"galleryResourceId": "string"
}
}
属性值
Microsoft.DevCenter/devcenters/galleries
| Name | Description | Value |
|---|---|---|
| apiVersion | API 版本 | “2025-10-01-预览” |
| name | 资源名称 | string Constraints: 最小长度 = 3 最大长度 = 63 模式 = ^[a-zA-Z0-9][a-zA-Z0-9-_.]{2,62}$ (必需) |
| properties | 库属性。 | GalleryProperties |
| 类型 | 资源类型 | 'Microsoft.DevCenter/devcenters/galleries' |
GalleryProperties
| Name | Description | Value |
|---|---|---|
| galleryResourceId | 支持 Azure 计算库的资源 ID。 | string (必需) |
用法示例
Azure 快速入门模板
以下 Azure 快速入门模板 部署此资源类型。
| Template | Description |
|---|---|
|
配置 Dev Box 服务 |
此模板将按照 Dev Box 快速入门指南(/azure/dev-box/quickstart-create-dev-box)创建所有 Dev Box 管理员资源。 可以查看创建的所有资源,也可以直接转到 DevPortal.microsoft.com 创建第一个 Dev Box。 |
Terraform (AzAPI 提供程序)资源定义
可以使用目标操作部署开发中心/库资源类型:
有关每个 API 版本中已更改属性的列表,请参阅 更改日志。
资源格式
若要创建 Microsoft.DevCenter/devcenters/galleries 资源,请将以下 Terraform 添加到模板。
resource "azapi_resource" "symbolicname" {
type = "Microsoft.DevCenter/devcenters/galleries@2025-10-01-preview"
name = "string"
parent_id = "string"
body = {
properties = {
galleryResourceId = "string"
}
}
}
属性值
Microsoft.DevCenter/devcenters/galleries
| Name | Description | Value |
|---|---|---|
| name | 资源名称 | string Constraints: 最小长度 = 3 最大长度 = 63 模式 = ^[a-zA-Z0-9][a-zA-Z0-9-_.]{2,62}$ (必需) |
| parent_id | 此资源的父资源的 ID。 | 类型资源的 ID:开发中心 |
| properties | 库属性。 | GalleryProperties |
| 类型 | 资源类型 | “Microsoft.DevCenter/devcenters/galleries@2025-10-01-preview” |
GalleryProperties
| Name | Description | Value |
|---|---|---|
| galleryResourceId | 支持 Azure 计算库的资源 ID。 | string (必需) |
用法示例
Terraform 示例
部署开发人员中心库的基本示例。
terraform {
required_providers {
azapi = {
source = "Azure/azapi"
}
}
}
provider "azapi" {
skip_provider_registration = false
}
data "azapi_client_config" "current" {}
variable "resource_name" {
type = string
default = "acctest0001"
}
variable "location" {
type = string
default = "westus"
}
resource "azapi_resource" "resourceGroup" {
type = "Microsoft.Resources/resourceGroups@2020-06-01"
name = var.resource_name
location = var.location
}
resource "azapi_resource" "gallery" {
type = "Microsoft.Compute/galleries@2022-03-03"
parent_id = azapi_resource.resourceGroup.id
name = "${var.resource_name}sig"
location = var.location
body = {
properties = {
description = ""
}
}
}
resource "azapi_resource" "userAssignedIdentity" {
type = "Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31"
parent_id = azapi_resource.resourceGroup.id
name = "${var.resource_name}uai"
location = var.location
}
resource "azapi_resource" "devCenter" {
type = "Microsoft.DevCenter/devCenters@2025-02-01"
parent_id = azapi_resource.resourceGroup.id
name = "${var.resource_name}dc"
location = var.location
identity {
type = "UserAssigned"
identity_ids = [azapi_resource.userAssignedIdentity.id]
}
body = {
properties = {}
}
}
# Assign Reader role on the gallery to the Dev Center's user-assigned identity
locals {
reader_role_id = "acdd72a7-3385-48ef-bd42-f606fba81ae7"
}
resource "azapi_resource" "roleAssignment" {
type = "Microsoft.Authorization/roleAssignments@2022-04-01"
name = uuidv5("url", "${azapi_resource.gallery.id}/roleAssignments/${azapi_resource.userAssignedIdentity.output.properties.principalId}")
parent_id = azapi_resource.gallery.id
body = {
properties = {
roleDefinitionId = "/subscriptions/${data.azapi_client_config.current.subscription_id}/providers/Microsoft.Authorization/roleDefinitions/${local.reader_role_id}"
principalId = azapi_resource.userAssignedIdentity.output.properties.principalId
principalType = "ServicePrincipal"
}
}
depends_on = [azapi_resource.userAssignedIdentity, azapi_resource.gallery]
}
resource "azapi_resource" "gallery_1" {
type = "Microsoft.DevCenter/devCenters/galleries@2025-02-01"
parent_id = azapi_resource.devCenter.id
name = "${var.resource_name}dcg"
body = {
properties = {
galleryResourceId = azapi_resource.gallery.id
}
}
depends_on = [azapi_resource.roleAssignment]
}