# AzureDaprHostingExtensions Methods

- Package: [CommunityToolkit.Aspire.Hosting.Azure.Dapr](/reference/api/csharp/communitytoolkit.aspire.hosting.azure.dapr.md)
- Type: [AzureDaprHostingExtensions](/reference/api/csharp/communitytoolkit.aspire.hosting.azure.dapr/azuredaprhostingextensions.md)
- Kind: `Methods`
- Members: `3`

Provides extension methods for configuring Dapr components in an Azure hosting environment.

## AddAzureDaprResource(IResourceBuilder<IDaprComponentResource>, string, Action<AzureResourceInfrastructure>)

- Name: `AddAzureDaprResource(IResourceBuilder<IDaprComponentResource>, string, Action<AzureResourceInfrastructure>)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<AzureDaprComponentResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/30a4b632065206d447183d2baabf6dfb3678d4af/src/CommunityToolkit.Aspire.Hosting.Azure.Dapr/AzureDaprHostingExtensions.cs#L28-L38)

Adds an Azure Dapr resource to the resource builder.

```csharp
public static class AzureDaprHostingExtensions
{
    public static IResourceBuilder<AzureDaprComponentResource> AddAzureDaprResource(
        this IResourceBuilder<IDaprComponentResource> builder,
        string name,
        Action<AzureResourceInfrastructure> configureInfrastructure)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<IDaprComponentResource>`)
  The resource builder.
- `name` (`string`)
  The name of the Dapr resource.
- `configureInfrastructure` (`Action<AzureResourceInfrastructure>`)
  The action to configure the Azure resource infrastructure.

## Returns

`IResourceBuilder<AzureDaprComponentResource>` -- The updated resource builder.

## AddScopes(IResourceBuilder<IDaprComponentResource>, ContainerAppManagedEnvironmentDaprComponent)

- Name: `AddScopes(IResourceBuilder<IDaprComponentResource>, ContainerAppManagedEnvironmentDaprComponent)`
- Modifiers: `extension`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/30a4b632065206d447183d2baabf6dfb3678d4af/src/CommunityToolkit.Aspire.Hosting.Azure.Dapr/AzureDaprHostingExtensions.cs#L48-L72)

Adds scopes to the specified Dapr component in a container app managed environment.

```csharp
public static class AzureDaprHostingExtensions
{
    public static void AddScopes(
        this IResourceBuilder<IDaprComponentResource> builder,
        ContainerAppManagedEnvironmentDaprComponent daprComponent)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<IDaprComponentResource>`)
  The resource builder.
- `daprComponent` (`ContainerAppManagedEnvironmentDaprComponent`)
  The Dapr component to add scopes to.

## CreateDaprComponent(string, BicepValue<string>, string, string)

- Name: `CreateDaprComponent(string, BicepValue<string>, string, string)`
- Modifiers: `static`
- Returns: `ContainerAppManagedEnvironmentDaprComponent`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/30a4b632065206d447183d2baabf6dfb3678d4af/src/CommunityToolkit.Aspire.Hosting.Azure.Dapr/AzureDaprHostingExtensions.cs#L88-L97)

Creates a new Dapr component for a container app managed environment.

```csharp
public static class AzureDaprHostingExtensions
{
    public static ContainerAppManagedEnvironmentDaprComponent CreateDaprComponent(
        string bicepIdentifier,
        BicepValue<string> name,
        string componentType,
        string version)
    {
        // ...
    }
}
```

## Parameters

- `bicepIdentifier` (`string`)
  The name of the resource.
- `name` (`BicepValue<string>`)
  The name of the dapr component
- `componentType` (`string`)
  The type of the Dapr component.
- `version` (`string`)
  The version of the Dapr component.

## Returns

`ContainerAppManagedEnvironmentDaprComponent` -- A new instance of `AppContainers.ContainerAppManagedEnvironmentDaprComponent`.
