1. Packages
  2. Azure Active Directory (Azure AD)
  3. API Docs
  4. AppRoleAssignment
Azure Active Directory (Azure AD) v6.0.1 published on Monday, Oct 14, 2024 by Pulumi

azuread.AppRoleAssignment

Explore with Pulumi AI

azuread logo
Azure Active Directory (Azure AD) v6.0.1 published on Monday, Oct 14, 2024 by Pulumi

    Manages an app role assignment for a group, user or service principal. Can be used to grant admin consent for application permissions.

    API Permissions

    The following API permissions are required in order to use this resource.

    When authenticated with a service principal, this resource requires one of the following application roles: AppRoleAssignment.ReadWrite.All and Application.Read.All, or AppRoleAssignment.ReadWrite.All and Directory.Read.All, or Application.ReadWrite.All, or Directory.ReadWrite.All

    When authenticated with a user principal, this resource requires one of the following directory roles: Application Administrator or Global Administrator

    Example Usage

    App role assignment for accessing Microsoft Graph

    import * as pulumi from "@pulumi/pulumi";
    import * as azuread from "@pulumi/azuread";
    
    const wellKnown = azuread.getApplicationPublishedAppIds({});
    const msgraph = new azuread.ServicePrincipal("msgraph", {
        clientId: wellKnown.then(wellKnown => wellKnown.result?.microsoftGraph),
        useExisting: true,
    });
    const example = new azuread.Application("example", {
        displayName: "example",
        requiredResourceAccesses: [{
            resourceAppId: wellKnown.then(wellKnown => wellKnown.result?.microsoftGraph),
            resourceAccesses: [
                {
                    id: msgraph.appRoleIds["User.Read.All"],
                    type: "Role",
                },
                {
                    id: msgraph.oauth2PermissionScopeIds["User.ReadWrite"],
                    type: "Scope",
                },
            ],
        }],
    });
    const exampleServicePrincipal = new azuread.ServicePrincipal("example", {clientId: example.clientId});
    const exampleAppRoleAssignment = new azuread.AppRoleAssignment("example", {
        appRoleId: msgraph.appRoleIds["User.Read.All"],
        principalObjectId: exampleServicePrincipal.objectId,
        resourceObjectId: msgraph.objectId,
    });
    
    import pulumi
    import pulumi_azuread as azuread
    
    well_known = azuread.get_application_published_app_ids()
    msgraph = azuread.ServicePrincipal("msgraph",
        client_id=well_known.result["microsoftGraph"],
        use_existing=True)
    example = azuread.Application("example",
        display_name="example",
        required_resource_accesses=[{
            "resource_app_id": well_known.result["microsoftGraph"],
            "resource_accesses": [
                {
                    "id": msgraph.app_role_ids["User.Read.All"],
                    "type": "Role",
                },
                {
                    "id": msgraph.oauth2_permission_scope_ids["User.ReadWrite"],
                    "type": "Scope",
                },
            ],
        }])
    example_service_principal = azuread.ServicePrincipal("example", client_id=example.client_id)
    example_app_role_assignment = azuread.AppRoleAssignment("example",
        app_role_id=msgraph.app_role_ids["User.Read.All"],
        principal_object_id=example_service_principal.object_id,
        resource_object_id=msgraph.object_id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azuread/sdk/v6/go/azuread"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		wellKnown, err := azuread.GetApplicationPublishedAppIds(ctx, map[string]interface{}{}, nil)
    		if err != nil {
    			return err
    		}
    		msgraph, err := azuread.NewServicePrincipal(ctx, "msgraph", &azuread.ServicePrincipalArgs{
    			ClientId:    pulumi.String(wellKnown.Result.MicrosoftGraph),
    			UseExisting: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		example, err := azuread.NewApplication(ctx, "example", &azuread.ApplicationArgs{
    			DisplayName: pulumi.String("example"),
    			RequiredResourceAccesses: azuread.ApplicationRequiredResourceAccessArray{
    				&azuread.ApplicationRequiredResourceAccessArgs{
    					ResourceAppId: pulumi.String(wellKnown.Result.MicrosoftGraph),
    					ResourceAccesses: azuread.ApplicationRequiredResourceAccessResourceAccessArray{
    						&azuread.ApplicationRequiredResourceAccessResourceAccessArgs{
    							Id: msgraph.AppRoleIds.ApplyT(func(appRoleIds map[string]string) (string, error) {
    								return appRoleIds.User.Read.All, nil
    							}).(pulumi.StringOutput),
    							Type: pulumi.String("Role"),
    						},
    						&azuread.ApplicationRequiredResourceAccessResourceAccessArgs{
    							Id: msgraph.Oauth2PermissionScopeIds.ApplyT(func(oauth2PermissionScopeIds map[string]string) (string, error) {
    								return oauth2PermissionScopeIds.User.ReadWrite, nil
    							}).(pulumi.StringOutput),
    							Type: pulumi.String("Scope"),
    						},
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		exampleServicePrincipal, err := azuread.NewServicePrincipal(ctx, "example", &azuread.ServicePrincipalArgs{
    			ClientId: example.ClientId,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = azuread.NewAppRoleAssignment(ctx, "example", &azuread.AppRoleAssignmentArgs{
    			AppRoleId: msgraph.AppRoleIds.ApplyT(func(appRoleIds map[string]string) (string, error) {
    				return appRoleIds.User.Read.All, nil
    			}).(pulumi.StringOutput),
    			PrincipalObjectId: exampleServicePrincipal.ObjectId,
    			ResourceObjectId:  msgraph.ObjectId,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AzureAD = Pulumi.AzureAD;
    
    return await Deployment.RunAsync(() => 
    {
        var wellKnown = AzureAD.GetApplicationPublishedAppIds.Invoke();
    
        var msgraph = new AzureAD.ServicePrincipal("msgraph", new()
        {
            ClientId = wellKnown.Apply(getApplicationPublishedAppIdsResult => getApplicationPublishedAppIdsResult.Result?.MicrosoftGraph),
            UseExisting = true,
        });
    
        var example = new AzureAD.Application("example", new()
        {
            DisplayName = "example",
            RequiredResourceAccesses = new[]
            {
                new AzureAD.Inputs.ApplicationRequiredResourceAccessArgs
                {
                    ResourceAppId = wellKnown.Apply(getApplicationPublishedAppIdsResult => getApplicationPublishedAppIdsResult.Result?.MicrosoftGraph),
                    ResourceAccesses = new[]
                    {
                        new AzureAD.Inputs.ApplicationRequiredResourceAccessResourceAccessArgs
                        {
                            Id = msgraph.AppRoleIds.Apply(appRoleIds => appRoleIds.User_Read_All),
                            Type = "Role",
                        },
                        new AzureAD.Inputs.ApplicationRequiredResourceAccessResourceAccessArgs
                        {
                            Id = msgraph.Oauth2PermissionScopeIds.Apply(oauth2PermissionScopeIds => oauth2PermissionScopeIds.User_ReadWrite),
                            Type = "Scope",
                        },
                    },
                },
            },
        });
    
        var exampleServicePrincipal = new AzureAD.ServicePrincipal("example", new()
        {
            ClientId = example.ClientId,
        });
    
        var exampleAppRoleAssignment = new AzureAD.AppRoleAssignment("example", new()
        {
            AppRoleId = msgraph.AppRoleIds.Apply(appRoleIds => appRoleIds.User_Read_All),
            PrincipalObjectId = exampleServicePrincipal.ObjectId,
            ResourceObjectId = msgraph.ObjectId,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azuread.AzureadFunctions;
    import com.pulumi.azuread.ServicePrincipal;
    import com.pulumi.azuread.ServicePrincipalArgs;
    import com.pulumi.azuread.Application;
    import com.pulumi.azuread.ApplicationArgs;
    import com.pulumi.azuread.inputs.ApplicationRequiredResourceAccessArgs;
    import com.pulumi.azuread.AppRoleAssignment;
    import com.pulumi.azuread.AppRoleAssignmentArgs;
    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 wellKnown = AzureadFunctions.getApplicationPublishedAppIds();
    
            var msgraph = new ServicePrincipal("msgraph", ServicePrincipalArgs.builder()
                .clientId(wellKnown.applyValue(getApplicationPublishedAppIdsResult -> getApplicationPublishedAppIdsResult.result().microsoftGraph()))
                .useExisting(true)
                .build());
    
            var example = new Application("example", ApplicationArgs.builder()
                .displayName("example")
                .requiredResourceAccesses(ApplicationRequiredResourceAccessArgs.builder()
                    .resourceAppId(wellKnown.applyValue(getApplicationPublishedAppIdsResult -> getApplicationPublishedAppIdsResult.result().microsoftGraph()))
                    .resourceAccesses(                
                        ApplicationRequiredResourceAccessResourceAccessArgs.builder()
                            .id(msgraph.appRoleIds().applyValue(appRoleIds -> appRoleIds.User.Read.All()))
                            .type("Role")
                            .build(),
                        ApplicationRequiredResourceAccessResourceAccessArgs.builder()
                            .id(msgraph.oauth2PermissionScopeIds().applyValue(oauth2PermissionScopeIds -> oauth2PermissionScopeIds.User.ReadWrite()))
                            .type("Scope")
                            .build())
                    .build())
                .build());
    
            var exampleServicePrincipal = new ServicePrincipal("exampleServicePrincipal", ServicePrincipalArgs.builder()
                .clientId(example.clientId())
                .build());
    
            var exampleAppRoleAssignment = new AppRoleAssignment("exampleAppRoleAssignment", AppRoleAssignmentArgs.builder()
                .appRoleId(msgraph.appRoleIds().applyValue(appRoleIds -> appRoleIds.User.Read.All()))
                .principalObjectId(exampleServicePrincipal.objectId())
                .resourceObjectId(msgraph.objectId())
                .build());
    
        }
    }
    
    resources:
      msgraph:
        type: azuread:ServicePrincipal
        properties:
          clientId: ${wellKnown.result.microsoftGraph}
          useExisting: true
      example:
        type: azuread:Application
        properties:
          displayName: example
          requiredResourceAccesses:
            - resourceAppId: ${wellKnown.result.microsoftGraph}
              resourceAccesses:
                - id: ${msgraph.appRoleIds"User.Read.All"[%!s(MISSING)]}
                  type: Role
                - id: ${msgraph.oauth2PermissionScopeIds"User.ReadWrite"[%!s(MISSING)]}
                  type: Scope
      exampleServicePrincipal:
        type: azuread:ServicePrincipal
        name: example
        properties:
          clientId: ${example.clientId}
      exampleAppRoleAssignment:
        type: azuread:AppRoleAssignment
        name: example
        properties:
          appRoleId: ${msgraph.appRoleIds"User.Read.All"[%!s(MISSING)]}
          principalObjectId: ${exampleServicePrincipal.objectId}
          resourceObjectId: ${msgraph.objectId}
    variables:
      wellKnown:
        fn::invoke:
          Function: azuread:getApplicationPublishedAppIds
          Arguments: {}
    

    App role assignment for internal application

    import * as pulumi from "@pulumi/pulumi";
    import * as azuread from "@pulumi/azuread";
    
    const internal = new azuread.Application("internal", {
        displayName: "internal",
        appRoles: [{
            allowedMemberTypes: ["Application"],
            description: "Apps can query the database",
            displayName: "Query",
            enabled: true,
            id: "00000000-0000-0000-0000-111111111111",
            value: "Query.All",
        }],
    });
    const internalServicePrincipal = new azuread.ServicePrincipal("internal", {clientId: internal.clientId});
    const example = new azuread.Application("example", {
        displayName: "example",
        requiredResourceAccesses: [{
            resourceAppId: internal.clientId,
            resourceAccesses: [{
                id: internalServicePrincipal.appRoleIds["Query.All"],
                type: "Role",
            }],
        }],
    });
    const exampleServicePrincipal = new azuread.ServicePrincipal("example", {clientId: example.clientId});
    const exampleAppRoleAssignment = new azuread.AppRoleAssignment("example", {
        appRoleId: internalServicePrincipal.appRoleIds["Query.All"],
        principalObjectId: exampleServicePrincipal.objectId,
        resourceObjectId: internalServicePrincipal.objectId,
    });
    
    import pulumi
    import pulumi_azuread as azuread
    
    internal = azuread.Application("internal",
        display_name="internal",
        app_roles=[{
            "allowed_member_types": ["Application"],
            "description": "Apps can query the database",
            "display_name": "Query",
            "enabled": True,
            "id": "00000000-0000-0000-0000-111111111111",
            "value": "Query.All",
        }])
    internal_service_principal = azuread.ServicePrincipal("internal", client_id=internal.client_id)
    example = azuread.Application("example",
        display_name="example",
        required_resource_accesses=[{
            "resource_app_id": internal.client_id,
            "resource_accesses": [{
                "id": internal_service_principal.app_role_ids["Query.All"],
                "type": "Role",
            }],
        }])
    example_service_principal = azuread.ServicePrincipal("example", client_id=example.client_id)
    example_app_role_assignment = azuread.AppRoleAssignment("example",
        app_role_id=internal_service_principal.app_role_ids["Query.All"],
        principal_object_id=example_service_principal.object_id,
        resource_object_id=internal_service_principal.object_id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azuread/sdk/v6/go/azuread"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		internal, err := azuread.NewApplication(ctx, "internal", &azuread.ApplicationArgs{
    			DisplayName: pulumi.String("internal"),
    			AppRoles: azuread.ApplicationAppRoleTypeArray{
    				&azuread.ApplicationAppRoleTypeArgs{
    					AllowedMemberTypes: pulumi.StringArray{
    						pulumi.String("Application"),
    					},
    					Description: pulumi.String("Apps can query the database"),
    					DisplayName: pulumi.String("Query"),
    					Enabled:     pulumi.Bool(true),
    					Id:          pulumi.String("00000000-0000-0000-0000-111111111111"),
    					Value:       pulumi.String("Query.All"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		internalServicePrincipal, err := azuread.NewServicePrincipal(ctx, "internal", &azuread.ServicePrincipalArgs{
    			ClientId: internal.ClientId,
    		})
    		if err != nil {
    			return err
    		}
    		example, err := azuread.NewApplication(ctx, "example", &azuread.ApplicationArgs{
    			DisplayName: pulumi.String("example"),
    			RequiredResourceAccesses: azuread.ApplicationRequiredResourceAccessArray{
    				&azuread.ApplicationRequiredResourceAccessArgs{
    					ResourceAppId: internal.ClientId,
    					ResourceAccesses: azuread.ApplicationRequiredResourceAccessResourceAccessArray{
    						&azuread.ApplicationRequiredResourceAccessResourceAccessArgs{
    							Id: internalServicePrincipal.AppRoleIds.ApplyT(func(appRoleIds map[string]string) (string, error) {
    								return appRoleIds.Query.All, nil
    							}).(pulumi.StringOutput),
    							Type: pulumi.String("Role"),
    						},
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		exampleServicePrincipal, err := azuread.NewServicePrincipal(ctx, "example", &azuread.ServicePrincipalArgs{
    			ClientId: example.ClientId,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = azuread.NewAppRoleAssignment(ctx, "example", &azuread.AppRoleAssignmentArgs{
    			AppRoleId: internalServicePrincipal.AppRoleIds.ApplyT(func(appRoleIds map[string]string) (string, error) {
    				return appRoleIds.Query.All, nil
    			}).(pulumi.StringOutput),
    			PrincipalObjectId: exampleServicePrincipal.ObjectId,
    			ResourceObjectId:  internalServicePrincipal.ObjectId,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AzureAD = Pulumi.AzureAD;
    
    return await Deployment.RunAsync(() => 
    {
        var @internal = new AzureAD.Application("internal", new()
        {
            DisplayName = "internal",
            AppRoles = new[]
            {
                new AzureAD.Inputs.ApplicationAppRoleArgs
                {
                    AllowedMemberTypes = new[]
                    {
                        "Application",
                    },
                    Description = "Apps can query the database",
                    DisplayName = "Query",
                    Enabled = true,
                    Id = "00000000-0000-0000-0000-111111111111",
                    Value = "Query.All",
                },
            },
        });
    
        var internalServicePrincipal = new AzureAD.ServicePrincipal("internal", new()
        {
            ClientId = @internal.ClientId,
        });
    
        var example = new AzureAD.Application("example", new()
        {
            DisplayName = "example",
            RequiredResourceAccesses = new[]
            {
                new AzureAD.Inputs.ApplicationRequiredResourceAccessArgs
                {
                    ResourceAppId = @internal.ClientId,
                    ResourceAccesses = new[]
                    {
                        new AzureAD.Inputs.ApplicationRequiredResourceAccessResourceAccessArgs
                        {
                            Id = internalServicePrincipal.AppRoleIds.Apply(appRoleIds => appRoleIds.Query_All),
                            Type = "Role",
                        },
                    },
                },
            },
        });
    
        var exampleServicePrincipal = new AzureAD.ServicePrincipal("example", new()
        {
            ClientId = example.ClientId,
        });
    
        var exampleAppRoleAssignment = new AzureAD.AppRoleAssignment("example", new()
        {
            AppRoleId = internalServicePrincipal.AppRoleIds.Apply(appRoleIds => appRoleIds.Query_All),
            PrincipalObjectId = exampleServicePrincipal.ObjectId,
            ResourceObjectId = internalServicePrincipal.ObjectId,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azuread.Application;
    import com.pulumi.azuread.ApplicationArgs;
    import com.pulumi.azuread.inputs.ApplicationAppRoleArgs;
    import com.pulumi.azuread.ServicePrincipal;
    import com.pulumi.azuread.ServicePrincipalArgs;
    import com.pulumi.azuread.inputs.ApplicationRequiredResourceAccessArgs;
    import com.pulumi.azuread.AppRoleAssignment;
    import com.pulumi.azuread.AppRoleAssignmentArgs;
    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) {
            var internal = new Application("internal", ApplicationArgs.builder()
                .displayName("internal")
                .appRoles(ApplicationAppRoleArgs.builder()
                    .allowedMemberTypes("Application")
                    .description("Apps can query the database")
                    .displayName("Query")
                    .enabled(true)
                    .id("00000000-0000-0000-0000-111111111111")
                    .value("Query.All")
                    .build())
                .build());
    
            var internalServicePrincipal = new ServicePrincipal("internalServicePrincipal", ServicePrincipalArgs.builder()
                .clientId(internal.clientId())
                .build());
    
            var example = new Application("example", ApplicationArgs.builder()
                .displayName("example")
                .requiredResourceAccesses(ApplicationRequiredResourceAccessArgs.builder()
                    .resourceAppId(internal.clientId())
                    .resourceAccesses(ApplicationRequiredResourceAccessResourceAccessArgs.builder()
                        .id(internalServicePrincipal.appRoleIds().applyValue(appRoleIds -> appRoleIds.Query.All()))
                        .type("Role")
                        .build())
                    .build())
                .build());
    
            var exampleServicePrincipal = new ServicePrincipal("exampleServicePrincipal", ServicePrincipalArgs.builder()
                .clientId(example.clientId())
                .build());
    
            var exampleAppRoleAssignment = new AppRoleAssignment("exampleAppRoleAssignment", AppRoleAssignmentArgs.builder()
                .appRoleId(internalServicePrincipal.appRoleIds().applyValue(appRoleIds -> appRoleIds.Query.All()))
                .principalObjectId(exampleServicePrincipal.objectId())
                .resourceObjectId(internalServicePrincipal.objectId())
                .build());
    
        }
    }
    
    resources:
      internal:
        type: azuread:Application
        properties:
          displayName: internal
          appRoles:
            - allowedMemberTypes:
                - Application
              description: Apps can query the database
              displayName: Query
              enabled: true
              id: 00000000-0000-0000-0000-111111111111
              value: Query.All
      internalServicePrincipal:
        type: azuread:ServicePrincipal
        name: internal
        properties:
          clientId: ${internal.clientId}
      example:
        type: azuread:Application
        properties:
          displayName: example
          requiredResourceAccesses:
            - resourceAppId: ${internal.clientId}
              resourceAccesses:
                - id: ${internalServicePrincipal.appRoleIds"Query.All"[%!s(MISSING)]}
                  type: Role
      exampleServicePrincipal:
        type: azuread:ServicePrincipal
        name: example
        properties:
          clientId: ${example.clientId}
      exampleAppRoleAssignment:
        type: azuread:AppRoleAssignment
        name: example
        properties:
          appRoleId: ${internalServicePrincipal.appRoleIds"Query.All"[%!s(MISSING)]}
          principalObjectId: ${exampleServicePrincipal.objectId}
          resourceObjectId: ${internalServicePrincipal.objectId}
    

    Assign a user and group to an internal application

    Create AppRoleAssignment Resource

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

    Constructor syntax

    new AppRoleAssignment(name: string, args: AppRoleAssignmentArgs, opts?: CustomResourceOptions);
    @overload
    def AppRoleAssignment(resource_name: str,
                          args: AppRoleAssignmentArgs,
                          opts: Optional[ResourceOptions] = None)
    
    @overload
    def AppRoleAssignment(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          app_role_id: Optional[str] = None,
                          principal_object_id: Optional[str] = None,
                          resource_object_id: Optional[str] = None)
    func NewAppRoleAssignment(ctx *Context, name string, args AppRoleAssignmentArgs, opts ...ResourceOption) (*AppRoleAssignment, error)
    public AppRoleAssignment(string name, AppRoleAssignmentArgs args, CustomResourceOptions? opts = null)
    public AppRoleAssignment(String name, AppRoleAssignmentArgs args)
    public AppRoleAssignment(String name, AppRoleAssignmentArgs args, CustomResourceOptions options)
    
    type: azuread:AppRoleAssignment
    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 AppRoleAssignmentArgs
    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 AppRoleAssignmentArgs
    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 AppRoleAssignmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AppRoleAssignmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AppRoleAssignmentArgs
    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 appRoleAssignmentResource = new AzureAD.AppRoleAssignment("appRoleAssignmentResource", new()
    {
        AppRoleId = "string",
        PrincipalObjectId = "string",
        ResourceObjectId = "string",
    });
    
    example, err := azuread.NewAppRoleAssignment(ctx, "appRoleAssignmentResource", &azuread.AppRoleAssignmentArgs{
    	AppRoleId:         pulumi.String("string"),
    	PrincipalObjectId: pulumi.String("string"),
    	ResourceObjectId:  pulumi.String("string"),
    })
    
    var appRoleAssignmentResource = new AppRoleAssignment("appRoleAssignmentResource", AppRoleAssignmentArgs.builder()
        .appRoleId("string")
        .principalObjectId("string")
        .resourceObjectId("string")
        .build());
    
    app_role_assignment_resource = azuread.AppRoleAssignment("appRoleAssignmentResource",
        app_role_id="string",
        principal_object_id="string",
        resource_object_id="string")
    
    const appRoleAssignmentResource = new azuread.AppRoleAssignment("appRoleAssignmentResource", {
        appRoleId: "string",
        principalObjectId: "string",
        resourceObjectId: "string",
    });
    
    type: azuread:AppRoleAssignment
    properties:
        appRoleId: string
        principalObjectId: string
        resourceObjectId: string
    

    AppRoleAssignment 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 AppRoleAssignment resource accepts the following input properties:

    AppRoleId string
    The ID of the app role to be assigned, or the default role ID 00000000-0000-0000-0000-000000000000. Changing this forces a new resource to be created.
    PrincipalObjectId string
    The object ID of the user, group or service principal to be assigned this app role. Supported object types are Users, Groups or Service Principals. Changing this forces a new resource to be created.
    ResourceObjectId string
    The object ID of the service principal representing the resource. Changing this forces a new resource to be created.
    AppRoleId string
    The ID of the app role to be assigned, or the default role ID 00000000-0000-0000-0000-000000000000. Changing this forces a new resource to be created.
    PrincipalObjectId string
    The object ID of the user, group or service principal to be assigned this app role. Supported object types are Users, Groups or Service Principals. Changing this forces a new resource to be created.
    ResourceObjectId string
    The object ID of the service principal representing the resource. Changing this forces a new resource to be created.
    appRoleId String
    The ID of the app role to be assigned, or the default role ID 00000000-0000-0000-0000-000000000000. Changing this forces a new resource to be created.
    principalObjectId String
    The object ID of the user, group or service principal to be assigned this app role. Supported object types are Users, Groups or Service Principals. Changing this forces a new resource to be created.
    resourceObjectId String
    The object ID of the service principal representing the resource. Changing this forces a new resource to be created.
    appRoleId string
    The ID of the app role to be assigned, or the default role ID 00000000-0000-0000-0000-000000000000. Changing this forces a new resource to be created.
    principalObjectId string
    The object ID of the user, group or service principal to be assigned this app role. Supported object types are Users, Groups or Service Principals. Changing this forces a new resource to be created.
    resourceObjectId string
    The object ID of the service principal representing the resource. Changing this forces a new resource to be created.
    app_role_id str
    The ID of the app role to be assigned, or the default role ID 00000000-0000-0000-0000-000000000000. Changing this forces a new resource to be created.
    principal_object_id str
    The object ID of the user, group or service principal to be assigned this app role. Supported object types are Users, Groups or Service Principals. Changing this forces a new resource to be created.
    resource_object_id str
    The object ID of the service principal representing the resource. Changing this forces a new resource to be created.
    appRoleId String
    The ID of the app role to be assigned, or the default role ID 00000000-0000-0000-0000-000000000000. Changing this forces a new resource to be created.
    principalObjectId String
    The object ID of the user, group or service principal to be assigned this app role. Supported object types are Users, Groups or Service Principals. Changing this forces a new resource to be created.
    resourceObjectId String
    The object ID of the service principal representing the resource. Changing this forces a new resource to be created.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    PrincipalDisplayName string
    The display name of the principal to which the app role is assigned.
    PrincipalType string
    The object type of the principal to which the app role is assigned.
    ResourceDisplayName string
    The display name of the application representing the resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    PrincipalDisplayName string
    The display name of the principal to which the app role is assigned.
    PrincipalType string
    The object type of the principal to which the app role is assigned.
    ResourceDisplayName string
    The display name of the application representing the resource.
    id String
    The provider-assigned unique ID for this managed resource.
    principalDisplayName String
    The display name of the principal to which the app role is assigned.
    principalType String
    The object type of the principal to which the app role is assigned.
    resourceDisplayName String
    The display name of the application representing the resource.
    id string
    The provider-assigned unique ID for this managed resource.
    principalDisplayName string
    The display name of the principal to which the app role is assigned.
    principalType string
    The object type of the principal to which the app role is assigned.
    resourceDisplayName string
    The display name of the application representing the resource.
    id str
    The provider-assigned unique ID for this managed resource.
    principal_display_name str
    The display name of the principal to which the app role is assigned.
    principal_type str
    The object type of the principal to which the app role is assigned.
    resource_display_name str
    The display name of the application representing the resource.
    id String
    The provider-assigned unique ID for this managed resource.
    principalDisplayName String
    The display name of the principal to which the app role is assigned.
    principalType String
    The object type of the principal to which the app role is assigned.
    resourceDisplayName String
    The display name of the application representing the resource.

    Look up Existing AppRoleAssignment Resource

    Get an existing AppRoleAssignment 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?: AppRoleAssignmentState, opts?: CustomResourceOptions): AppRoleAssignment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            app_role_id: Optional[str] = None,
            principal_display_name: Optional[str] = None,
            principal_object_id: Optional[str] = None,
            principal_type: Optional[str] = None,
            resource_display_name: Optional[str] = None,
            resource_object_id: Optional[str] = None) -> AppRoleAssignment
    func GetAppRoleAssignment(ctx *Context, name string, id IDInput, state *AppRoleAssignmentState, opts ...ResourceOption) (*AppRoleAssignment, error)
    public static AppRoleAssignment Get(string name, Input<string> id, AppRoleAssignmentState? state, CustomResourceOptions? opts = null)
    public static AppRoleAssignment get(String name, Output<String> id, AppRoleAssignmentState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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:
    AppRoleId string
    The ID of the app role to be assigned, or the default role ID 00000000-0000-0000-0000-000000000000. Changing this forces a new resource to be created.
    PrincipalDisplayName string
    The display name of the principal to which the app role is assigned.
    PrincipalObjectId string
    The object ID of the user, group or service principal to be assigned this app role. Supported object types are Users, Groups or Service Principals. Changing this forces a new resource to be created.
    PrincipalType string
    The object type of the principal to which the app role is assigned.
    ResourceDisplayName string
    The display name of the application representing the resource.
    ResourceObjectId string
    The object ID of the service principal representing the resource. Changing this forces a new resource to be created.
    AppRoleId string
    The ID of the app role to be assigned, or the default role ID 00000000-0000-0000-0000-000000000000. Changing this forces a new resource to be created.
    PrincipalDisplayName string
    The display name of the principal to which the app role is assigned.
    PrincipalObjectId string
    The object ID of the user, group or service principal to be assigned this app role. Supported object types are Users, Groups or Service Principals. Changing this forces a new resource to be created.
    PrincipalType string
    The object type of the principal to which the app role is assigned.
    ResourceDisplayName string
    The display name of the application representing the resource.
    ResourceObjectId string
    The object ID of the service principal representing the resource. Changing this forces a new resource to be created.
    appRoleId String
    The ID of the app role to be assigned, or the default role ID 00000000-0000-0000-0000-000000000000. Changing this forces a new resource to be created.
    principalDisplayName String
    The display name of the principal to which the app role is assigned.
    principalObjectId String
    The object ID of the user, group or service principal to be assigned this app role. Supported object types are Users, Groups or Service Principals. Changing this forces a new resource to be created.
    principalType String
    The object type of the principal to which the app role is assigned.
    resourceDisplayName String
    The display name of the application representing the resource.
    resourceObjectId String
    The object ID of the service principal representing the resource. Changing this forces a new resource to be created.
    appRoleId string
    The ID of the app role to be assigned, or the default role ID 00000000-0000-0000-0000-000000000000. Changing this forces a new resource to be created.
    principalDisplayName string
    The display name of the principal to which the app role is assigned.
    principalObjectId string
    The object ID of the user, group or service principal to be assigned this app role. Supported object types are Users, Groups or Service Principals. Changing this forces a new resource to be created.
    principalType string
    The object type of the principal to which the app role is assigned.
    resourceDisplayName string
    The display name of the application representing the resource.
    resourceObjectId string
    The object ID of the service principal representing the resource. Changing this forces a new resource to be created.
    app_role_id str
    The ID of the app role to be assigned, or the default role ID 00000000-0000-0000-0000-000000000000. Changing this forces a new resource to be created.
    principal_display_name str
    The display name of the principal to which the app role is assigned.
    principal_object_id str
    The object ID of the user, group or service principal to be assigned this app role. Supported object types are Users, Groups or Service Principals. Changing this forces a new resource to be created.
    principal_type str
    The object type of the principal to which the app role is assigned.
    resource_display_name str
    The display name of the application representing the resource.
    resource_object_id str
    The object ID of the service principal representing the resource. Changing this forces a new resource to be created.
    appRoleId String
    The ID of the app role to be assigned, or the default role ID 00000000-0000-0000-0000-000000000000. Changing this forces a new resource to be created.
    principalDisplayName String
    The display name of the principal to which the app role is assigned.
    principalObjectId String
    The object ID of the user, group or service principal to be assigned this app role. Supported object types are Users, Groups or Service Principals. Changing this forces a new resource to be created.
    principalType String
    The object type of the principal to which the app role is assigned.
    resourceDisplayName String
    The display name of the application representing the resource.
    resourceObjectId String
    The object ID of the service principal representing the resource. Changing this forces a new resource to be created.

    Import

    App role assignments can be imported using the object ID of the service principal representing the resource and the ID of the app role assignment (note: not the ID of the app role), e.g.

    $ pulumi import azuread:index/appRoleAssignment:AppRoleAssignment example 00000000-0000-0000-0000-000000000000/appRoleAssignment/aaBBcDDeFG6h5JKLMN2PQrrssTTUUvWWxxxxxyyyzzz
    

    -> This ID format is unique to Terraform and is composed of the Resource Service Principal Object ID and the ID of the App Role Assignment in the format {ResourcePrincipalID}/appRoleAssignment/{AppRoleAssignmentID}.

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

    Package Details

    Repository
    Azure Active Directory (Azure AD) pulumi/pulumi-azuread
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azuread Terraform Provider.
    azuread logo
    Azure Active Directory (Azure AD) v6.0.1 published on Monday, Oct 14, 2024 by Pulumi