Bicep 資源定義
應用程式資源類型可以使用目標作業來部署:
- 資源群組 - 請參閱 資源群組部署命令
如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔。
使用範例
Bicep 範例
部署受管理應用程式的基本範例。
param resourceName string = 'acctest0001'
param location string = 'westus'
resource application 'Microsoft.Solutions/applications@2021-07-01' = {
name: '${resourceName}-app'
location: location
kind: 'ServiceCatalog'
properties: {
applicationDefinitionId: applicationDefinition.id
managedResourceGroupId: '/subscriptions/${subscription().subscriptionId}/resourceGroups/${resourceName}-infragroup'
parameters: {
arrayParameter: {
value: [
'value_1'
'value_2'
]
}
boolParameter: {
value: true
}
intParameter: {
value: 100
}
objectParameter: {
value: {
nested_array: [
'value_1'
'value_2'
]
nested_bool: true
nested_object: {
key_0: 0
}
}
}
secureStringParameter: {
value: ''
}
stringParameter: {
value: 'value_1'
}
}
}
}
resource applicationDefinition 'Microsoft.Solutions/applicationDefinitions@2021-07-01' = {
name: '${resourceName}-appdef'
location: location
properties: {
authorizations: [
{
principalId: deployer().objectId
roleDefinitionId: 'b24988ac-6180-42a0-ab88-20f7382dd24c'
}
]
createUiDefinition: /* ERROR: Unparsed HCL syntax in LiteralNode */ {}
description: 'Test Managed App Definition'
displayName: 'TestManagedAppDefinition'
isEnabled: true
lockLevel: 'ReadOnly'
mainTemplate: /* ERROR: Unparsed HCL syntax in LiteralNode */ {}
}
}
資源格式
若要建立 Microsoft.Solutions/applications 資源,請將下列 Bicep 新增至範本。
resource symbolicname 'Microsoft.Solutions/applications@2023-12-01-preview' = {
identity: {
type: 'string'
userAssignedIdentities: {
{customized property}: {}
}
}
kind: 'string'
location: 'string'
managedBy: 'string'
name: 'string'
plan: {
name: 'string'
product: 'string'
promotionCode: 'string'
publisher: 'string'
version: 'string'
}
properties: {
applicationDefinitionId: 'string'
jitAccessPolicy: {
jitAccessEnabled: bool
jitApprovalMode: 'string'
jitApprovers: [
{
displayName: 'string'
id: 'string'
type: 'string'
}
]
maximumJitAccessDuration: 'string'
}
managedResourceGroupId: 'string'
parameters: any(...)
}
sku: {
capacity: int
family: 'string'
model: 'string'
name: 'string'
size: 'string'
tier: 'string'
}
tags: {
{customized property}: 'string'
}
}
屬性值
Microsoft.Solutions/applications
| 名字 | 描述 | 價值 |
|---|---|---|
| 身分識別 | 資源的身分識別。 | 身分識別 |
| 類 | 受控應用程式的種類。 允許的值為 MarketPlace 和 ServiceCatalog。 | 字串 約束: 模式 = ^[-\w\._,\(\)]+$ (必要) |
| 位置 | 資源位置 | 字串 |
| managedBy | 管理此資源的資源識別碼。 | 字串 |
| 名字 | 資源名稱 | 字串 約束: 最小長度 = 3 最大長度 = 64 (必要) |
| 方案 | 計劃資訊。 | 方案 |
| 性能 | 受控應用程式屬性。 | ApplicationProperties (必要) |
| SKU | 資源的 SKU。 | SKU |
| 標籤 | 資源標籤 | 標記名稱和值的字典。 請參閱範本中的 標籤 |
ApplicationJitAccessPolicy
| 名字 | 描述 | 價值 |
|---|---|---|
| jitAccess已啟用 | 是否啟用 JIT 存取。 | 布林 (必要) |
| jitApprovalMode | JIT 核准模式。 | “自動批准” '手動批准' “未指定” |
| jit審批者 | JIT 核准者 | JitApproverDefinition[] |
| maximumJitAccessDuration | 授與最大持續時間 JIT 存取權。 這是ISO8601時間週期值。 | 字串 |
應用程式屬性
| 名字 | 描述 | 價值 |
|---|---|---|
| applicationDefinitionId 應用程式定義ID | 受控應用程式定義標識碼的完整路徑。 | 字串 |
| jitAccessPolicy | 受控應用程式 Jit 存取原則。 | ApplicationJitAccessPolicy |
| managedResourceGroupId | 受控資源群組標識碼。 | 字串 |
| 參數 | 定義受控應用程式參數的名稱和值組。 它可以是 JObject 或格式正確的 JSON 字串。 | 任何 |
身份
| 名字 | 描述 | 價值 |
|---|---|---|
| 型別 | 識別類型。 | “無” “系統分配” 'SystemAssigned, UserAssigned' 'UserAssigned' |
| 使用者指派的身份 | 與資源相關聯的使用者身分識別清單。 使用者身分識別字典索引鍵參考的格式為:『/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'。 | IdentityUserAssignedIdentities |
IdentityUserAssignedIdentities
| 名字 | 描述 | 價值 |
|---|
JitApprover定義
| 名字 | 描述 | 價值 |
|---|---|---|
| 顯示名稱 | 核准者顯示名稱。 | 字串 |
| 識別碼 | 核准者服務主體標識碼。 | 字串 (必要) |
| 型別 | 核准者類型。 | '組' '使用者' |
計劃
| 名字 | 描述 | 價值 |
|---|---|---|
| 名字 | 計劃名稱。 | 字串 (必要) |
| 產品 | 產品名稱。 | 字串 (必要) |
| 促銷代碼 | 促銷碼。 | 字串 |
| 發行者 | 發行者標識碼。 | 字串 (必要) |
| 版本 | 方案的版本。 | 字串 (必要) |
資源標籤
| 名字 | 描述 | 價值 |
|---|
SKU
| 名字 | 描述 | 價值 |
|---|---|---|
| 容量 | SKU 容量。 | 整數 (int) |
| 家庭 | SKU 系列。 | 字串 |
| 型號 | SKU 模型。 | 字串 |
| 名字 | SKU 名稱。 | 字串 (必要) |
| 大小 | SKU 大小。 | 字串 |
| 分層 | SKU 層。 | 字串 |
UserAssignedResourceIdentity
| 名字 | 描述 | 價值 |
|---|
ARM 樣本資源定義
應用程式資源類型可以使用目標作業來部署:
使用範例
Azure 快速入門範本
下列 Azure 快速入門範本 部署此資源類型。
| 範本 | 描述 |
|---|---|
|
建立可部署連結範本的受控應用程式 |
此範本會建立部署連結範本的受控應用程式。 |
|
使用自定義檢視建立受控應用程式 |
此範本會建立具有自定義預設檢視的受控應用程式。 |
|
使用計量和警示建立受控應用程式 |
此範本會建立具有應用程式計量和警示的受控應用程式。 |
資源格式
若要建立 Microsoft.Solutions/applications 資源,請將下列 JSON 新增至範本。
{
"type": "Microsoft.Solutions/applications",
"apiVersion": "2023-12-01-preview",
"name": "string",
"identity": {
"type": "string",
"userAssignedIdentities": {
"{customized property}": {
}
}
},
"kind": "string",
"location": "string",
"managedBy": "string",
"plan": {
"name": "string",
"product": "string",
"promotionCode": "string",
"publisher": "string",
"version": "string"
},
"properties": {
"applicationDefinitionId": "string",
"jitAccessPolicy": {
"jitAccessEnabled": "bool",
"jitApprovalMode": "string",
"jitApprovers": [
{
"displayName": "string",
"id": "string",
"type": "string"
}
],
"maximumJitAccessDuration": "string"
},
"managedResourceGroupId": "string",
"parameters": {}
},
"sku": {
"capacity": "int",
"family": "string",
"model": "string",
"name": "string",
"size": "string",
"tier": "string"
},
"tags": {
"{customized property}": "string"
}
}
屬性值
Microsoft.Solutions/applications
| 名字 | 描述 | 價值 |
|---|---|---|
| apiVersion | API 版本 | “2023-12-01-預覽” |
| 身分識別 | 資源的身分識別。 | 身分識別 |
| 類 | 受控應用程式的種類。 允許的值為 MarketPlace 和 ServiceCatalog。 | 字串 約束: 模式 = ^[-\w\._,\(\)]+$ (必要) |
| 位置 | 資源位置 | 字串 |
| managedBy | 管理此資源的資源識別碼。 | 字串 |
| 名字 | 資源名稱 | 字串 約束: 最小長度 = 3 最大長度 = 64 (必要) |
| 方案 | 計劃資訊。 | 方案 |
| 性能 | 受控應用程式屬性。 | ApplicationProperties (必要) |
| SKU | 資源的 SKU。 | SKU |
| 標籤 | 資源標籤 | 標記名稱和值的字典。 請參閱範本中的 標籤 |
| 型別 | 資源類型 | “Microsoft.Solutions/applications” |
ApplicationJitAccessPolicy
| 名字 | 描述 | 價值 |
|---|---|---|
| jitAccess已啟用 | 是否啟用 JIT 存取。 | 布林 (必要) |
| jitApprovalMode | JIT 核准模式。 | “自動批准” '手動批准' “未指定” |
| jit審批者 | JIT 核准者 | JitApproverDefinition[] |
| maximumJitAccessDuration | 授與最大持續時間 JIT 存取權。 這是ISO8601時間週期值。 | 字串 |
應用程式屬性
| 名字 | 描述 | 價值 |
|---|---|---|
| applicationDefinitionId 應用程式定義ID | 受控應用程式定義標識碼的完整路徑。 | 字串 |
| jitAccessPolicy | 受控應用程式 Jit 存取原則。 | ApplicationJitAccessPolicy |
| managedResourceGroupId | 受控資源群組標識碼。 | 字串 |
| 參數 | 定義受控應用程式參數的名稱和值組。 它可以是 JObject 或格式正確的 JSON 字串。 | 任何 |
身份
| 名字 | 描述 | 價值 |
|---|---|---|
| 型別 | 識別類型。 | “無” “系統分配” 'SystemAssigned, UserAssigned' 'UserAssigned' |
| 使用者指派的身份 | 與資源相關聯的使用者身分識別清單。 使用者身分識別字典索引鍵參考的格式為:『/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'。 | IdentityUserAssignedIdentities |
IdentityUserAssignedIdentities
| 名字 | 描述 | 價值 |
|---|
JitApprover定義
| 名字 | 描述 | 價值 |
|---|---|---|
| 顯示名稱 | 核准者顯示名稱。 | 字串 |
| 識別碼 | 核准者服務主體標識碼。 | 字串 (必要) |
| 型別 | 核准者類型。 | '組' '使用者' |
計劃
| 名字 | 描述 | 價值 |
|---|---|---|
| 名字 | 計劃名稱。 | 字串 (必要) |
| 產品 | 產品名稱。 | 字串 (必要) |
| 促銷代碼 | 促銷碼。 | 字串 |
| 發行者 | 發行者標識碼。 | 字串 (必要) |
| 版本 | 方案的版本。 | 字串 (必要) |
資源標籤
| 名字 | 描述 | 價值 |
|---|
SKU
| 名字 | 描述 | 價值 |
|---|---|---|
| 容量 | SKU 容量。 | 整數 (int) |
| 家庭 | SKU 系列。 | 字串 |
| 型號 | SKU 模型。 | 字串 |
| 名字 | SKU 名稱。 | 字串 (必要) |
| 大小 | SKU 大小。 | 字串 |
| 分層 | SKU 層。 | 字串 |
UserAssignedResourceIdentity
| 名字 | 描述 | 價值 |
|---|
Terraform (AzAPI 提供者) 資源定義
應用程式資源類型可以使用目標作業來部署:
- 資源團體 關於每個 API 版本變更屬性的清單,請參見 變更日誌。
使用範例
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" "applicationDefinition" {
type = "Microsoft.Solutions/applicationDefinitions@2021-07-01"
parent_id = azapi_resource.resourceGroup.id
name = "${var.resource_name}-appdef"
location = var.location
body = {
properties = {
authorizations = [{
principalId = data.azapi_client_config.current.object_id
roleDefinitionId = "b24988ac-6180-42a0-ab88-20f7382dd24c"
}]
createUiDefinition = " {\n \"$schema\": \"https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#\",\n \"handler\": \"Microsoft.Azure.CreateUIDef\",\n \"version\": \"0.1.2-preview\",\n \"parameters\": {\n \"basics\": [],\n \"steps\": [],\n \"outputs\": {}\n }\n }\n"
description = "Test Managed App Definition"
displayName = "TestManagedAppDefinition"
isEnabled = true
lockLevel = "ReadOnly"
mainTemplate = " {\n \"$schema\": \"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#\",\n \"contentVersion\": \"1.0.0.0\",\n \"parameters\": {\n\n \"boolParameter\": {\n \"type\": \"bool\"\n },\n \"intParameter\": {\n \"type\": \"int\"\n },\n \"stringParameter\": {\n \"type\": \"string\"\n },\n \"secureStringParameter\": {\n \"type\": \"secureString\"\n },\n \"objectParameter\": {\n \"type\": \"object\"\n },\n \"arrayParameter\": {\n \"type\": \"array\"\n }\n\n },\n \"variables\": {},\n \"resources\": [],\n \"outputs\": {\n \"boolOutput\": {\n \"type\": \"bool\",\n \"value\": true\n },\n \"intOutput\": {\n \"type\": \"int\",\n \"value\": 100\n },\n \"stringOutput\": {\n \"type\": \"string\",\n \"value\": \"stringOutputValue\"\n },\n \"objectOutput\": {\n \"type\": \"object\",\n \"value\": {\n \"nested_bool\": true,\n \"nested_array\": [\"value_1\", \"value_2\"],\n \"nested_object\": {\n \"key_0\": 0\n }\n }\n },\n \"arrayOutput\": {\n \"type\": \"array\",\n \"value\": [\"value_1\", \"value_2\"]\n }\n }\n }\n"
}
}
}
resource "azapi_resource" "application" {
type = "Microsoft.Solutions/applications@2021-07-01"
parent_id = azapi_resource.resourceGroup.id
name = "${var.resource_name}-app"
location = var.location
body = {
kind = "ServiceCatalog"
properties = {
applicationDefinitionId = azapi_resource.applicationDefinition.id
managedResourceGroupId = "/subscriptions/${data.azapi_client_config.current.subscription_id}/resourceGroups/${var.resource_name}-infragroup"
parameters = {
arrayParameter = {
value = ["value_1", "value_2"]
}
boolParameter = {
value = true
}
intParameter = {
value = 100
}
objectParameter = {
value = {
nested_array = ["value_1", "value_2"]
nested_bool = true
nested_object = {
key_0 = 0
}
}
}
secureStringParameter = {
value = ""
}
stringParameter = {
value = "value_1"
}
}
}
}
}
資源格式
若要建立 Microsoft.Solutions/applications 資源,請將下列 Terraform 新增至範本。
resource "azapi_resource" "symbolicname" {
type = "Microsoft.Solutions/applications@2023-12-01-preview"
name = "string"
parent_id = "string"
identity {
type = "string"
identity_ids = [
"string"
]
}
location = "string"
tags = {
{customized property} = "string"
}
body = {
kind = "string"
managedBy = "string"
plan = {
name = "string"
product = "string"
promotionCode = "string"
publisher = "string"
version = "string"
}
properties = {
applicationDefinitionId = "string"
jitAccessPolicy = {
jitAccessEnabled = bool
jitApprovalMode = "string"
jitApprovers = [
{
displayName = "string"
id = "string"
type = "string"
}
]
maximumJitAccessDuration = "string"
}
managedResourceGroupId = "string"
parameters = ?
}
sku = {
capacity = int
family = "string"
model = "string"
name = "string"
size = "string"
tier = "string"
}
}
}
屬性值
Microsoft.Solutions/applications
| 名字 | 描述 | 價值 |
|---|---|---|
| 身分識別 | 資源的身分識別。 | 身分識別 |
| 類 | 受控應用程式的種類。 允許的值為 MarketPlace 和 ServiceCatalog。 | 字串 約束: 模式 = ^[-\w\._,\(\)]+$ (必要) |
| 位置 | 資源位置 | 字串 |
| managedBy | 管理此資源的資源識別碼。 | 字串 |
| 名字 | 資源名稱 | 字串 約束: 最小長度 = 3 最大長度 = 64 (必要) |
| 方案 | 計劃資訊。 | 方案 |
| 性能 | 受控應用程式屬性。 | ApplicationProperties (必要) |
| SKU | 資源的 SKU。 | SKU |
| 標籤 | 資源標籤 | 標記名稱和值的字典。 |
| 型別 | 資源類型 | “Microsoft.Solutions/applications@2023-12-01-preview” |
ApplicationJitAccessPolicy
| 名字 | 描述 | 價值 |
|---|---|---|
| jitAccess已啟用 | 是否啟用 JIT 存取。 | 布林 (必要) |
| jitApprovalMode | JIT 核准模式。 | “自動批准” '手動批准' “未指定” |
| jit審批者 | JIT 核准者 | JitApproverDefinition[] |
| maximumJitAccessDuration | 授與最大持續時間 JIT 存取權。 這是ISO8601時間週期值。 | 字串 |
應用程式屬性
| 名字 | 描述 | 價值 |
|---|---|---|
| applicationDefinitionId 應用程式定義ID | 受控應用程式定義標識碼的完整路徑。 | 字串 |
| jitAccessPolicy | 受控應用程式 Jit 存取原則。 | ApplicationJitAccessPolicy |
| managedResourceGroupId | 受控資源群組標識碼。 | 字串 |
| 參數 | 定義受控應用程式參數的名稱和值組。 它可以是 JObject 或格式正確的 JSON 字串。 | 任何 |
身份
| 名字 | 描述 | 價值 |
|---|---|---|
| 型別 | 識別類型。 | “無” “系統分配” 'SystemAssigned, UserAssigned' 'UserAssigned' |
| 使用者指派的身份 | 與資源相關聯的使用者身分識別清單。 使用者身分識別字典索引鍵參考的格式為:『/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'。 | IdentityUserAssignedIdentities |
IdentityUserAssignedIdentities
| 名字 | 描述 | 價值 |
|---|
JitApprover定義
| 名字 | 描述 | 價值 |
|---|---|---|
| 顯示名稱 | 核准者顯示名稱。 | 字串 |
| 識別碼 | 核准者服務主體標識碼。 | 字串 (必要) |
| 型別 | 核准者類型。 | '組' '使用者' |
計劃
| 名字 | 描述 | 價值 |
|---|---|---|
| 名字 | 計劃名稱。 | 字串 (必要) |
| 產品 | 產品名稱。 | 字串 (必要) |
| 促銷代碼 | 促銷碼。 | 字串 |
| 發行者 | 發行者標識碼。 | 字串 (必要) |
| 版本 | 方案的版本。 | 字串 (必要) |
資源標籤
| 名字 | 描述 | 價值 |
|---|
SKU
| 名字 | 描述 | 價值 |
|---|---|---|
| 容量 | SKU 容量。 | 整數 (int) |
| 家庭 | SKU 系列。 | 字串 |
| 型號 | SKU 模型。 | 字串 |
| 名字 | SKU 名稱。 | 字串 (必要) |
| 大小 | SKU 大小。 | 字串 |
| 分層 | SKU 層。 | 字串 |
UserAssignedResourceIdentity
| 名字 | 描述 | 價值 |
|---|