Delen via


Artifacts - Create Or Update

Create or update blueprint artifact.

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

URI Parameters

Name In Required Type Description
artifactName
path True

string

Name of the blueprint artifact.

blueprintName
path True

string

Name of the blueprint definition.

resourceScope
path True

string

The scope of the resource. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}').

api-version
query True

string

Client API Version.

Request Body

The request body can be one of the following:

Name Description
PolicyAssignmentArtifact

Blueprint artifact that applies a Policy assignment.

RoleAssignmentArtifact

Blueprint artifact that applies a Role assignment.

TemplateArtifact

Blueprint artifact that deploys a Resource Manager template.

PolicyAssignmentArtifact

Blueprint artifact that applies a Policy assignment.

Name Required Type Description
kind True string:

policyAssignment

Specifies the kind of blueprint artifact.

properties.parameters True

<string,  ParameterValue>

Parameter values for the policy definition.

properties.policyDefinitionId True

string

Azure resource ID of the policy definition.

properties.dependsOn

string[]

Artifacts which need to be deployed before the specified artifact.

properties.description

string

Multi-line explain this resource.

properties.displayName

string

One-liner string explain this resource.

properties.resourceGroup

string

Name of the resource group placeholder to which the policy will be assigned.

RoleAssignmentArtifact

Blueprint artifact that applies a Role assignment.

Name Required Type Description
kind True string:

roleAssignment

Specifies the kind of blueprint artifact.

properties.principalIds True

Array of user or group identities in Azure Active Directory. The roleDefinition will apply to each identity.

properties.roleDefinitionId True

string

Azure resource ID of the RoleDefinition.

properties.dependsOn

string[]

Artifacts which need to be deployed before the specified artifact.

properties.description

string

Multi-line explain this resource.

properties.displayName

string

One-liner string explain this resource.

properties.resourceGroup

string

RoleAssignment will be scope to this resourceGroup. If empty, it scopes to the subscription.

TemplateArtifact

Blueprint artifact that deploys a Resource Manager template.

Name Required Type Description
kind True string:

template

Specifies the kind of blueprint artifact.

properties.parameters True

<string,  ParameterValue>

Resource Manager template blueprint artifact parameter values.

properties.template True

object

The Resource Manager template blueprint artifact body.

properties.dependsOn

string[]

Artifacts which need to be deployed before the specified artifact.

properties.description

string

Multi-line explain this resource.

properties.displayName

string

One-liner string explain this resource.

properties.resourceGroup

string

If applicable, the name of the resource group placeholder to which the Resource Manager template blueprint artifact will be deployed.

Responses

Name Type Description
201 Created Artifact:

Created -- blueprint artifact created/updated.

Other Status Codes

CloudError

Blueprints error response.

Security

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

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

MG-ARMTemplateArtifact

Sample request

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')]"
      }
    }
  }
}

Sample response

{
  "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

Sample request

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"
}

Sample response

{
  "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

Sample request

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"
}

Sample response

{
  "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

Sample request

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')]"
      }
    }
  }
}

Sample response

{
  "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

Sample request

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"
}

Sample response

{
  "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

Sample request

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"
}

Sample response

{
  "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"
}

Definitions

Name Description
CloudError
ErrorAdditionalInfo

The resource management error additional info.

ErrorResponse

Error Response

keyVaultReference

Specifies the link to a Key Vault.

ParameterValue

Value for the specified parameter. Can be either 'value' or 'reference' but not both.

PolicyAssignmentArtifact

Blueprint artifact that applies a Policy assignment.

RoleAssignmentArtifact

Blueprint artifact that applies a Role assignment.

SecretValueReference

Reference to a Key Vault secret.

TemplateArtifact

Blueprint artifact that deploys a Resource Manager template.

CloudError

Name Type Description
error

ErrorResponse

Error Response
Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.)

ErrorAdditionalInfo

The resource management error additional info.

Name Type Description
info

object

The additional info.

type

string

The additional info type.

ErrorResponse

Error Response

Name Type Description
additionalInfo

ErrorAdditionalInfo[]

The error additional info.

code

string

The error code.

details

ErrorResponse[]

The error details.

message

string

The error message.

target

string

The error target.

keyVaultReference

Specifies the link to a Key Vault.

Name Type Description
id

string

Azure resource ID of the Key Vault.

ParameterValue

Value for the specified parameter. Can be either 'value' or 'reference' but not both.

Name Type Description
reference

SecretValueReference

Parameter value as reference type.

value

object

Parameter value. Any valid JSON value is allowed including objects, arrays, strings, numbers and booleans.

PolicyAssignmentArtifact

Blueprint artifact that applies a Policy assignment.

Name Type Description
id

string

String Id used to locate any resource on Azure.

kind string:

policyAssignment

Specifies the kind of blueprint artifact.

name

string

Name of this resource.

properties.dependsOn

string[]

Artifacts which need to be deployed before the specified artifact.

properties.description

string

Multi-line explain this resource.

properties.displayName

string

One-liner string explain this resource.

properties.parameters

<string,  ParameterValue>

Parameter values for the policy definition.

properties.policyDefinitionId

string

Azure resource ID of the policy definition.

properties.resourceGroup

string

Name of the resource group placeholder to which the policy will be assigned.

type

string

Type of this resource.

RoleAssignmentArtifact

Blueprint artifact that applies a Role assignment.

Name Type Description
id

string

String Id used to locate any resource on Azure.

kind string:

roleAssignment

Specifies the kind of blueprint artifact.

name

string

Name of this resource.

properties.dependsOn

string[]

Artifacts which need to be deployed before the specified artifact.

properties.description

string

Multi-line explain this resource.

properties.displayName

string

One-liner string explain this resource.

properties.principalIds

Array of user or group identities in Azure Active Directory. The roleDefinition will apply to each identity.

properties.resourceGroup

string

RoleAssignment will be scope to this resourceGroup. If empty, it scopes to the subscription.

properties.roleDefinitionId

string

Azure resource ID of the RoleDefinition.

type

string

Type of this resource.

SecretValueReference

Reference to a Key Vault secret.

Name Type Description
keyVault

keyVaultReference

Specifies the reference to a given Azure Key Vault.

secretName

string

Name of the secret.

secretVersion

string

The version of the secret to use. If left blank, the latest version of the secret is used.

TemplateArtifact

Blueprint artifact that deploys a Resource Manager template.

Name Type Description
id

string

String Id used to locate any resource on Azure.

kind string:

template

Specifies the kind of blueprint artifact.

name

string

Name of this resource.

properties.dependsOn

string[]

Artifacts which need to be deployed before the specified artifact.

properties.description

string

Multi-line explain this resource.

properties.displayName

string

One-liner string explain this resource.

properties.parameters

<string,  ParameterValue>

Resource Manager template blueprint artifact parameter values.

properties.resourceGroup

string

If applicable, the name of the resource group placeholder to which the Resource Manager template blueprint artifact will be deployed.

properties.template

object

The Resource Manager template blueprint artifact body.

type

string

Type of this resource.