你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Bicep 资源定义
可以使用目标作部署帐户/项目资源类型:
有关每个 API 版本中已更改属性的列表,请参阅 更改日志。
资源格式
若要创建 Microsoft.CognitiveServices/accounts/projects 资源,请将以下 Bicep 添加到模板。
resource symbolicname 'Microsoft.CognitiveServices/accounts/projects@2025-10-01-preview' = {
parent: resourceSymbolicName
identity: {
type: 'string'
userAssignedIdentities: {
{customized property}: {}
}
}
location: 'string'
name: 'string'
properties: {
description: 'string'
displayName: 'string'
}
tags: {
{customized property}: 'string'
}
}
属性值
Microsoft.CognitiveServices/accounts/projects
| 名字 | 说明 | 价值 |
|---|---|---|
| 标识 | 资源的标识。 | 身份 |
| 位置 | 资源所在的地理位置 | 字符串 |
| 姓名 | 资源名称 | 字符串 约束: 最小长度 = 2 最大长度 = 64 模式 = ^[a-zA-Z0-9][a-zA-Z0-9_.-]*$ (必需) |
| 父级 | 在 Bicep 中,可以为子资源指定父资源。 仅当子资源在父资源外部声明时,才需要添加此属性。 有关详细信息,请参阅 父资源外部的子资源。 |
类型资源的符号名称:帐户 |
| 属性 | 认知服务项目的属性。 | ProjectProperties 项目属性 |
| 标签 | 资源标记 | 标记名称和值的字典。 请参阅模板 中的 |
身份
| 名字 | 说明 | 价值 |
|---|---|---|
| 类型 | 标识类型。 | “None” “SystemAssigned” “SystemAssigned,UserAssigned” “UserAssigned” |
| 用户分配的标识 | 与资源关联的用户分配标识的列表。 用户标识字典密钥引用的格式为 ARM 资源 ID:“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName} | IdentityUserAssignedIdentities |
IdentityUserAssignedIdentities
| 名字 | 说明 | 价值 |
|---|
ProjectProperties 项目属性
| 名字 | 说明 | 价值 |
|---|---|---|
| 描述 | 认知服务项目的说明。 | 字符串 |
| displayName (显示名称) | 认知服务项目的显示名称。 | 字符串 |
项目标签
| 名字 | 说明 | 价值 |
|---|
UserAssignedIdentity
| 名字 | 说明 | 价值 |
|---|
ARM 模板资源定义
可以使用目标作部署帐户/项目资源类型:
有关每个 API 版本中已更改属性的列表,请参阅 更改日志。
资源格式
若要创建 Microsoft.CognitiveServices/accounts/projects 资源,请将以下 JSON 添加到模板。
{
"type": "Microsoft.CognitiveServices/accounts/projects",
"apiVersion": "2025-10-01-preview",
"name": "string",
"identity": {
"type": "string",
"userAssignedIdentities": {
"{customized property}": {
}
}
},
"location": "string",
"properties": {
"description": "string",
"displayName": "string"
},
"tags": {
"{customized property}": "string"
}
}
属性值
Microsoft.CognitiveServices/accounts/projects
| 名字 | 说明 | 价值 |
|---|---|---|
| apiVersion | API 版本 | “2025-10-01-预览” |
| 标识 | 资源的标识。 | 身份 |
| 位置 | 资源所在的地理位置 | 字符串 |
| 姓名 | 资源名称 | 字符串 约束: 最小长度 = 2 最大长度 = 64 模式 = ^[a-zA-Z0-9][a-zA-Z0-9_.-]*$ (必需) |
| 属性 | 认知服务项目的属性。 | ProjectProperties 项目属性 |
| 标签 | 资源标记 | 标记名称和值的字典。 请参阅模板 中的 |
| 类型 | 资源类型 | “Microsoft.CognitiveServices/accounts/projects” |
身份
| 名字 | 说明 | 价值 |
|---|---|---|
| 类型 | 标识类型。 | “None” “SystemAssigned” “SystemAssigned,UserAssigned” “UserAssigned” |
| 用户分配的标识 | 与资源关联的用户分配标识的列表。 用户标识字典密钥引用的格式为 ARM 资源 ID:“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName} | IdentityUserAssignedIdentities |
IdentityUserAssignedIdentities
| 名字 | 说明 | 价值 |
|---|
ProjectProperties 项目属性
| 名字 | 说明 | 价值 |
|---|---|---|
| 描述 | 认知服务项目的说明。 | 字符串 |
| displayName (显示名称) | 认知服务项目的显示名称。 | 字符串 |
项目标签
| 名字 | 说明 | 价值 |
|---|
UserAssignedIdentity
| 名字 | 说明 | 价值 |
|---|
用法示例
Terraform (AzAPI 提供程序)资源定义
可以使用目标作部署帐户/项目资源类型:
有关每个 API 版本中已更改属性的列表,请参阅 更改日志。
资源格式
若要创建 Microsoft.CognitiveServices/accounts/projects 资源,请将以下 Terraform 添加到模板。
resource "azapi_resource" "symbolicname" {
type = "Microsoft.CognitiveServices/accounts/projects@2025-10-01-preview"
name = "string"
parent_id = "string"
identity {
type = "string"
identity_ids = [
"string"
]
}
location = "string"
tags = {
{customized property} = "string"
}
body = {
properties = {
description = "string"
displayName = "string"
}
}
}
属性值
Microsoft.CognitiveServices/accounts/projects
| 名字 | 说明 | 价值 |
|---|---|---|
| 标识 | 资源的标识。 | 身份 |
| 位置 | 资源所在的地理位置 | 字符串 |
| 姓名 | 资源名称 | 字符串 约束: 最小长度 = 2 最大长度 = 64 模式 = ^[a-zA-Z0-9][a-zA-Z0-9_.-]*$ (必需) |
| parent_id | 此资源的父资源的 ID。 | 类型资源的 ID:帐户 |
| 属性 | 认知服务项目的属性。 | ProjectProperties 项目属性 |
| 标签 | 资源标记 | 标记名称和值的字典。 |
| 类型 | 资源类型 | “Microsoft.CognitiveServices/accounts/projects@2025-10-01-preview” |
身份
| 名字 | 说明 | 价值 |
|---|---|---|
| 类型 | 标识类型。 | “None” “SystemAssigned” “SystemAssigned,UserAssigned” “UserAssigned” |
| 用户分配的标识 | 与资源关联的用户分配标识的列表。 用户标识字典密钥引用的格式为 ARM 资源 ID:“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName} | IdentityUserAssignedIdentities |
IdentityUserAssignedIdentities
| 名字 | 说明 | 价值 |
|---|
ProjectProperties 项目属性
| 名字 | 说明 | 价值 |
|---|---|---|
| 描述 | 认知服务项目的说明。 | 字符串 |
| displayName (显示名称) | 认知服务项目的显示名称。 | 字符串 |
项目标签
| 名字 | 说明 | 价值 |
|---|
UserAssignedIdentity
| 名字 | 说明 | 价值 |
|---|
用法示例
Terraform 示例
认知服务账户项目部署的基本示例。
terraform {
required_providers {
azapi = {
source = "Azure/azapi"
}
}
}
provider "azapi" {
skip_provider_registration = false
}
variable "resource_name" {
type = string
default = "acctest0001"
}
variable "location" {
type = string
default = "westus2"
}
resource "azapi_resource" "resourceGroup" {
type = "Microsoft.Resources/resourceGroups@2020-06-01"
name = var.resource_name
location = var.location
}
resource "azapi_resource" "account" {
type = "Microsoft.CognitiveServices/accounts@2025-06-01"
parent_id = azapi_resource.resourceGroup.id
name = var.resource_name
location = var.location
identity {
type = "SystemAssigned"
}
body = {
kind = "AIServices"
properties = {
allowProjectManagement = true
customSubDomainName = "cog-${var.resource_name}"
disableLocalAuth = false
dynamicThrottlingEnabled = false
publicNetworkAccess = "Enabled"
restrictOutboundNetworkAccess = false
}
sku = {
name = "S0"
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "project" {
type = "Microsoft.CognitiveServices/accounts/projects@2025-06-01"
parent_id = azapi_resource.account.id
name = var.resource_name
location = var.location
identity {
type = "SystemAssigned"
}
body = {
properties = {
displayName = "project-${var.resource_name}"
description = "test project"
}
}
tags = {
foo = "bar"
}
schema_validation_enabled = false
response_export_values = ["*"]
}