Skapa eller uppdatera skissartefakten.
PUT https://management.azure.com/{resourceScope}/providers/Microsoft.Blueprint/blueprints/{blueprintName}/artifacts/{artifactName}?api-version=2018-11-01-preview
URI-parametrar
Name |
I |
Obligatorisk |
Typ |
Description |
artifactName
|
path |
True
|
string
|
Namnet på skissartefakten.
|
blueprintName
|
path |
True
|
string
|
Namnet på skissdefinitionen.
|
resourceScope
|
path |
True
|
string
|
Resursens omfång. Giltiga omfång är: hanteringsgrupp (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), prenumeration (format: '/subscriptions/{subscriptionId}').
|
api-version
|
query |
True
|
string
|
Klient-API-version.
|
Begärandetext
Brödtexten i begäran kan vara något av följande:
PolicyAssignmentArtifact
Skissartefakt som tillämpar en principtilldelning.
Name |
Obligatorisk |
Typ |
Description |
kind
|
True
|
string:
policyAssignment
|
Anger typen av skissartefakt.
|
properties.parameters
|
True
|
<string,
ParameterValue>
|
Parametervärden för principdefinitionen.
|
properties.policyDefinitionId
|
True
|
string
|
Azure-resurs-ID för principdefinitionen.
|
properties.dependsOn
|
|
string[]
|
Artefakter som måste distribueras före den angivna artefakten.
|
properties.description
|
|
string
maxLength: 500
|
Förklara den här resursen med flera rader.
|
properties.displayName
|
|
string
maxLength: 256
|
Enradssträng förklarar den här resursen.
|
properties.resourceGroup
|
|
string
|
Namn på platshållaren för resursgruppen som principen ska tilldelas till.
|
RoleAssignmentArtifact
Skissartefakt som tillämpar en rolltilldelning.
Name |
Obligatorisk |
Typ |
Description |
kind
|
True
|
string:
roleAssignment
|
Anger typen av skissartefakt.
|
properties.principalIds
|
True
|
|
Matris med användar- eller gruppidentiteter i Azure Active Directory. RoleDefinition gäller för varje identitet.
|
properties.roleDefinitionId
|
True
|
string
|
Azure-resurs-ID för RoleDefinition.
|
properties.dependsOn
|
|
string[]
|
Artefakter som måste distribueras före den angivna artefakten.
|
properties.description
|
|
string
maxLength: 500
|
Förklara den här resursen med flera rader.
|
properties.displayName
|
|
string
maxLength: 256
|
Enradssträng förklarar den här resursen.
|
properties.resourceGroup
|
|
string
|
RoleAssignment kommer att vara omfång för den här resourceGroup. Om den är tom omfångsbegränsas den till prenumerationen.
|
TemplateArtifact
Skissartefakt som distribuerar en Resource Manager-mall.
Name |
Obligatorisk |
Typ |
Description |
kind
|
True
|
string:
template
|
Anger typen av skissartefakt.
|
properties.parameters
|
True
|
<string,
ParameterValue>
|
Resource Manager-mallens parametervärden för skissartefakter.
|
properties.template
|
True
|
object
|
Resource Manager-mallens artefakttext för skissen.
|
properties.dependsOn
|
|
string[]
|
Artefakter som måste distribueras före den angivna artefakten.
|
properties.description
|
|
string
maxLength: 500
|
Förklara den här resursen med flera rader.
|
properties.displayName
|
|
string
maxLength: 256
|
Enradssträng förklarar den här resursen.
|
properties.resourceGroup
|
|
string
|
Om tillämpligt, namnet på platshållaren för resursgruppen som Resource Manager-mallens skissartefakt ska distribueras till.
|
Svar
Name |
Typ |
Description |
201 Created
|
Artifact:
|
Skapad – skissartefakt skapad/uppdaterad.
|
Other Status Codes
|
CloudError
|
Felsvar för skisser.
|
Säkerhet
azure_auth
Azure Active Directory OAuth2 Flow
Typ:
oauth2
Flow:
implicit
Auktoriseringswebbadress:
https://login.microsoftonline.com/common/oauth2/authorize
Omfattningar
Name |
Description |
user_impersonation
|
personifiera ditt användarkonto
|
Exempel
MG-ARMTemplateArtifact
Exempelbegäran
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')]"
}
}
}
}
package armblueprint_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/blueprint/armblueprint"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/ARMTemplateArtifact_Create.json
func ExampleArtifactsClient_CreateOrUpdate_mgArmTemplateArtifact() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armblueprint.NewClientFactory(cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
_, err = clientFactory.NewArtifactsClient().CreateOrUpdate(ctx, "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", "simpleBlueprint", "storageTemplate", &armblueprint.TemplateArtifact{
Kind: to.Ptr(armblueprint.ArtifactKindTemplate),
Properties: &armblueprint.TemplateArtifactProperties{
Parameters: map[string]*armblueprint.ParameterValue{
"storageAccountType": {
Value: "[parameters('storageAccountType')]",
},
},
ResourceGroup: to.Ptr("storageRG"),
Template: map[string]any{
"contentVersion": "1.0.0.0",
"outputs": map[string]any{
"storageAccountName": map[string]any{
"type": "string",
"value": "[variables('storageAccountName')]",
},
},
"parameters": map[string]any{
"storageAccountType": map[string]any{
"type": "string",
"allowedValues": []any{
"Standard_LRS",
"Standard_GRS",
"Standard_ZRS",
"Premium_LRS",
},
"defaultValue": "Standard_LRS",
"metadata": map[string]any{
"description": "Storage Account type",
},
},
},
"resources": []any{
map[string]any{
"name": "[variables('storageAccountName')]",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2016-01-01",
"kind": "Storage",
"location": "[resourceGroup().location]",
"properties": map[string]any{},
"sku": map[string]any{
"name": "[parameters('storageAccountType')]",
},
},
},
"variables": map[string]any{
"storageAccountName": "[concat(uniquestring(resourceGroup().id), 'standardsa')]",
},
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Blueprint.Models;
using Azure.ResourceManager.Blueprint;
// Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/ARMTemplateArtifact_Create.json
// this example is just showing the usage of "Artifacts_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this BlueprintResource created on azure
// for more information of creating BlueprintResource, please refer to the document of BlueprintResource
string resourceScope = "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup";
string blueprintName = "simpleBlueprint";
ResourceIdentifier blueprintResourceId = BlueprintResource.CreateResourceIdentifier(resourceScope, blueprintName);
BlueprintResource blueprint = client.GetBlueprintResource(blueprintResourceId);
// get the collection of this BlueprintArtifactResource
BlueprintArtifactCollection collection = blueprint.GetBlueprintArtifacts();
// invoke the operation
string artifactName = "storageTemplate";
ArtifactData data = new TemplateArtifact(BinaryData.FromObjectAsJson(new
{
contentVersion = "1.0.0.0",
outputs = new
{
storageAccountName = new
{
type = "string",
value = "[variables('storageAccountName')]",
},
},
parameters = new
{
storageAccountType = new
{
type = "string",
allowedValues = new object[]
{
"Standard_LRS",
"Standard_GRS",
"Standard_ZRS",
"Premium_LRS"
},
defaultValue = "Standard_LRS",
metadata = new
{
description = "Storage Account type",
},
},
},
resources = new object[]
{
new
{
name = "[variables('storageAccountName')]",
type = "Microsoft.Storage/storageAccounts",
apiVersion = "2016-01-01",
kind = "Storage",
location = "[resourceGroup().location]",
properties = new object(),
sku = new
{
name = "[parameters('storageAccountType')]",
},
}
},
variables = new
{
storageAccountName = "[concat(uniquestring(resourceGroup().id), 'standardsa')]",
},
}), new Dictionary<string, ParameterValue>
{
["storageAccountType"] = new ParameterValue
{
Value = BinaryData.FromObjectAsJson("[parameters('storageAccountType')]"),
}
})
{
ResourceGroup = "storageRG",
};
ArmOperation<BlueprintArtifactResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, artifactName, data);
BlueprintArtifactResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ArtifactData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"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
Exempelbegäran
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"
}
package armblueprint_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/blueprint/armblueprint"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/PolicyAssignmentArtifact_Create.json
func ExampleArtifactsClient_CreateOrUpdate_mgPolicyAssignmentArtifact() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armblueprint.NewClientFactory(cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
_, err = clientFactory.NewArtifactsClient().CreateOrUpdate(ctx, "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", "simpleBlueprint", "costCenterPolicy", &armblueprint.PolicyAssignmentArtifact{
Kind: to.Ptr(armblueprint.ArtifactKindPolicyAssignment),
Properties: &armblueprint.PolicyAssignmentArtifactProperties{
DisplayName: to.Ptr("force costCenter tag on all resources"),
Parameters: map[string]*armblueprint.ParameterValue{
"tagName": {
Value: "costCenter",
},
"tagValue": {
Value: "[parameter('costCenter')]",
},
},
PolicyDefinitionID: to.Ptr("/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Blueprint.Models;
using Azure.ResourceManager.Blueprint;
// Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/PolicyAssignmentArtifact_Create.json
// this example is just showing the usage of "Artifacts_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this BlueprintResource created on azure
// for more information of creating BlueprintResource, please refer to the document of BlueprintResource
string resourceScope = "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup";
string blueprintName = "simpleBlueprint";
ResourceIdentifier blueprintResourceId = BlueprintResource.CreateResourceIdentifier(resourceScope, blueprintName);
BlueprintResource blueprint = client.GetBlueprintResource(blueprintResourceId);
// get the collection of this BlueprintArtifactResource
BlueprintArtifactCollection collection = blueprint.GetBlueprintArtifacts();
// invoke the operation
string artifactName = "costCenterPolicy";
ArtifactData data = new PolicyAssignmentArtifact("/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62", new Dictionary<string, ParameterValue>
{
["tagName"] = new ParameterValue
{
Value = BinaryData.FromObjectAsJson("costCenter"),
},
["tagValue"] = new ParameterValue
{
Value = BinaryData.FromObjectAsJson("[parameter('costCenter')]"),
}
})
{
DisplayName = "force costCenter tag on all resources",
};
ArmOperation<BlueprintArtifactResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, artifactName, data);
BlueprintArtifactResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ArtifactData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"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
Exempelbegäran
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"
}
package armblueprint_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/blueprint/armblueprint"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/RoleAssignmentArtifact_Create.json
func ExampleArtifactsClient_CreateOrUpdate_mgRoleAssignmentArtifact() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armblueprint.NewClientFactory(cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
_, err = clientFactory.NewArtifactsClient().CreateOrUpdate(ctx, "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", "simpleBlueprint", "ownerAssignment", &armblueprint.RoleAssignmentArtifact{
Kind: to.Ptr(armblueprint.ArtifactKindRoleAssignment),
Properties: &armblueprint.RoleAssignmentArtifactProperties{
DisplayName: to.Ptr("enforce owners of given subscription"),
PrincipalIDs: "[parameters('owners')]",
RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Blueprint.Models;
using Azure.ResourceManager.Blueprint;
// Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/RoleAssignmentArtifact_Create.json
// this example is just showing the usage of "Artifacts_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this BlueprintResource created on azure
// for more information of creating BlueprintResource, please refer to the document of BlueprintResource
string resourceScope = "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup";
string blueprintName = "simpleBlueprint";
ResourceIdentifier blueprintResourceId = BlueprintResource.CreateResourceIdentifier(resourceScope, blueprintName);
BlueprintResource blueprint = client.GetBlueprintResource(blueprintResourceId);
// get the collection of this BlueprintArtifactResource
BlueprintArtifactCollection collection = blueprint.GetBlueprintArtifacts();
// invoke the operation
string artifactName = "ownerAssignment";
ArtifactData data = new RoleAssignmentArtifact("/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7", BinaryData.FromObjectAsJson("[parameters('owners')]"))
{
DisplayName = "enforce owners of given subscription",
};
ArmOperation<BlueprintArtifactResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, artifactName, data);
BlueprintArtifactResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ArtifactData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"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
Exempelbegäran
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')]"
}
}
}
}
package armblueprint_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/blueprint/armblueprint"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/ARMTemplateArtifact_Create.json
func ExampleArtifactsClient_CreateOrUpdate_subArmTemplateArtifact() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armblueprint.NewClientFactory(cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
_, err = clientFactory.NewArtifactsClient().CreateOrUpdate(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "simpleBlueprint", "storageTemplate", &armblueprint.TemplateArtifact{
Kind: to.Ptr(armblueprint.ArtifactKindTemplate),
Properties: &armblueprint.TemplateArtifactProperties{
Parameters: map[string]*armblueprint.ParameterValue{
"storageAccountType": {
Value: "[parameters('storageAccountType')]",
},
},
ResourceGroup: to.Ptr("storageRG"),
Template: map[string]any{
"contentVersion": "1.0.0.0",
"outputs": map[string]any{
"storageAccountName": map[string]any{
"type": "string",
"value": "[variables('storageAccountName')]",
},
},
"parameters": map[string]any{
"storageAccountType": map[string]any{
"type": "string",
"allowedValues": []any{
"Standard_LRS",
"Standard_GRS",
"Standard_ZRS",
"Premium_LRS",
},
"defaultValue": "Standard_LRS",
"metadata": map[string]any{
"description": "Storage Account type",
},
},
},
"resources": []any{
map[string]any{
"name": "[variables('storageAccountName')]",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2016-01-01",
"kind": "Storage",
"location": "[resourceGroup().location]",
"properties": map[string]any{},
"sku": map[string]any{
"name": "[parameters('storageAccountType')]",
},
},
},
"variables": map[string]any{
"storageAccountName": "[concat(uniquestring(resourceGroup().id), 'standardsa')]",
},
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Blueprint.Models;
using Azure.ResourceManager.Blueprint;
// Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/ARMTemplateArtifact_Create.json
// this example is just showing the usage of "Artifacts_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this BlueprintResource created on azure
// for more information of creating BlueprintResource, please refer to the document of BlueprintResource
string resourceScope = "subscriptions/00000000-0000-0000-0000-000000000000";
string blueprintName = "simpleBlueprint";
ResourceIdentifier blueprintResourceId = BlueprintResource.CreateResourceIdentifier(resourceScope, blueprintName);
BlueprintResource blueprint = client.GetBlueprintResource(blueprintResourceId);
// get the collection of this BlueprintArtifactResource
BlueprintArtifactCollection collection = blueprint.GetBlueprintArtifacts();
// invoke the operation
string artifactName = "storageTemplate";
ArtifactData data = new TemplateArtifact(BinaryData.FromObjectAsJson(new
{
contentVersion = "1.0.0.0",
outputs = new
{
storageAccountName = new
{
type = "string",
value = "[variables('storageAccountName')]",
},
},
parameters = new
{
storageAccountType = new
{
type = "string",
allowedValues = new object[]
{
"Standard_LRS",
"Standard_GRS",
"Standard_ZRS",
"Premium_LRS"
},
defaultValue = "Standard_LRS",
metadata = new
{
description = "Storage Account type",
},
},
},
resources = new object[]
{
new
{
name = "[variables('storageAccountName')]",
type = "Microsoft.Storage/storageAccounts",
apiVersion = "2016-01-01",
kind = "Storage",
location = "[resourceGroup().location]",
properties = new object(),
sku = new
{
name = "[parameters('storageAccountType')]",
},
}
},
variables = new
{
storageAccountName = "[concat(uniquestring(resourceGroup().id), 'standardsa')]",
},
}), new Dictionary<string, ParameterValue>
{
["storageAccountType"] = new ParameterValue
{
Value = BinaryData.FromObjectAsJson("[parameters('storageAccountType')]"),
}
})
{
ResourceGroup = "storageRG",
};
ArmOperation<BlueprintArtifactResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, artifactName, data);
BlueprintArtifactResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ArtifactData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"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
Exempelbegäran
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"
}
package armblueprint_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/blueprint/armblueprint"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/PolicyAssignmentArtifact_Create.json
func ExampleArtifactsClient_CreateOrUpdate_subPolicyAssignmentArtifact() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armblueprint.NewClientFactory(cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
_, err = clientFactory.NewArtifactsClient().CreateOrUpdate(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "simpleBlueprint", "costCenterPolicy", &armblueprint.PolicyAssignmentArtifact{
Kind: to.Ptr(armblueprint.ArtifactKindPolicyAssignment),
Properties: &armblueprint.PolicyAssignmentArtifactProperties{
DisplayName: to.Ptr("force costCenter tag on all resources"),
Parameters: map[string]*armblueprint.ParameterValue{
"tagName": {
Value: "costCenter",
},
"tagValue": {
Value: "[parameter('costCenter')]",
},
},
PolicyDefinitionID: to.Ptr("/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Blueprint.Models;
using Azure.ResourceManager.Blueprint;
// Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/PolicyAssignmentArtifact_Create.json
// this example is just showing the usage of "Artifacts_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this BlueprintResource created on azure
// for more information of creating BlueprintResource, please refer to the document of BlueprintResource
string resourceScope = "subscriptions/00000000-0000-0000-0000-000000000000";
string blueprintName = "simpleBlueprint";
ResourceIdentifier blueprintResourceId = BlueprintResource.CreateResourceIdentifier(resourceScope, blueprintName);
BlueprintResource blueprint = client.GetBlueprintResource(blueprintResourceId);
// get the collection of this BlueprintArtifactResource
BlueprintArtifactCollection collection = blueprint.GetBlueprintArtifacts();
// invoke the operation
string artifactName = "costCenterPolicy";
ArtifactData data = new PolicyAssignmentArtifact("/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62", new Dictionary<string, ParameterValue>
{
["tagName"] = new ParameterValue
{
Value = BinaryData.FromObjectAsJson("costCenter"),
},
["tagValue"] = new ParameterValue
{
Value = BinaryData.FromObjectAsJson("[parameter('costCenter')]"),
}
})
{
DisplayName = "force costCenter tag on all resources",
};
ArmOperation<BlueprintArtifactResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, artifactName, data);
BlueprintArtifactResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ArtifactData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"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
Exempelbegäran
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"
}
package armblueprint_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/blueprint/armblueprint"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/RoleAssignmentArtifact_Create.json
func ExampleArtifactsClient_CreateOrUpdate_subRoleAssignmentArtifact() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armblueprint.NewClientFactory(cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
_, err = clientFactory.NewArtifactsClient().CreateOrUpdate(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "simpleBlueprint", "ownerAssignment", &armblueprint.RoleAssignmentArtifact{
Kind: to.Ptr(armblueprint.ArtifactKindRoleAssignment),
Properties: &armblueprint.RoleAssignmentArtifactProperties{
DisplayName: to.Ptr("enforce owners of given subscription"),
PrincipalIDs: "[parameters('owners')]",
RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Blueprint.Models;
using Azure.ResourceManager.Blueprint;
// Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/RoleAssignmentArtifact_Create.json
// this example is just showing the usage of "Artifacts_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this BlueprintResource created on azure
// for more information of creating BlueprintResource, please refer to the document of BlueprintResource
string resourceScope = "subscriptions/00000000-0000-0000-0000-000000000000";
string blueprintName = "simpleBlueprint";
ResourceIdentifier blueprintResourceId = BlueprintResource.CreateResourceIdentifier(resourceScope, blueprintName);
BlueprintResource blueprint = client.GetBlueprintResource(blueprintResourceId);
// get the collection of this BlueprintArtifactResource
BlueprintArtifactCollection collection = blueprint.GetBlueprintArtifacts();
// invoke the operation
string artifactName = "ownerAssignment";
ArtifactData data = new RoleAssignmentArtifact("/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7", BinaryData.FromObjectAsJson("[parameters('owners')]"))
{
DisplayName = "enforce owners of given subscription",
};
ArmOperation<BlueprintArtifactResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, artifactName, data);
BlueprintArtifactResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ArtifactData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"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"
}
Definitioner
CloudError
Objekt
Name |
Typ |
Description |
error
|
ErrorResponse
|
Felsvar
Vanligt felsvar för alla Azure Resource Manager-API:er för att returnera felinformation för misslyckade åtgärder. (Detta följer även formatet för OData-felsvar.)
|
ErrorAdditionalInfo
Objekt
Ytterligare information om resurshanteringsfelet.
Name |
Typ |
Description |
info
|
object
|
Ytterligare information.
|
type
|
string
|
Ytterligare informationstyp.
|
ErrorResponse
Objekt
Felsvar
Name |
Typ |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
Ytterligare information om felet.
|
code
|
string
|
Felkoden.
|
details
|
ErrorResponse[]
|
Felinformationen.
|
message
|
string
|
Felmeddelandet.
|
target
|
string
|
Felmålet.
|
keyVaultReference
Objekt
Anger länken till ett Nyckelvalv.
Name |
Typ |
Description |
id
|
string
|
Azure-resurs-ID för Key Vault.
|
ParameterValue
Objekt
Värde för den angivna parametern. Kan vara antingen "värde" eller "referens", men inte båda.
Name |
Typ |
Description |
reference
|
SecretValueReference
|
Parametervärde som referenstyp.
|
value
|
object
|
Parametervärde. Alla giltiga JSON-värden tillåts, inklusive objekt, matriser, strängar, tal och booleska värden.
|
PolicyAssignmentArtifact
Objekt
Skissartefakt som tillämpar en principtilldelning.
Name |
Typ |
Description |
id
|
string
|
Sträng-ID som används för att hitta en resurs i Azure.
|
kind
|
string:
policyAssignment
|
Anger typen av skissartefakt.
|
name
|
string
|
Namnet på den här resursen.
|
properties.dependsOn
|
string[]
|
Artefakter som måste distribueras före den angivna artefakten.
|
properties.description
|
string
maxLength: 500
|
Förklara den här resursen med flera rader.
|
properties.displayName
|
string
maxLength: 256
|
Enradssträng förklarar den här resursen.
|
properties.parameters
|
<string,
ParameterValue>
|
Parametervärden för principdefinitionen.
|
properties.policyDefinitionId
|
string
|
Azure-resurs-ID för principdefinitionen.
|
properties.resourceGroup
|
string
|
Namn på platshållaren för resursgruppen som principen ska tilldelas till.
|
type
|
string
|
Typ av resurs.
|
RoleAssignmentArtifact
Objekt
Skissartefakt som tillämpar en rolltilldelning.
Name |
Typ |
Description |
id
|
string
|
Sträng-ID som används för att hitta en resurs i Azure.
|
kind
|
string:
roleAssignment
|
Anger typen av skissartefakt.
|
name
|
string
|
Namnet på den här resursen.
|
properties.dependsOn
|
string[]
|
Artefakter som måste distribueras före den angivna artefakten.
|
properties.description
|
string
maxLength: 500
|
Förklara den här resursen med flera rader.
|
properties.displayName
|
string
maxLength: 256
|
Enradssträng förklarar den här resursen.
|
properties.principalIds
|
|
Matris med användar- eller gruppidentiteter i Azure Active Directory. RoleDefinition gäller för varje identitet.
|
properties.resourceGroup
|
string
|
RoleAssignment kommer att vara omfång för den här resourceGroup. Om den är tom omfångsbegränsas den till prenumerationen.
|
properties.roleDefinitionId
|
string
|
Azure-resurs-ID för RoleDefinition.
|
type
|
string
|
Typ av resurs.
|
SecretValueReference
Objekt
Referens till en Key Vault-hemlighet.
Name |
Typ |
Description |
keyVault
|
keyVaultReference
|
Anger referensen till ett visst Azure Key Vault.
|
secretName
|
string
|
Namnet på hemligheten.
|
secretVersion
|
string
|
Den version av hemligheten som ska användas. Om den lämnas tom används den senaste versionen av hemligheten.
|
TemplateArtifact
Objekt
Skissartefakt som distribuerar en Resource Manager-mall.
Name |
Typ |
Description |
id
|
string
|
Sträng-ID som används för att hitta en resurs i Azure.
|
kind
|
string:
template
|
Anger typen av skissartefakt.
|
name
|
string
|
Namnet på den här resursen.
|
properties.dependsOn
|
string[]
|
Artefakter som måste distribueras före den angivna artefakten.
|
properties.description
|
string
maxLength: 500
|
Förklara den här resursen med flera rader.
|
properties.displayName
|
string
maxLength: 256
|
Enradssträng förklarar den här resursen.
|
properties.parameters
|
<string,
ParameterValue>
|
Resource Manager-mallens parametervärden för skissartefakter.
|
properties.resourceGroup
|
string
|
Om tillämpligt, namnet på platshållaren för resursgruppen som Resource Manager-mallens skissartefakt ska distribueras till.
|
properties.template
|
object
|
Resource Manager-mallens artefakttext för skissen.
|
type
|
string
|
Typ av resurs.
|