# AzureRoleAssignmentResource Constructors

- Package: [Aspire.Hosting.Azure](/reference/api/csharp/aspire.hosting.azure.md)
- Type: [AzureRoleAssignmentResource](/reference/api/csharp/aspire.hosting.azure/azureroleassignmentresource.md)
- Kind: `Constructors`
- Members: `1`

Represents a set of Azure role assignments granted on a target Azure resource.

## AzureRoleAssignmentResource(string, AzureProvisioningResource, IResource?, AzureUserAssignedIdentityResource?, Action<AzureResourceInfrastructure>)

- Name: `Constructor(string, AzureProvisioningResource, IResource?, AzureUserAssignedIdentityResource?, Action<AzureResourceInfrastructure>)`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure/AzureRoleAssignmentResource.cs#L28-L51)

Represents a set of Azure role assignments granted on a target Azure resource.

```csharp
public sealed class AzureRoleAssignmentResource
{
    public AzureRoleAssignmentResource(
        string name,
        AzureProvisioningResource targetAzureResource,
        IResource? ownerResource,
        AzureUserAssignedIdentityResource? identityResource,
        Action<AzureResourceInfrastructure> configureInfrastructure)
    {
        // ...
    }
}
```

## Parameters

- `name` (`string`)
  The name of the resource in the distributed application model.
- `targetAzureResource` ([AzureProvisioningResource](/reference/api/csharp/aspire.hosting.azure/azureprovisioningresource.md))
  The Azure resource that the roles are assigned on.
- `ownerResource` (`IResource?`)
  The Aspire resource that owns this set of role assignments, or `null` for global role assignments granted to the deployment principal.
- `identityResource` ([AzureUserAssignedIdentityResource?](/reference/api/csharp/aspire.hosting.azure/azureuserassignedidentityresource.md))
  The user-assigned managed identity whose principal receives the role assignments, or `null` for global role assignments granted to the deployment principal.
- `configureInfrastructure` (`Action<AzureResourceInfrastructure>`)
  Callback to configure the Azure role assignment resources.

## Remarks

When [AzureRoleAssignmentResource.OwnerResource](/reference/api/csharp/aspire.hosting.azure/azureroleassignmentresource/properties.md#ownerresource) is non- `null`, the role assignments are granted to the managed identity ( [AzureRoleAssignmentResource.IdentityResource](/reference/api/csharp/aspire.hosting.azure/azureroleassignmentresource/properties.md#identityresource)) owned by that Aspire resource. When [AzureRoleAssignmentResource.OwnerResource](/reference/api/csharp/aspire.hosting.azure/azureroleassignmentresource/properties.md#ownerresource) is `null`, the role assignments are global and are granted to the deployment principal.
