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

Artifacts - Create Or Update

创建或更新蓝图项目。

PUT https://management.azure.com/{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/artifacts/{artifactName}?api-version=2018-11-01-preview

URI 参数

名称 必需 类型 说明
artifactName
path True

string

蓝图项目的名称。

blueprintName
path True

string

蓝图定义的名称。

resourceScope
path True

string

资源的范围。 有效范围包括:管理组(格式:'/providers/Microsoft.Management/managementGroups/{managementGroup}')、订阅(格式:'/subscriptions/{subscriptionId}')。

api-version
query True

string

客户端 API 版本。

请求正文

请求正文可以为下列任一内容:

名称 说明
PolicyAssignmentArtifact

应用策略分配的蓝图项目。

RoleAssignmentArtifact

应用角色分配的蓝图项目。

TemplateArtifact

部署资源管理器模板的蓝图项目。

PolicyAssignmentArtifact

应用策略分配的蓝图项目。

名称 必需 类型 说明
kind True string:

policyAssignment

指定蓝图项目的类型。

properties.parameters True

<string,  ParameterValue>

策略定义的参数值。

properties.policyDefinitionId True

string

策略定义的 Azure 资源 ID。

properties.dependsOn

string[]

需要在指定项目之前部署的项目。

properties.description

string

maxLength: 500

多行说明此资源。

properties.displayName

string

maxLength: 256

单行字符串解释此资源。

properties.resourceGroup

string

将向其分配策略的资源组占位符的名称。

RoleAssignmentArtifact

应用角色分配的蓝图项目。

名称 必需 类型 说明
kind True string:

roleAssignment

指定蓝图项目的类型。

properties.principalIds True

Azure Active Directory 中的用户或组标识数组。 roleDefinition 将应用于每个标识。

properties.roleDefinitionId True

string

RoleDefinition 的 Azure 资源 ID。

properties.dependsOn

string[]

需要在指定项目之前部署的项目。

properties.description

string

maxLength: 500

多行说明此资源。

properties.displayName

string

maxLength: 256

单行字符串解释此资源。

properties.resourceGroup

string

RoleAssignment 的范围将限定为此 resourceGroup。 如果为空,则范围限定为订阅。

TemplateArtifact

部署资源管理器模板的蓝图项目。

名称 必需 类型 说明
kind True string:

template

指定蓝图项目的类型。

properties.parameters True

<string,  ParameterValue>

资源管理器模板蓝图项目参数值。

properties.template True

object

资源管理器模板蓝图项目正文。

properties.dependsOn

string[]

需要在指定项目之前部署的项目。

properties.description

string

maxLength: 500

多行说明此资源。

properties.displayName

string

maxLength: 256

单行字符串解释此资源。

properties.resourceGroup

string

如果适用,则会将资源管理器模板蓝图项目部署到的资源组占位符的名称。

响应

名称 类型 说明
201 Created Artifact:

已创建 -- 蓝图项目已创建/更新。

Other Status Codes

CloudError

蓝图错误响应。

安全性

azure_auth

Azure Active Directory OAuth2 Flow

类型: oauth2
流向: implicit
授权 URL: https://login.microsoftonline.com/common/oauth2/authorize

作用域

名称 说明
user_impersonation 模拟用户帐户

示例

MG-ARMTemplateArtifact
MG-PolicyAssignmentArtifact
MG-RoleAssignmentArtifact
Sub-ARMTemplateArtifact
Sub-PolicyAssignmentArtifact
Sub-RoleAssignmentArtifact

MG-ARMTemplateArtifact

示例请求

PUT https://management.azure.com/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/storageTemplate?api-version=2018-11-01-preview

{
  "kind": "template",
  "properties": {
    "template": {
      "contentVersion": "1.0.0.0",
      "parameters": {
        "storageAccountType": {
          "type": "string",
          "defaultValue": "Standard_LRS",
          "allowedValues": [
            "Standard_LRS",
            "Standard_GRS",
            "Standard_ZRS",
            "Premium_LRS"
          ],
          "metadata": {
            "description": "Storage Account type"
          }
        }
      },
      "variables": {
        "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'standardsa')]"
      },
      "resources": [
        {
          "type": "Microsoft.Storage/storageAccounts",
          "name": "[variables('storageAccountName')]",
          "apiVersion": "2016-01-01",
          "location": "[resourceGroup().location]",
          "sku": {
            "name": "[parameters('storageAccountType')]"
          },
          "kind": "Storage",
          "properties": {}
        }
      ],
      "outputs": {
        "storageAccountName": {
          "type": "string",
          "value": "[variables('storageAccountName')]"
        }
      }
    },
    "resourceGroup": "storageRG",
    "parameters": {
      "storageAccountType": {
        "value": "[parameters('storageAccountType')]"
      }
    }
  }
}

示例响应

{
  "properties": {
    "template": {
      "contentVersion": "1.0.0.0",
      "parameters": {
        "storageAccountType": {
          "type": "string",
          "defaultValue": "Standard_LRS",
          "allowedValues": [
            "Standard_LRS",
            "Standard_GRS",
            "Standard_ZRS",
            "Premium_LRS"
          ],
          "metadata": {
            "description": "Storage Account type"
          }
        }
      },
      "variables": {
        "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'standardsa')]"
      },
      "resources": [
        {
          "type": "Microsoft.Storage/storageAccounts",
          "name": "[variables('storageAccountName')]",
          "apiVersion": "2016-01-01",
          "location": "[resourceGroup().location]",
          "sku": {
            "name": "[parameters('storageAccountType')]"
          },
          "kind": "Storage",
          "properties": {}
        }
      ],
      "outputs": {
        "storageAccountName": {
          "type": "string",
          "value": "[variables('storageAccountName')]"
        }
      }
    },
    "resourceGroup": "storageRG",
    "parameters": {
      "storageAccountType": {
        "value": "[parameters('storageAccountType')]"
      }
    }
  },
  "kind": "template",
  "id": "/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/storageTemplate",
  "type": "Microsoft.Blueprint/blueprints/artifacts",
  "name": "storageTemplate"
}

MG-PolicyAssignmentArtifact

示例请求

PUT https://management.azure.com/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/costCenterPolicy?api-version=2018-11-01-preview

{
  "properties": {
    "displayName": "force costCenter tag on all resources",
    "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62",
    "parameters": {
      "tagName": {
        "value": "costCenter"
      },
      "tagValue": {
        "value": "[parameter('costCenter')]"
      }
    }
  },
  "kind": "policyAssignment"
}

示例响应

{
  "properties": {
    "displayName": "force costCenter tag on all resources",
    "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62",
    "parameters": {
      "tagName": {
        "value": "costCenter"
      },
      "tagValue": {
        "value": "[parameter('costCenter')]"
      }
    }
  },
  "kind": "policyAssignment",
  "id": "/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/costCenterPolicy",
  "type": "Microsoft.Blueprint/blueprints/artifacts",
  "name": "costCenterPolicy"
}

MG-RoleAssignmentArtifact

示例请求

PUT https://management.azure.com/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/ownerAssignment?api-version=2018-11-01-preview

{
  "properties": {
    "displayName": "enforce owners of given subscription",
    "roleDefinitionId": "/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7",
    "principalIds": "[parameters('owners')]"
  },
  "kind": "roleAssignment"
}

示例响应

{
  "properties": {
    "displayName": "enforce owners of given subscription",
    "roleDefinitionId": "/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7",
    "principalIds": "[parameters('owners')]"
  },
  "kind": "roleAssignment",
  "id": "/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/ownerAssignment",
  "type": "Microsoft.Blueprint/blueprints/artifacts",
  "name": "ownerAssignment"
}

Sub-ARMTemplateArtifact

示例请求

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/storageTemplate?api-version=2018-11-01-preview

{
  "kind": "template",
  "properties": {
    "template": {
      "contentVersion": "1.0.0.0",
      "parameters": {
        "storageAccountType": {
          "type": "string",
          "defaultValue": "Standard_LRS",
          "allowedValues": [
            "Standard_LRS",
            "Standard_GRS",
            "Standard_ZRS",
            "Premium_LRS"
          ],
          "metadata": {
            "description": "Storage Account type"
          }
        }
      },
      "variables": {
        "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'standardsa')]"
      },
      "resources": [
        {
          "type": "Microsoft.Storage/storageAccounts",
          "name": "[variables('storageAccountName')]",
          "apiVersion": "2016-01-01",
          "location": "[resourceGroup().location]",
          "sku": {
            "name": "[parameters('storageAccountType')]"
          },
          "kind": "Storage",
          "properties": {}
        }
      ],
      "outputs": {
        "storageAccountName": {
          "type": "string",
          "value": "[variables('storageAccountName')]"
        }
      }
    },
    "resourceGroup": "storageRG",
    "parameters": {
      "storageAccountType": {
        "value": "[parameters('storageAccountType')]"
      }
    }
  }
}

示例响应

{
  "properties": {
    "template": {
      "contentVersion": "1.0.0.0",
      "parameters": {
        "storageAccountType": {
          "type": "string",
          "defaultValue": "Standard_LRS",
          "allowedValues": [
            "Standard_LRS",
            "Standard_GRS",
            "Standard_ZRS",
            "Premium_LRS"
          ],
          "metadata": {
            "description": "Storage Account type"
          }
        }
      },
      "variables": {
        "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'standardsa')]"
      },
      "resources": [
        {
          "type": "Microsoft.Storage/storageAccounts",
          "name": "[variables('storageAccountName')]",
          "apiVersion": "2016-01-01",
          "location": "[resourceGroup().location]",
          "sku": {
            "name": "[parameters('storageAccountType')]"
          },
          "kind": "Storage",
          "properties": {}
        }
      ],
      "outputs": {
        "storageAccountName": {
          "type": "string",
          "value": "[variables('storageAccountName')]"
        }
      }
    },
    "resourceGroup": "storageRG",
    "parameters": {
      "storageAccountType": {
        "value": "[parameters('storageAccountType')]"
      }
    }
  },
  "kind": "template",
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/storageTemplate",
  "type": "Microsoft.Blueprint/blueprints/artifacts",
  "name": "storageTemplate"
}

Sub-PolicyAssignmentArtifact

示例请求

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/costCenterPolicy?api-version=2018-11-01-preview

{
  "properties": {
    "displayName": "force costCenter tag on all resources",
    "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62",
    "parameters": {
      "tagName": {
        "value": "costCenter"
      },
      "tagValue": {
        "value": "[parameter('costCenter')]"
      }
    }
  },
  "kind": "policyAssignment"
}

示例响应

{
  "properties": {
    "displayName": "force costCenter tag on all resources",
    "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62",
    "parameters": {
      "tagName": {
        "value": "costCenter"
      },
      "tagValue": {
        "value": "[parameter('costCenter')]"
      }
    }
  },
  "kind": "policyAssignment",
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/costCenterPolicy",
  "type": "Microsoft.Blueprint/blueprints/artifacts",
  "name": "costCenterPolicy"
}

Sub-RoleAssignmentArtifact

示例请求

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/ownerAssignment?api-version=2018-11-01-preview

{
  "properties": {
    "displayName": "enforce owners of given subscription",
    "roleDefinitionId": "/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7",
    "principalIds": "[parameters('owners')]"
  },
  "kind": "roleAssignment"
}

示例响应

{
  "properties": {
    "displayName": "enforce owners of given subscription",
    "roleDefinitionId": "/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7",
    "principalIds": "[parameters('owners')]"
  },
  "kind": "roleAssignment",
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/ownerAssignment",
  "type": "Microsoft.Blueprint/blueprints/artifacts",
  "name": "ownerAssignment"
}

定义

名称 说明
CloudError
ErrorAdditionalInfo

资源管理错误附加信息。

ErrorResponse

错误响应

keyVaultReference

指定 Key Vault 的链接。

ParameterValue

指定参数的值。 可以是“value”或“reference”,但不能同时为两者。

PolicyAssignmentArtifact

应用策略分配的蓝图项目。

RoleAssignmentArtifact

应用角色分配的蓝图项目。

SecretValueReference

对 Key Vault 机密的引用。

TemplateArtifact

部署资源管理器模板的蓝图项目。

CloudError

名称 类型 说明
error

ErrorResponse

错误响应
所有 Azure 资源管理器 API 的常见错误响应,以返回失败作的错误详细信息。 (这也遵循 OData 错误响应格式。)

ErrorAdditionalInfo

资源管理错误附加信息。

名称 类型 说明
info

object

其他信息。

type

string

其他信息类型。

ErrorResponse

错误响应

名称 类型 说明
additionalInfo

ErrorAdditionalInfo[]

错误附加信息。

code

string

错误代码。

details

ErrorResponse[]

错误详细信息。

message

string

错误消息。

target

string

错误目标。

keyVaultReference

指定 Key Vault 的链接。

名称 类型 说明
id

string

Key Vault 的 Azure 资源 ID。

ParameterValue

指定参数的值。 可以是“value”或“reference”,但不能同时为两者。

名称 类型 说明
reference

SecretValueReference

参数值作为引用类型。

value

object

参数值。 允许任何有效的 JSON 值,包括对象、数组、字符串、数字和布尔值。

PolicyAssignmentArtifact

应用策略分配的蓝图项目。

名称 类型 说明
id

string

用于在 Azure 上查找任何资源的字符串 ID。

kind string:

policyAssignment

指定蓝图项目的类型。

name

string

此资源的名称。

properties.dependsOn

string[]

需要在指定项目之前部署的项目。

properties.description

string

maxLength: 500

多行说明此资源。

properties.displayName

string

maxLength: 256

单行字符串解释此资源。

properties.parameters

<string,  ParameterValue>

策略定义的参数值。

properties.policyDefinitionId

string

策略定义的 Azure 资源 ID。

properties.resourceGroup

string

将向其分配策略的资源组占位符的名称。

type

string

此资源的类型。

RoleAssignmentArtifact

应用角色分配的蓝图项目。

名称 类型 说明
id

string

用于在 Azure 上查找任何资源的字符串 ID。

kind string:

roleAssignment

指定蓝图项目的类型。

name

string

此资源的名称。

properties.dependsOn

string[]

需要在指定项目之前部署的项目。

properties.description

string

maxLength: 500

多行说明此资源。

properties.displayName

string

maxLength: 256

单行字符串解释此资源。

properties.principalIds

Azure Active Directory 中的用户或组标识数组。 roleDefinition 将应用于每个标识。

properties.resourceGroup

string

RoleAssignment 的范围将限定为此 resourceGroup。 如果为空,则范围限定为订阅。

properties.roleDefinitionId

string

RoleDefinition 的 Azure 资源 ID。

type

string

此资源的类型。

SecretValueReference

对 Key Vault 机密的引用。

名称 类型 说明
keyVault

keyVaultReference

指定对给定 Azure Key Vault 的引用。

secretName

string

机密的名称。

secretVersion

string

要使用的机密版本。 如果留空,则使用最新版本的机密。

TemplateArtifact

部署资源管理器模板的蓝图项目。

名称 类型 说明
id

string

用于在 Azure 上查找任何资源的字符串 ID。

kind string:

template

指定蓝图项目的类型。

name

string

此资源的名称。

properties.dependsOn

string[]

需要在指定项目之前部署的项目。

properties.description

string

maxLength: 500

多行说明此资源。

properties.displayName

string

maxLength: 256

单行字符串解释此资源。

properties.parameters

<string,  ParameterValue>

资源管理器模板蓝图项目参数值。

properties.resourceGroup

string

如果适用,则会将资源管理器模板蓝图项目部署到的资源组占位符的名称。

properties.template

object

资源管理器模板蓝图项目正文。

type

string

此资源的类型。