Get a blueprint artifact.
GET 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.
|
Responses
Name |
Type |
Description |
200 OK
|
Artifact:
|
OK -- blueprint artifact retrieved.
|
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
Sample Request
GET https://management.azure.com/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/storageTemplate?api-version=2018-11-01-preview
package armblueprint_test
import (
"context"
"log"
"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_Get.json
func ExampleArtifactsClient_Get_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)
}
res, err := clientFactory.NewArtifactsClient().Get(ctx, "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", "simpleBlueprint", "storageTemplate", nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armblueprint.ArtifactsClientGetResponse{
// ArtifactClassification: &armblueprint.TemplateArtifact{
// Name: to.Ptr("storageTemplate"),
// Type: to.Ptr("Microsoft.Blueprint/blueprints/artifacts"),
// ID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/storageTemplate"),
// Kind: to.Ptr(armblueprint.ArtifactKindTemplate),
// Properties: &armblueprint.TemplateArtifactProperties{
// Parameters: map[string]*armblueprint.ParameterValue{
// "storageAccountType": &armblueprint.ParameterValue{
// 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')]",
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Blueprint;
using Azure.ResourceManager.Blueprint.Models;
// Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/ARMTemplateArtifact_Get.json
// this example is just showing the usage of "Artifacts_Get" 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";
NullableResponse<BlueprintArtifactResource> response = await collection.GetIfExistsAsync(artifactName);
BlueprintArtifactResource result = response.HasValue ? response.Value : null;
if (result == null)
{
Console.WriteLine($"Succeeded with null as result");
}
else
{
// 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
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
GET https://management.azure.com/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/costCenterPolicy?api-version=2018-11-01-preview
package armblueprint_test
import (
"context"
"log"
"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_Get.json
func ExampleArtifactsClient_Get_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)
}
res, err := clientFactory.NewArtifactsClient().Get(ctx, "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", "simpleBlueprint", "costCenterPolicy", nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armblueprint.ArtifactsClientGetResponse{
// ArtifactClassification: &armblueprint.PolicyAssignmentArtifact{
// Name: to.Ptr("costCenterPolicy"),
// Type: to.Ptr("Microsoft.Blueprint/blueprints/artifacts"),
// ID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/costCenterPolicy"),
// Kind: to.Ptr(armblueprint.ArtifactKindPolicyAssignment),
// Properties: &armblueprint.PolicyAssignmentArtifactProperties{
// DisplayName: to.Ptr("force costCenter tag on all resources"),
// Parameters: map[string]*armblueprint.ParameterValue{
// "tagName": &armblueprint.ParameterValue{
// Value: "costCenter",
// },
// "tagValue": &armblueprint.ParameterValue{
// Value: "[parameter('costCenter')]",
// },
// },
// PolicyDefinitionID: to.Ptr("/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Blueprint;
using Azure.ResourceManager.Blueprint.Models;
// Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/PolicyAssignmentArtifact_Get.json
// this example is just showing the usage of "Artifacts_Get" 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";
NullableResponse<BlueprintArtifactResource> response = await collection.GetIfExistsAsync(artifactName);
BlueprintArtifactResource result = response.HasValue ? response.Value : null;
if (result == null)
{
Console.WriteLine($"Succeeded with null as result");
}
else
{
// 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
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
GET https://management.azure.com/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/ownerAssignment?api-version=2018-11-01-preview
package armblueprint_test
import (
"context"
"log"
"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_Get.json
func ExampleArtifactsClient_Get_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)
}
res, err := clientFactory.NewArtifactsClient().Get(ctx, "providers/Microsoft.Management/managementGroups/ContosoOnlineGroup", "simpleBlueprint", "ownerAssignment", nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armblueprint.ArtifactsClientGetResponse{
// ArtifactClassification: &armblueprint.RoleAssignmentArtifact{
// Name: to.Ptr("ownerAssignment"),
// Type: to.Ptr("Microsoft.Blueprint/blueprints/artifacts"),
// ID: to.Ptr("/providers/Microsoft.Management/managementGroups/ContosoOnlineGroup/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/ownerAssignment"),
// 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"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Blueprint;
using Azure.ResourceManager.Blueprint.Models;
// Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/managementGroupBPDef/RoleAssignmentArtifact_Get.json
// this example is just showing the usage of "Artifacts_Get" 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";
NullableResponse<BlueprintArtifactResource> response = await collection.GetIfExistsAsync(artifactName);
BlueprintArtifactResource result = response.HasValue ? response.Value : null;
if (result == null)
{
Console.WriteLine($"Succeeded with null as result");
}
else
{
// 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
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
GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/storageTemplate?api-version=2018-11-01-preview
package armblueprint_test
import (
"context"
"log"
"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_Get.json
func ExampleArtifactsClient_Get_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)
}
res, err := clientFactory.NewArtifactsClient().Get(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "simpleBlueprint", "storageTemplate", nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armblueprint.ArtifactsClientGetResponse{
// ArtifactClassification: &armblueprint.TemplateArtifact{
// Name: to.Ptr("storageTemplate"),
// Type: to.Ptr("Microsoft.Blueprint/blueprints/artifacts"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/storageTemplate"),
// Kind: to.Ptr(armblueprint.ArtifactKindTemplate),
// Properties: &armblueprint.TemplateArtifactProperties{
// Parameters: map[string]*armblueprint.ParameterValue{
// "storageAccountType": &armblueprint.ParameterValue{
// 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')]",
// },
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Blueprint;
using Azure.ResourceManager.Blueprint.Models;
// Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/ARMTemplateArtifact_Get.json
// this example is just showing the usage of "Artifacts_Get" 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";
NullableResponse<BlueprintArtifactResource> response = await collection.GetIfExistsAsync(artifactName);
BlueprintArtifactResource result = response.HasValue ? response.Value : null;
if (result == null)
{
Console.WriteLine($"Succeeded with null as result");
}
else
{
// 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
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
GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/costCenterPolicy?api-version=2018-11-01-preview
package armblueprint_test
import (
"context"
"log"
"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_Get.json
func ExampleArtifactsClient_Get_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)
}
res, err := clientFactory.NewArtifactsClient().Get(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "simpleBlueprint", "costCenterPolicy", nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armblueprint.ArtifactsClientGetResponse{
// ArtifactClassification: &armblueprint.PolicyAssignmentArtifact{
// Name: to.Ptr("costCenterPolicy"),
// Type: to.Ptr("Microsoft.Blueprint/blueprints/artifacts"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/costCenterPolicy"),
// Kind: to.Ptr(armblueprint.ArtifactKindPolicyAssignment),
// Properties: &armblueprint.PolicyAssignmentArtifactProperties{
// DisplayName: to.Ptr("force costCenter tag on all resources"),
// Parameters: map[string]*armblueprint.ParameterValue{
// "tagName": &armblueprint.ParameterValue{
// Value: "costCenter",
// },
// "tagValue": &armblueprint.ParameterValue{
// Value: "[parameter('costCenter')]",
// },
// },
// PolicyDefinitionID: to.Ptr("/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Blueprint;
using Azure.ResourceManager.Blueprint.Models;
// Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/PolicyAssignmentArtifact_Get.json
// this example is just showing the usage of "Artifacts_Get" 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";
NullableResponse<BlueprintArtifactResource> response = await collection.GetIfExistsAsync(artifactName);
BlueprintArtifactResource result = response.HasValue ? response.Value : null;
if (result == null)
{
Console.WriteLine($"Succeeded with null as result");
}
else
{
// 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
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
GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/ownerAssignment?api-version=2018-11-01-preview
package armblueprint_test
import (
"context"
"log"
"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_Get.json
func ExampleArtifactsClient_Get_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)
}
res, err := clientFactory.NewArtifactsClient().Get(ctx, "subscriptions/00000000-0000-0000-0000-000000000000", "simpleBlueprint", "ownerAssignment", nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armblueprint.ArtifactsClientGetResponse{
// ArtifactClassification: &armblueprint.RoleAssignmentArtifact{
// Name: to.Ptr("ownerAssignment"),
// Type: to.Ptr("Microsoft.Blueprint/blueprints/artifacts"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprints/simpleBlueprint/artifacts/ownerAssignment"),
// 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"),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Blueprint;
using Azure.ResourceManager.Blueprint.Models;
// Generated from example definition: specification/blueprint/resource-manager/Microsoft.Blueprint/preview/2018-11-01-preview/examples/subscriptionBPDef/RoleAssignmentArtifact_Get.json
// this example is just showing the usage of "Artifacts_Get" 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";
NullableResponse<BlueprintArtifactResource> response = await collection.GetIfExistsAsync(artifactName);
BlueprintArtifactResource result = response.HasValue ? response.Value : null;
if (result == null)
{
Console.WriteLine($"Succeeded with null as result");
}
else
{
// 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
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
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.
|