# WithContainerRegistryRoleAssignments

- Module: [Aspire.Hosting.Azure.ContainerRegistry](/reference/api/go/aspire.hosting.azure.containerregistry.md)
- Version: `17.0.0`
- Kind: `method`
- Defined on: `Resource`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/bcfa151cdca6d0a573f22d5d9c23f9c727cb3b2f)

Adds role assignments to the specified Azure Container Registry resource.

## Definition

```go
func (Resource) WithContainerRegistryRoleAssignments(
    target AzureContainerRegistryResource,
    roles []AzureContainerRegistryRole,
) Resource
```

## Parameters

- `target` ([`AzureContainerRegistryResource`](/reference/api/go/aspire.hosting.azure.containerregistry/azurecontainerregistryresource.md)) -- The target Azure Container Registry resource.
- `roles` ([`[]AzureContainerRegistryRole`](/reference/api/go/aspire.hosting.azure.containerregistry/azurecontainerregistryrole.md)) -- The Azure Container Registry roles to assign to the resource.

## Returns

`Resource` -- The resource builder.

Returns a handle; failures surface later via `Err()`.

## Applies to

- [`AzureBicepResource`](/reference/api/go/aspire.hosting.azure.containerregistry/azurebicepresource.md)
- [`AzureContainerRegistryResource`](/reference/api/go/aspire.hosting.azure.containerregistry/azurecontainerregistryresource.md)
- [`AzureEnvironmentResource`](/reference/api/go/aspire.hosting.azure.containerregistry/azureenvironmentresource.md)
- [`AzureProvisioningResource`](/reference/api/go/aspire.hosting.azure.containerregistry/azureprovisioningresource.md)
- [`AzureUserAssignedIdentityResource`](/reference/api/go/aspire.hosting.azure.containerregistry/azureuserassignedidentityresource.md)
- `CSharpAppResource`
- `ContainerRegistryResource`
- `ContainerResource`
- `DotnetToolResource`
- `ExecutableResource`
- `ExternalServiceResource`
- `ParameterResource`
- `ProjectResource`
