Assignment

class Assignment : KotlinCustomResource

Manages a Blueprint Assignment resource

NOTE: Azure Blueprints are in Preview and potentially subject to breaking change without notice. NOTE: Azure Blueprint Assignments can only be applied to Subscriptions. Assignments to Management Groups is not currently supported by the service or by this provider.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.CoreFunctions;
import com.pulumi.azure.core.inputs.GetSubscriptionArgs;
import com.pulumi.azure.blueprint.BlueprintFunctions;
import com.pulumi.azure.blueprint.inputs.GetDefinitionArgs;
import com.pulumi.azure.blueprint.inputs.GetPublishedVersionArgs;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.authorization.UserAssignedIdentity;
import com.pulumi.azure.authorization.UserAssignedIdentityArgs;
import com.pulumi.azure.authorization.Assignment;
import com.pulumi.azure.authorization.AssignmentArgs;
import com.pulumi.azure.blueprint.Assignment;
import com.pulumi.azure.blueprint.AssignmentArgs;
import com.pulumi.azure.blueprint.inputs.AssignmentIdentityArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var current = CoreFunctions.getClientConfig();
final var exampleSubscription = CoreFunctions.getSubscription();
final var exampleDefinition = BlueprintFunctions.getDefinition(GetDefinitionArgs.builder()
.name("exampleBlueprint")
.scopeId(exampleSubscription.applyValue(getSubscriptionResult -> getSubscriptionResult.id()))
.build());
final var examplePublishedVersion = BlueprintFunctions.getPublishedVersion(GetPublishedVersionArgs.builder()
.scopeId(exampleDefinition.applyValue(getDefinitionResult -> getDefinitionResult.scopeId()))
.blueprintName(exampleDefinition.applyValue(getDefinitionResult -> getDefinitionResult.name()))
.version("v1.0.0")
.build());
var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
.location("West Europe")
.tags(Map.of("Environment", "example"))
.build());
var exampleUserAssignedIdentity = new UserAssignedIdentity("exampleUserAssignedIdentity", UserAssignedIdentityArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.location(exampleResourceGroup.location())
.build());
var operator = new Assignment("operator", AssignmentArgs.builder()
.scope(exampleSubscription.applyValue(getSubscriptionResult -> getSubscriptionResult.id()))
.roleDefinitionName("Blueprint Operator")
.principalId(exampleUserAssignedIdentity.principalId())
.build());
var owner = new Assignment("owner", AssignmentArgs.builder()
.scope(exampleSubscription.applyValue(getSubscriptionResult -> getSubscriptionResult.id()))
.roleDefinitionName("Owner")
.principalId(exampleUserAssignedIdentity.principalId())
.build());
var exampleAssignment = new Assignment("exampleAssignment", AssignmentArgs.builder()
.targetSubscriptionId(exampleSubscription.applyValue(getSubscriptionResult -> getSubscriptionResult.id()))
.versionId(examplePublishedVersion.applyValue(getPublishedVersionResult -> getPublishedVersionResult.id()))
.location(exampleResourceGroup.location())
.lockMode("AllResourcesDoNotDelete")
.lockExcludePrincipals(current.applyValue(getClientConfigResult -> getClientConfigResult.objectId()))
.identity(AssignmentIdentityArgs.builder()
.type("UserAssigned")
.identityIds(exampleUserAssignedIdentity.id())
.build())
.resourceGroups("""
{
"ResourceGroup": {
"name": "exampleRG-bp"
}
}
""")
.parameterValues("""
{
"allowedlocationsforresourcegroups_listOfAllowedLocations": {
"value": ["westus", "westus2", "eastus", "centralus", "centraluseuap", "southcentralus", "northcentralus", "westcentralus", "eastus2", "eastus2euap", "brazilsouth", "brazilus", "northeurope", "westeurope", "eastasia", "southeastasia", "japanwest", "japaneast", "koreacentral", "koreasouth", "indiasouth", "indiawest", "indiacentral", "australiaeast", "australiasoutheast", "canadacentral", "canadaeast", "uknorth", "uksouth2", "uksouth", "ukwest", "francecentral", "francesouth", "australiacentral", "australiacentral2", "uaecentral", "uaenorth", "southafricanorth", "southafricawest", "switzerlandnorth", "switzerlandwest", "germanynorth", "germanywestcentral", "norwayeast", "norwaywest"]
}
}
""")
.build(), CustomResourceOptions.builder()
.dependsOn(
operator,
owner)
.build());
}
}

Import

Azure Blueprint Assignments can be imported using the resource id, e.g.

$ pulumi import azure:blueprint/assignment:Assignment example "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Blueprint/blueprintAssignments/assignSimpleBlueprint"

Properties

Link copied to clipboard
val blueprintName: Output<String>

The name of the blueprint assigned

Link copied to clipboard
val description: Output<String>

The Description on the Blueprint

Link copied to clipboard
val displayName: Output<String>

The display name of the blueprint

Link copied to clipboard
val id: Output<String>
Link copied to clipboard

An identity block as defined below.

Link copied to clipboard
val location: Output<String>

The Azure location of the Assignment. Changing this forces a new resource to be created.

Link copied to clipboard

a list of up to 200 actions that are permitted to bypass the locks applied by the Blueprint.

Link copied to clipboard

a list of up to 5 Principal IDs that are permitted to bypass the locks applied by the Blueprint.

Link copied to clipboard
val lockMode: Output<String>?

The locking mode of the Blueprint Assignment. One of None (Default), AllResourcesReadOnly, or AllResourcesDoNotDelete. Defaults to none.

Link copied to clipboard
val name: Output<String>

The name of the Blueprint Assignment. Changing this forces a new resource to be created.

Link copied to clipboard
val parameterValues: Output<String>?

a JSON string to supply Blueprint Assignment parameter values.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val resourceGroups: Output<String>?

a JSON string to supply the Blueprint Resource Group information.

Link copied to clipboard

The Subscription ID the Blueprint Published Version is to be applied to. Changing this forces a new resource to be created.

Link copied to clipboard
val type: Output<String>

Specifies the type of Managed Service Identity that should be configured on this Blueprint. Possible values are SystemAssigned and UserAssigned.

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val versionId: Output<String>

The ID of the Published Version of the blueprint to be assigned.