AzureFunctionsProjectResourceExtensions Methods
AzureFunctionsProjectResource. AddAzureFunctionsProject(IDistributedApplicationBuilder, string) Section titled AddAzureFunctionsProject(IDistributedApplicationBuilder, string) extension IResourceBuilder<AzureFunctionsProjectResource> public static class AzureFunctionsProjectResourceExtensions{ public static IResourceBuilder<AzureFunctionsProjectResource> AddAzureFunctionsProject<TProject>( this IDistributedApplicationBuilder builder, string name) { // ... }}Parameters
builder IDistributedApplicationBuilder The Hosting.IDistributedApplicationBuilder to which the Azure Functions project will be added. name string The name to be associated with the Azure Functions project. This name will be used for service discovery when referenced in a dependency. Returns
IResourceBuilder<AzureFunctionsProjectResource> An ApplicationModel.IResourceBuilder`1 for the added Azure Functions project resource. Remarks
When Functions projects are deployed to Azure Container Apps, they are provisioned with the container app kind property set to functionapp. This enables KEDA auto-scaler rules to be automatically configured based on the Azure Functions triggers defined in the project.
By default, an implicit Azure Storage account is provisioned to be used as host storage for the Functions runtime. This storage account is required by the Azure Functions runtime for operations such as managing triggers, logging function executions, and coordinating instances. The implicit storage account is assigned the following roles:
For more information, see Azure Functions host storage. StorageBuiltInRole.StorageBlobDataContributorStorageBuiltInRole.StorageTableDataContributorStorageBuiltInRole.StorageQueueDataContributorStorageBuiltInRole.StorageAccountContributor
Use AzureFunctionsProjectResourceExtensions.WithHostStorage to specify a custom Azure Storage resource as the host storage instead of the implicit default storage account.
AddAzureFunctionsProject(IDistributedApplicationBuilder, string, string) Section titled AddAzureFunctionsProject(IDistributedApplicationBuilder, string, string) extension IResourceBuilder<AzureFunctionsProjectResource> public static class AzureFunctionsProjectResourceExtensions{ public static IResourceBuilder<AzureFunctionsProjectResource> AddAzureFunctionsProject( this IDistributedApplicationBuilder builder, string name, string projectPath) { // ... }}Parameters
builder IDistributedApplicationBuilder The Hosting.IDistributedApplicationBuilder to which the Azure Functions project will be added. name string The name to be associated with the Azure Functions project. This name will be used for service discovery when referenced in a dependency. projectPath string The path to the Azure Functions project file. Returns
IResourceBuilder<AzureFunctionsProjectResource> An ApplicationModel.IResourceBuilder`1 for the added Azure Functions project resource. Remarks
This overload of the AzureFunctionsProjectResourceExtensions.AddAzureFunctionsProject method adds an Azure Functions project to the application model using a path to the project file. This allows for projects to be referenced that may not be part of the same solution. If the project path is not an absolute path then it will be computed relative to the app host directory.
When Functions projects are deployed to Azure Container Apps, they are provisioned with the container app kind property set to functionapp. This enables KEDA auto-scaler rules to be automatically configured based on the Azure Functions triggers defined in the project.
By default, an implicit Azure Storage account is provisioned to be used as host storage for the Functions runtime. This storage account is required by the Azure Functions runtime for operations such as managing triggers, logging function executions, and coordinating instances. The implicit storage account is assigned the following roles:
For more information, see Azure Functions host storage. StorageBuiltInRole.StorageBlobDataContributorStorageBuiltInRole.StorageTableDataContributorStorageBuiltInRole.StorageQueueDataContributorStorageBuiltInRole.StorageAccountContributor
Use AzureFunctionsProjectResourceExtensions.WithHostStorage to specify a custom Azure Storage resource as the host storage instead of the implicit default storage account.
var builder = DistributedApplication.CreateBuilder(args);
builder.AddAzureFunctionsProject( "funcapp", @"..\MyFunctions\MyFunctions.csproj");
builder.Build().Run();WithHostStorage(IResourceBuilder<AzureFunctionsProjectResource>, IResourceBuilder<AzureStorageResource>) Section titled WithHostStorage(IResourceBuilder<AzureFunctionsProjectResource>, IResourceBuilder<AzureStorageResource>) extension IResourceBuilder<AzureFunctionsProjectResource> public static class AzureFunctionsProjectResourceExtensions{ public static IResourceBuilder<AzureFunctionsProjectResource> WithHostStorage( this IResourceBuilder<AzureFunctionsProjectResource> builder, IResourceBuilder<AzureStorageResource> storage) { // ... }}Parameters
builder IResourceBuilder<AzureFunctionsProjectResource> The resource builder for the Azure Functions project resource. storage IResourceBuilder<AzureStorageResource> The resource builder for the Azure Storage resource to be used as host storage. Returns
IResourceBuilder<AzureFunctionsProjectResource> The resource builder for the Azure Functions project resource, configured with the specified host storage. WithReference(IResourceBuilder<AzureFunctionsProjectResource>, IResourceBuilder<TSource>, string?) Section titled WithReference(IResourceBuilder<AzureFunctionsProjectResource>, IResourceBuilder<TSource>, string?) extension IResourceBuilder<AzureFunctionsProjectResource> public static class AzureFunctionsProjectResourceExtensions{ public static IResourceBuilder<AzureFunctionsProjectResource> WithReference<TSource>( this IResourceBuilder<AzureFunctionsProjectResource> destination, IResourceBuilder<TSource> source, string? connectionName = null) { // ... }}Parameters
destination IResourceBuilder<AzureFunctionsProjectResource> The resource where connection information will be injected. source IResourceBuilder<TSource> The resource from which to extract the connection string. connectionName string? optional An override of the source resource's name for the connection name. The resulting connection name will be connectionName if this is not null.