# AzureRoleAssignmentResource

- Kind: `class`
- Package: [Aspire.Hosting.Azure](/reference/api/csharp/aspire.hosting.azure.md)
- Version: `13.4.0`
- Namespace: `Aspire.Hosting.Azure`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure/AzureRoleAssignmentResource.cs)
- Inherits: [AzureProvisioningResource](/reference/api/csharp/aspire.hosting.azure/azureprovisioningresource.md)

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

## Definition

```csharp
namespace Aspire.Hosting.Azure;

public sealed class AzureRoleAssignmentResource
    : Aspire.Hosting.Azure.AzureProvisioningResource
{
    // ...
}
```

## 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.

## Constructors

- [AzureRoleAssignmentResource(string, AzureProvisioningResource, IResource?, AzureUserAssignedIdentityResource?, Action<AzureResourceInfrastructure>)](/reference/api/csharp/aspire.hosting.azure/azureroleassignmentresource/constructors.md#constructor-string-azureprovisioningresource-iresource-azureuserassignedidentityresource-action-azureresourceinfrastructure) -- Represents a set of Azure role assignments granted on a target Azure resource.

## Properties

- [IdentityResource](/reference/api/csharp/aspire.hosting.azure/azureroleassignmentresource/properties.md#identityresource) : [AzureUserAssignedIdentityResource?](/reference/api/csharp/aspire.hosting.azure/azureuserassignedidentityresource.md) `get` -- Gets the user-assigned managed identity whose principal receives the role assignments, or `null` for global role assignments that are granted to the deployment principal.
- [OwnerResource](/reference/api/csharp/aspire.hosting.azure/azureroleassignmentresource/properties.md#ownerresource) : `IResource?` `get` -- Gets the Aspire resource that owns this set of role assignments, or `null` for global role assignments that are granted to the deployment principal.
- [TargetAzureResource](/reference/api/csharp/aspire.hosting.azure/azureroleassignmentresource/properties.md#targetazureresource) : [AzureProvisioningResource](/reference/api/csharp/aspire.hosting.azure/azureprovisioningresource.md) `get` -- Gets the Azure resource that the roles are assigned on.
