1. Packages
  2. Azure Classic
  3. API Docs
  4. marketplace
  5. RoleAssignment

We recommend using Azure Native.

Azure v6.23.0 published on Thursday, May 22, 2025 by Pulumi

azure.marketplace.RoleAssignment

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure v6.23.0 published on Thursday, May 22, 2025 by Pulumi

    Assigns a given Principal (User or Group) to a given Role in a Private Azure Marketplace.

    Example Usage

    Using A Role Definition Name)

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const example = azure.core.getClientConfig({});
    const exampleRoleAssignment = new azure.marketplace.RoleAssignment("example", {
        roleDefinitionName: "Marketplace Admin",
        principalId: example.then(example => example.objectId),
    });
    
    import pulumi
    import pulumi_azure as azure
    
    example = azure.core.get_client_config()
    example_role_assignment = azure.marketplace.RoleAssignment("example",
        role_definition_name="Marketplace Admin",
        principal_id=example.object_id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/marketplace"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := core.GetClientConfig(ctx, map[string]interface{}{}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = marketplace.NewRoleAssignment(ctx, "example", &marketplace.RoleAssignmentArgs{
    			RoleDefinitionName: pulumi.String("Marketplace Admin"),
    			PrincipalId:        pulumi.String(example.ObjectId),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Azure.Core.GetClientConfig.Invoke();
    
        var exampleRoleAssignment = new Azure.Marketplace.RoleAssignment("example", new()
        {
            RoleDefinitionName = "Marketplace Admin",
            PrincipalId = example.Apply(getClientConfigResult => getClientConfigResult.ObjectId),
        });
    
    });
    
    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.marketplace.RoleAssignment;
    import com.pulumi.azure.marketplace.RoleAssignmentArgs;
    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 example = CoreFunctions.getClientConfig(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference);
    
            var exampleRoleAssignment = new RoleAssignment("exampleRoleAssignment", RoleAssignmentArgs.builder()
                .roleDefinitionName("Marketplace Admin")
                .principalId(example.objectId())
                .build());
    
        }
    }
    
    resources:
      exampleRoleAssignment:
        type: azure:marketplace:RoleAssignment
        name: example
        properties:
          roleDefinitionName: Marketplace Admin
          principalId: ${example.objectId}
    variables:
      example:
        fn::invoke:
          function: azure:core:getClientConfig
          arguments: {}
    

    Using A Role Definition ID)

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const example = azure.core.getClientConfig({});
    const exampleGetRoleDefinition = azure.authorization.getRoleDefinition({
        name: "Log Analytics Reader",
    });
    const exampleRoleAssignment = new azure.marketplace.RoleAssignment("example", {
        roleDefinitionId: exampleGetRoleDefinition.then(exampleGetRoleDefinition => exampleGetRoleDefinition.id),
        principalId: example.then(example => example.objectId),
    });
    
    import pulumi
    import pulumi_azure as azure
    
    example = azure.core.get_client_config()
    example_get_role_definition = azure.authorization.get_role_definition(name="Log Analytics Reader")
    example_role_assignment = azure.marketplace.RoleAssignment("example",
        role_definition_id=example_get_role_definition.id,
        principal_id=example.object_id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/authorization"
    	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/marketplace"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := core.GetClientConfig(ctx, map[string]interface{}{}, nil)
    		if err != nil {
    			return err
    		}
    		exampleGetRoleDefinition, err := authorization.LookupRoleDefinition(ctx, &authorization.LookupRoleDefinitionArgs{
    			Name: pulumi.StringRef("Log Analytics Reader"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = marketplace.NewRoleAssignment(ctx, "example", &marketplace.RoleAssignmentArgs{
    			RoleDefinitionId: pulumi.String(exampleGetRoleDefinition.Id),
    			PrincipalId:      pulumi.String(example.ObjectId),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Azure.Core.GetClientConfig.Invoke();
    
        var exampleGetRoleDefinition = Azure.Authorization.GetRoleDefinition.Invoke(new()
        {
            Name = "Log Analytics Reader",
        });
    
        var exampleRoleAssignment = new Azure.Marketplace.RoleAssignment("example", new()
        {
            RoleDefinitionId = exampleGetRoleDefinition.Apply(getRoleDefinitionResult => getRoleDefinitionResult.Id),
            PrincipalId = example.Apply(getClientConfigResult => getClientConfigResult.ObjectId),
        });
    
    });
    
    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.authorization.AuthorizationFunctions;
    import com.pulumi.azure.authorization.inputs.GetRoleDefinitionArgs;
    import com.pulumi.azure.marketplace.RoleAssignment;
    import com.pulumi.azure.marketplace.RoleAssignmentArgs;
    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 example = CoreFunctions.getClientConfig(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference);
    
            final var exampleGetRoleDefinition = AuthorizationFunctions.getRoleDefinition(GetRoleDefinitionArgs.builder()
                .name("Log Analytics Reader")
                .build());
    
            var exampleRoleAssignment = new RoleAssignment("exampleRoleAssignment", RoleAssignmentArgs.builder()
                .roleDefinitionId(exampleGetRoleDefinition.id())
                .principalId(example.objectId())
                .build());
    
        }
    }
    
    resources:
      exampleRoleAssignment:
        type: azure:marketplace:RoleAssignment
        name: example
        properties:
          roleDefinitionId: ${exampleGetRoleDefinition.id}
          principalId: ${example.objectId}
    variables:
      example:
        fn::invoke:
          function: azure:core:getClientConfig
          arguments: {}
      exampleGetRoleDefinition:
        fn::invoke:
          function: azure:authorization:getRoleDefinition
          arguments:
            name: Log Analytics Reader
    

    API Providers

    This resource uses the following Azure API Providers:

    • Microsoft.Authorization: 2022-05-01-preview, 2022-04-01

    Create RoleAssignment Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new RoleAssignment(name: string, args: RoleAssignmentArgs, opts?: CustomResourceOptions);
    @overload
    def RoleAssignment(resource_name: str,
                       args: RoleAssignmentArgs,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def RoleAssignment(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       principal_id: Optional[str] = None,
                       condition: Optional[str] = None,
                       condition_version: Optional[str] = None,
                       delegated_managed_identity_resource_id: Optional[str] = None,
                       description: Optional[str] = None,
                       name: Optional[str] = None,
                       role_definition_id: Optional[str] = None,
                       role_definition_name: Optional[str] = None,
                       skip_service_principal_aad_check: Optional[bool] = None)
    func NewRoleAssignment(ctx *Context, name string, args RoleAssignmentArgs, opts ...ResourceOption) (*RoleAssignment, error)
    public RoleAssignment(string name, RoleAssignmentArgs args, CustomResourceOptions? opts = null)
    public RoleAssignment(String name, RoleAssignmentArgs args)
    public RoleAssignment(String name, RoleAssignmentArgs args, CustomResourceOptions options)
    
    type: azure:marketplace:RoleAssignment
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args RoleAssignmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args RoleAssignmentArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args RoleAssignmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RoleAssignmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RoleAssignmentArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var roleAssignmentResource = new Azure.Marketplace.RoleAssignment("roleAssignmentResource", new()
    {
        PrincipalId = "string",
        Condition = "string",
        ConditionVersion = "string",
        DelegatedManagedIdentityResourceId = "string",
        Description = "string",
        Name = "string",
        RoleDefinitionId = "string",
        RoleDefinitionName = "string",
        SkipServicePrincipalAadCheck = false,
    });
    
    example, err := marketplace.NewRoleAssignment(ctx, "roleAssignmentResource", &marketplace.RoleAssignmentArgs{
    	PrincipalId:                        pulumi.String("string"),
    	Condition:                          pulumi.String("string"),
    	ConditionVersion:                   pulumi.String("string"),
    	DelegatedManagedIdentityResourceId: pulumi.String("string"),
    	Description:                        pulumi.String("string"),
    	Name:                               pulumi.String("string"),
    	RoleDefinitionId:                   pulumi.String("string"),
    	RoleDefinitionName:                 pulumi.String("string"),
    	SkipServicePrincipalAadCheck:       pulumi.Bool(false),
    })
    
    var roleAssignmentResource = new com.pulumi.azure.marketplace.RoleAssignment("roleAssignmentResource", com.pulumi.azure.marketplace.RoleAssignmentArgs.builder()
        .principalId("string")
        .condition("string")
        .conditionVersion("string")
        .delegatedManagedIdentityResourceId("string")
        .description("string")
        .name("string")
        .roleDefinitionId("string")
        .roleDefinitionName("string")
        .skipServicePrincipalAadCheck(false)
        .build());
    
    role_assignment_resource = azure.marketplace.RoleAssignment("roleAssignmentResource",
        principal_id="string",
        condition="string",
        condition_version="string",
        delegated_managed_identity_resource_id="string",
        description="string",
        name="string",
        role_definition_id="string",
        role_definition_name="string",
        skip_service_principal_aad_check=False)
    
    const roleAssignmentResource = new azure.marketplace.RoleAssignment("roleAssignmentResource", {
        principalId: "string",
        condition: "string",
        conditionVersion: "string",
        delegatedManagedIdentityResourceId: "string",
        description: "string",
        name: "string",
        roleDefinitionId: "string",
        roleDefinitionName: "string",
        skipServicePrincipalAadCheck: false,
    });
    
    type: azure:marketplace:RoleAssignment
    properties:
        condition: string
        conditionVersion: string
        delegatedManagedIdentityResourceId: string
        description: string
        name: string
        principalId: string
        roleDefinitionId: string
        roleDefinitionName: string
        skipServicePrincipalAadCheck: false
    

    RoleAssignment Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The RoleAssignment resource accepts the following input properties:

    PrincipalId string

    The ID of the Principal (User, Group or Service Principal) to assign the Role Definition to. Changing this forces a new resource to be created.

    Note: The Principal ID is also known as the Object ID (i.e. not the "Application ID" for applications). To assign Azure roles, the Principal must have Microsoft.Authorization/roleAssignments/write permissions. See documentation for more information.

    Condition string
    The condition that limits the resources that the role can be assigned to. Changing this forces a new resource to be created.
    ConditionVersion string
    The version of the condition. Possible values are 1.0 or 2.0. Changing this forces a new resource to be created.
    DelegatedManagedIdentityResourceId string

    The delegated Azure Resource ID which contains a Managed Identity. Changing this forces a new resource to be created.

    Note: This field is only used in cross tenant scenarios.

    Description string
    The description for this Role Assignment. Changing this forces a new resource to be created.
    Name string
    A unique UUID/GUID for this Role Assignment - one will be generated if not specified. Changing this forces a new resource to be created.
    RoleDefinitionId string
    The Scoped-ID of the Role Definition. Changing this forces a new resource to be created. Conflicts with role_definition_name.
    RoleDefinitionName string

    The name of a built-in Role. Changing this forces a new resource to be created. Conflicts with role_definition_id.

    Note: To assign Marketplace Admin role, the calling Principal must first be assigned Privileged Role Administrator (like Owner role) or Global Administrator. See documentation for more information.

    SkipServicePrincipalAadCheck bool

    If the principal_id is a newly provisioned Service Principal set this value to true to skip the Azure Active Directory check which may fail due to replication lag. This argument is only valid if the principal_id is a Service Principal identity. Defaults to false. Changing this forces a new resource to be created.

    Note: This field takes effect only when principal_id is a Service Principal identity.

    PrincipalId string

    The ID of the Principal (User, Group or Service Principal) to assign the Role Definition to. Changing this forces a new resource to be created.

    Note: The Principal ID is also known as the Object ID (i.e. not the "Application ID" for applications). To assign Azure roles, the Principal must have Microsoft.Authorization/roleAssignments/write permissions. See documentation for more information.

    Condition string
    The condition that limits the resources that the role can be assigned to. Changing this forces a new resource to be created.
    ConditionVersion string
    The version of the condition. Possible values are 1.0 or 2.0. Changing this forces a new resource to be created.
    DelegatedManagedIdentityResourceId string

    The delegated Azure Resource ID which contains a Managed Identity. Changing this forces a new resource to be created.

    Note: This field is only used in cross tenant scenarios.

    Description string
    The description for this Role Assignment. Changing this forces a new resource to be created.
    Name string
    A unique UUID/GUID for this Role Assignment - one will be generated if not specified. Changing this forces a new resource to be created.
    RoleDefinitionId string
    The Scoped-ID of the Role Definition. Changing this forces a new resource to be created. Conflicts with role_definition_name.
    RoleDefinitionName string

    The name of a built-in Role. Changing this forces a new resource to be created. Conflicts with role_definition_id.

    Note: To assign Marketplace Admin role, the calling Principal must first be assigned Privileged Role Administrator (like Owner role) or Global Administrator. See documentation for more information.

    SkipServicePrincipalAadCheck bool

    If the principal_id is a newly provisioned Service Principal set this value to true to skip the Azure Active Directory check which may fail due to replication lag. This argument is only valid if the principal_id is a Service Principal identity. Defaults to false. Changing this forces a new resource to be created.

    Note: This field takes effect only when principal_id is a Service Principal identity.

    principalId String

    The ID of the Principal (User, Group or Service Principal) to assign the Role Definition to. Changing this forces a new resource to be created.

    Note: The Principal ID is also known as the Object ID (i.e. not the "Application ID" for applications). To assign Azure roles, the Principal must have Microsoft.Authorization/roleAssignments/write permissions. See documentation for more information.

    condition String
    The condition that limits the resources that the role can be assigned to. Changing this forces a new resource to be created.
    conditionVersion String
    The version of the condition. Possible values are 1.0 or 2.0. Changing this forces a new resource to be created.
    delegatedManagedIdentityResourceId String

    The delegated Azure Resource ID which contains a Managed Identity. Changing this forces a new resource to be created.

    Note: This field is only used in cross tenant scenarios.

    description String
    The description for this Role Assignment. Changing this forces a new resource to be created.
    name String
    A unique UUID/GUID for this Role Assignment - one will be generated if not specified. Changing this forces a new resource to be created.
    roleDefinitionId String
    The Scoped-ID of the Role Definition. Changing this forces a new resource to be created. Conflicts with role_definition_name.
    roleDefinitionName String

    The name of a built-in Role. Changing this forces a new resource to be created. Conflicts with role_definition_id.

    Note: To assign Marketplace Admin role, the calling Principal must first be assigned Privileged Role Administrator (like Owner role) or Global Administrator. See documentation for more information.

    skipServicePrincipalAadCheck Boolean

    If the principal_id is a newly provisioned Service Principal set this value to true to skip the Azure Active Directory check which may fail due to replication lag. This argument is only valid if the principal_id is a Service Principal identity. Defaults to false. Changing this forces a new resource to be created.

    Note: This field takes effect only when principal_id is a Service Principal identity.

    principalId string

    The ID of the Principal (User, Group or Service Principal) to assign the Role Definition to. Changing this forces a new resource to be created.

    Note: The Principal ID is also known as the Object ID (i.e. not the "Application ID" for applications). To assign Azure roles, the Principal must have Microsoft.Authorization/roleAssignments/write permissions. See documentation for more information.

    condition string
    The condition that limits the resources that the role can be assigned to. Changing this forces a new resource to be created.
    conditionVersion string
    The version of the condition. Possible values are 1.0 or 2.0. Changing this forces a new resource to be created.
    delegatedManagedIdentityResourceId string

    The delegated Azure Resource ID which contains a Managed Identity. Changing this forces a new resource to be created.

    Note: This field is only used in cross tenant scenarios.

    description string
    The description for this Role Assignment. Changing this forces a new resource to be created.
    name string
    A unique UUID/GUID for this Role Assignment - one will be generated if not specified. Changing this forces a new resource to be created.
    roleDefinitionId string
    The Scoped-ID of the Role Definition. Changing this forces a new resource to be created. Conflicts with role_definition_name.
    roleDefinitionName string

    The name of a built-in Role. Changing this forces a new resource to be created. Conflicts with role_definition_id.

    Note: To assign Marketplace Admin role, the calling Principal must first be assigned Privileged Role Administrator (like Owner role) or Global Administrator. See documentation for more information.

    skipServicePrincipalAadCheck boolean

    If the principal_id is a newly provisioned Service Principal set this value to true to skip the Azure Active Directory check which may fail due to replication lag. This argument is only valid if the principal_id is a Service Principal identity. Defaults to false. Changing this forces a new resource to be created.

    Note: This field takes effect only when principal_id is a Service Principal identity.

    principal_id str

    The ID of the Principal (User, Group or Service Principal) to assign the Role Definition to. Changing this forces a new resource to be created.

    Note: The Principal ID is also known as the Object ID (i.e. not the "Application ID" for applications). To assign Azure roles, the Principal must have Microsoft.Authorization/roleAssignments/write permissions. See documentation for more information.

    condition str
    The condition that limits the resources that the role can be assigned to. Changing this forces a new resource to be created.
    condition_version str
    The version of the condition. Possible values are 1.0 or 2.0. Changing this forces a new resource to be created.
    delegated_managed_identity_resource_id str

    The delegated Azure Resource ID which contains a Managed Identity. Changing this forces a new resource to be created.

    Note: This field is only used in cross tenant scenarios.

    description str
    The description for this Role Assignment. Changing this forces a new resource to be created.
    name str
    A unique UUID/GUID for this Role Assignment - one will be generated if not specified. Changing this forces a new resource to be created.
    role_definition_id str
    The Scoped-ID of the Role Definition. Changing this forces a new resource to be created. Conflicts with role_definition_name.
    role_definition_name str

    The name of a built-in Role. Changing this forces a new resource to be created. Conflicts with role_definition_id.

    Note: To assign Marketplace Admin role, the calling Principal must first be assigned Privileged Role Administrator (like Owner role) or Global Administrator. See documentation for more information.

    skip_service_principal_aad_check bool

    If the principal_id is a newly provisioned Service Principal set this value to true to skip the Azure Active Directory check which may fail due to replication lag. This argument is only valid if the principal_id is a Service Principal identity. Defaults to false. Changing this forces a new resource to be created.

    Note: This field takes effect only when principal_id is a Service Principal identity.

    principalId String

    The ID of the Principal (User, Group or Service Principal) to assign the Role Definition to. Changing this forces a new resource to be created.

    Note: The Principal ID is also known as the Object ID (i.e. not the "Application ID" for applications). To assign Azure roles, the Principal must have Microsoft.Authorization/roleAssignments/write permissions. See documentation for more information.

    condition String
    The condition that limits the resources that the role can be assigned to. Changing this forces a new resource to be created.
    conditionVersion String
    The version of the condition. Possible values are 1.0 or 2.0. Changing this forces a new resource to be created.
    delegatedManagedIdentityResourceId String

    The delegated Azure Resource ID which contains a Managed Identity. Changing this forces a new resource to be created.

    Note: This field is only used in cross tenant scenarios.

    description String
    The description for this Role Assignment. Changing this forces a new resource to be created.
    name String
    A unique UUID/GUID for this Role Assignment - one will be generated if not specified. Changing this forces a new resource to be created.
    roleDefinitionId String
    The Scoped-ID of the Role Definition. Changing this forces a new resource to be created. Conflicts with role_definition_name.
    roleDefinitionName String

    The name of a built-in Role. Changing this forces a new resource to be created. Conflicts with role_definition_id.

    Note: To assign Marketplace Admin role, the calling Principal must first be assigned Privileged Role Administrator (like Owner role) or Global Administrator. See documentation for more information.

    skipServicePrincipalAadCheck Boolean

    If the principal_id is a newly provisioned Service Principal set this value to true to skip the Azure Active Directory check which may fail due to replication lag. This argument is only valid if the principal_id is a Service Principal identity. Defaults to false. Changing this forces a new resource to be created.

    Note: This field takes effect only when principal_id is a Service Principal identity.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the RoleAssignment resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    PrincipalType string
    The type of the principal_id, e.g. User, Group, Service Principal, Application, etc.
    Id string
    The provider-assigned unique ID for this managed resource.
    PrincipalType string
    The type of the principal_id, e.g. User, Group, Service Principal, Application, etc.
    id String
    The provider-assigned unique ID for this managed resource.
    principalType String
    The type of the principal_id, e.g. User, Group, Service Principal, Application, etc.
    id string
    The provider-assigned unique ID for this managed resource.
    principalType string
    The type of the principal_id, e.g. User, Group, Service Principal, Application, etc.
    id str
    The provider-assigned unique ID for this managed resource.
    principal_type str
    The type of the principal_id, e.g. User, Group, Service Principal, Application, etc.
    id String
    The provider-assigned unique ID for this managed resource.
    principalType String
    The type of the principal_id, e.g. User, Group, Service Principal, Application, etc.

    Look up Existing RoleAssignment Resource

    Get an existing RoleAssignment resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: RoleAssignmentState, opts?: CustomResourceOptions): RoleAssignment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            condition: Optional[str] = None,
            condition_version: Optional[str] = None,
            delegated_managed_identity_resource_id: Optional[str] = None,
            description: Optional[str] = None,
            name: Optional[str] = None,
            principal_id: Optional[str] = None,
            principal_type: Optional[str] = None,
            role_definition_id: Optional[str] = None,
            role_definition_name: Optional[str] = None,
            skip_service_principal_aad_check: Optional[bool] = None) -> RoleAssignment
    func GetRoleAssignment(ctx *Context, name string, id IDInput, state *RoleAssignmentState, opts ...ResourceOption) (*RoleAssignment, error)
    public static RoleAssignment Get(string name, Input<string> id, RoleAssignmentState? state, CustomResourceOptions? opts = null)
    public static RoleAssignment get(String name, Output<String> id, RoleAssignmentState state, CustomResourceOptions options)
    resources:  _:    type: azure:marketplace:RoleAssignment    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Condition string
    The condition that limits the resources that the role can be assigned to. Changing this forces a new resource to be created.
    ConditionVersion string
    The version of the condition. Possible values are 1.0 or 2.0. Changing this forces a new resource to be created.
    DelegatedManagedIdentityResourceId string

    The delegated Azure Resource ID which contains a Managed Identity. Changing this forces a new resource to be created.

    Note: This field is only used in cross tenant scenarios.

    Description string
    The description for this Role Assignment. Changing this forces a new resource to be created.
    Name string
    A unique UUID/GUID for this Role Assignment - one will be generated if not specified. Changing this forces a new resource to be created.
    PrincipalId string

    The ID of the Principal (User, Group or Service Principal) to assign the Role Definition to. Changing this forces a new resource to be created.

    Note: The Principal ID is also known as the Object ID (i.e. not the "Application ID" for applications). To assign Azure roles, the Principal must have Microsoft.Authorization/roleAssignments/write permissions. See documentation for more information.

    PrincipalType string
    The type of the principal_id, e.g. User, Group, Service Principal, Application, etc.
    RoleDefinitionId string
    The Scoped-ID of the Role Definition. Changing this forces a new resource to be created. Conflicts with role_definition_name.
    RoleDefinitionName string

    The name of a built-in Role. Changing this forces a new resource to be created. Conflicts with role_definition_id.

    Note: To assign Marketplace Admin role, the calling Principal must first be assigned Privileged Role Administrator (like Owner role) or Global Administrator. See documentation for more information.

    SkipServicePrincipalAadCheck bool

    If the principal_id is a newly provisioned Service Principal set this value to true to skip the Azure Active Directory check which may fail due to replication lag. This argument is only valid if the principal_id is a Service Principal identity. Defaults to false. Changing this forces a new resource to be created.

    Note: This field takes effect only when principal_id is a Service Principal identity.

    Condition string
    The condition that limits the resources that the role can be assigned to. Changing this forces a new resource to be created.
    ConditionVersion string
    The version of the condition. Possible values are 1.0 or 2.0. Changing this forces a new resource to be created.
    DelegatedManagedIdentityResourceId string

    The delegated Azure Resource ID which contains a Managed Identity. Changing this forces a new resource to be created.

    Note: This field is only used in cross tenant scenarios.

    Description string
    The description for this Role Assignment. Changing this forces a new resource to be created.
    Name string
    A unique UUID/GUID for this Role Assignment - one will be generated if not specified. Changing this forces a new resource to be created.
    PrincipalId string

    The ID of the Principal (User, Group or Service Principal) to assign the Role Definition to. Changing this forces a new resource to be created.

    Note: The Principal ID is also known as the Object ID (i.e. not the "Application ID" for applications). To assign Azure roles, the Principal must have Microsoft.Authorization/roleAssignments/write permissions. See documentation for more information.

    PrincipalType string
    The type of the principal_id, e.g. User, Group, Service Principal, Application, etc.
    RoleDefinitionId string
    The Scoped-ID of the Role Definition. Changing this forces a new resource to be created. Conflicts with role_definition_name.
    RoleDefinitionName string

    The name of a built-in Role. Changing this forces a new resource to be created. Conflicts with role_definition_id.

    Note: To assign Marketplace Admin role, the calling Principal must first be assigned Privileged Role Administrator (like Owner role) or Global Administrator. See documentation for more information.

    SkipServicePrincipalAadCheck bool

    If the principal_id is a newly provisioned Service Principal set this value to true to skip the Azure Active Directory check which may fail due to replication lag. This argument is only valid if the principal_id is a Service Principal identity. Defaults to false. Changing this forces a new resource to be created.

    Note: This field takes effect only when principal_id is a Service Principal identity.

    condition String
    The condition that limits the resources that the role can be assigned to. Changing this forces a new resource to be created.
    conditionVersion String
    The version of the condition. Possible values are 1.0 or 2.0. Changing this forces a new resource to be created.
    delegatedManagedIdentityResourceId String

    The delegated Azure Resource ID which contains a Managed Identity. Changing this forces a new resource to be created.

    Note: This field is only used in cross tenant scenarios.

    description String
    The description for this Role Assignment. Changing this forces a new resource to be created.
    name String
    A unique UUID/GUID for this Role Assignment - one will be generated if not specified. Changing this forces a new resource to be created.
    principalId String

    The ID of the Principal (User, Group or Service Principal) to assign the Role Definition to. Changing this forces a new resource to be created.

    Note: The Principal ID is also known as the Object ID (i.e. not the "Application ID" for applications). To assign Azure roles, the Principal must have Microsoft.Authorization/roleAssignments/write permissions. See documentation for more information.

    principalType String
    The type of the principal_id, e.g. User, Group, Service Principal, Application, etc.
    roleDefinitionId String
    The Scoped-ID of the Role Definition. Changing this forces a new resource to be created. Conflicts with role_definition_name.
    roleDefinitionName String

    The name of a built-in Role. Changing this forces a new resource to be created. Conflicts with role_definition_id.

    Note: To assign Marketplace Admin role, the calling Principal must first be assigned Privileged Role Administrator (like Owner role) or Global Administrator. See documentation for more information.

    skipServicePrincipalAadCheck Boolean

    If the principal_id is a newly provisioned Service Principal set this value to true to skip the Azure Active Directory check which may fail due to replication lag. This argument is only valid if the principal_id is a Service Principal identity. Defaults to false. Changing this forces a new resource to be created.

    Note: This field takes effect only when principal_id is a Service Principal identity.

    condition string
    The condition that limits the resources that the role can be assigned to. Changing this forces a new resource to be created.
    conditionVersion string
    The version of the condition. Possible values are 1.0 or 2.0. Changing this forces a new resource to be created.
    delegatedManagedIdentityResourceId string

    The delegated Azure Resource ID which contains a Managed Identity. Changing this forces a new resource to be created.

    Note: This field is only used in cross tenant scenarios.

    description string
    The description for this Role Assignment. Changing this forces a new resource to be created.
    name string
    A unique UUID/GUID for this Role Assignment - one will be generated if not specified. Changing this forces a new resource to be created.
    principalId string

    The ID of the Principal (User, Group or Service Principal) to assign the Role Definition to. Changing this forces a new resource to be created.

    Note: The Principal ID is also known as the Object ID (i.e. not the "Application ID" for applications). To assign Azure roles, the Principal must have Microsoft.Authorization/roleAssignments/write permissions. See documentation for more information.

    principalType string
    The type of the principal_id, e.g. User, Group, Service Principal, Application, etc.
    roleDefinitionId string
    The Scoped-ID of the Role Definition. Changing this forces a new resource to be created. Conflicts with role_definition_name.
    roleDefinitionName string

    The name of a built-in Role. Changing this forces a new resource to be created. Conflicts with role_definition_id.

    Note: To assign Marketplace Admin role, the calling Principal must first be assigned Privileged Role Administrator (like Owner role) or Global Administrator. See documentation for more information.

    skipServicePrincipalAadCheck boolean

    If the principal_id is a newly provisioned Service Principal set this value to true to skip the Azure Active Directory check which may fail due to replication lag. This argument is only valid if the principal_id is a Service Principal identity. Defaults to false. Changing this forces a new resource to be created.

    Note: This field takes effect only when principal_id is a Service Principal identity.

    condition str
    The condition that limits the resources that the role can be assigned to. Changing this forces a new resource to be created.
    condition_version str
    The version of the condition. Possible values are 1.0 or 2.0. Changing this forces a new resource to be created.
    delegated_managed_identity_resource_id str

    The delegated Azure Resource ID which contains a Managed Identity. Changing this forces a new resource to be created.

    Note: This field is only used in cross tenant scenarios.

    description str
    The description for this Role Assignment. Changing this forces a new resource to be created.
    name str
    A unique UUID/GUID for this Role Assignment - one will be generated if not specified. Changing this forces a new resource to be created.
    principal_id str

    The ID of the Principal (User, Group or Service Principal) to assign the Role Definition to. Changing this forces a new resource to be created.

    Note: The Principal ID is also known as the Object ID (i.e. not the "Application ID" for applications). To assign Azure roles, the Principal must have Microsoft.Authorization/roleAssignments/write permissions. See documentation for more information.

    principal_type str
    The type of the principal_id, e.g. User, Group, Service Principal, Application, etc.
    role_definition_id str
    The Scoped-ID of the Role Definition. Changing this forces a new resource to be created. Conflicts with role_definition_name.
    role_definition_name str

    The name of a built-in Role. Changing this forces a new resource to be created. Conflicts with role_definition_id.

    Note: To assign Marketplace Admin role, the calling Principal must first be assigned Privileged Role Administrator (like Owner role) or Global Administrator. See documentation for more information.

    skip_service_principal_aad_check bool

    If the principal_id is a newly provisioned Service Principal set this value to true to skip the Azure Active Directory check which may fail due to replication lag. This argument is only valid if the principal_id is a Service Principal identity. Defaults to false. Changing this forces a new resource to be created.

    Note: This field takes effect only when principal_id is a Service Principal identity.

    condition String
    The condition that limits the resources that the role can be assigned to. Changing this forces a new resource to be created.
    conditionVersion String
    The version of the condition. Possible values are 1.0 or 2.0. Changing this forces a new resource to be created.
    delegatedManagedIdentityResourceId String

    The delegated Azure Resource ID which contains a Managed Identity. Changing this forces a new resource to be created.

    Note: This field is only used in cross tenant scenarios.

    description String
    The description for this Role Assignment. Changing this forces a new resource to be created.
    name String
    A unique UUID/GUID for this Role Assignment - one will be generated if not specified. Changing this forces a new resource to be created.
    principalId String

    The ID of the Principal (User, Group or Service Principal) to assign the Role Definition to. Changing this forces a new resource to be created.

    Note: The Principal ID is also known as the Object ID (i.e. not the "Application ID" for applications). To assign Azure roles, the Principal must have Microsoft.Authorization/roleAssignments/write permissions. See documentation for more information.

    principalType String
    The type of the principal_id, e.g. User, Group, Service Principal, Application, etc.
    roleDefinitionId String
    The Scoped-ID of the Role Definition. Changing this forces a new resource to be created. Conflicts with role_definition_name.
    roleDefinitionName String

    The name of a built-in Role. Changing this forces a new resource to be created. Conflicts with role_definition_id.

    Note: To assign Marketplace Admin role, the calling Principal must first be assigned Privileged Role Administrator (like Owner role) or Global Administrator. See documentation for more information.

    skipServicePrincipalAadCheck Boolean

    If the principal_id is a newly provisioned Service Principal set this value to true to skip the Azure Active Directory check which may fail due to replication lag. This argument is only valid if the principal_id is a Service Principal identity. Defaults to false. Changing this forces a new resource to be created.

    Note: This field takes effect only when principal_id is a Service Principal identity.

    Import

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

    $ pulumi import azure:marketplace/roleAssignment:RoleAssignment example /providers/Microsoft.Marketplace/providers/Microsoft.Authorization/roleAssignments/00000000-0000-0000-0000-000000000000
    

    text

    /providers/Microsoft.Marketplace/providers/Microsoft.Authorization/roleAssignments/00000000-0000-0000-0000-000000000000|00000000-0000-0000-0000-000000000000

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Azure Classic pulumi/pulumi-azure
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Azure v6.23.0 published on Thursday, May 22, 2025 by Pulumi