Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aspire: Support Azure Functions Prototype #4252

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ellismg
Copy link
Member

@ellismg ellismg commented Aug 26, 2024

The Aspire team has started to prototype Azure Functions support and this PR is the start of the support in azd for this deployment target under Aspire.

In the current prototype, Aspire models this as a new function.v0 resource type, which azd has special knowledge of. We need to do two special things with this resource type:

  1. When generating IaC for the project, we need to generate IaC that allows us to use the Functions on ACA feature (where we can create a Microsoft.Web/sites resource with correct configuration to run a functions app on an existing container app environment)

  2. Since function projects do not support using dotnet publish to produce a container image (there is work in flight to support this), we require a Dockerfile at the root of the project, which we docker build.

In the next phase of the prototype, we will replace function.v0 with project.v0, so the function.v0 manifest type will not live forever, but until, dotnet run and dotnet publish works as expected for Azure Functions projects, we'll continue to model this as its own type in the manifest.

Note that there are still a lot of rough edges here... The initial azd up works if you ensure your function app name in the app host is unique across all of azure but future updates seem to hang. Also, none of the corresponding aspire support is in tree yet, so this is not something that anyone can just pick up and use right now, but I want to get the work out from behind our -pr repository and rebased on top of the latest main as we are starting to pick up steam on this work.

The Aspire team has started to prototype Azure Functions support and
this PR is the start of the support in `azd` for this deployment
target under Aspire.

In the current prototype, Aspire models this as a new `function.v0` resource type, which `azd` has special knowledge of. We need to do two special things with this resource type:

1. When generating IaC for the project, we need to generate IaC that
allows us to use the Functions on ACA feature (where we can create a
`Microsoft.Web/sites` resource with correct configuration to run a
functions app on an existing container app environment)

2. Since function projects do not support using `dotnet publish` to
produce a container image (there is work in flight to support this),
we require a `Dockerfile` at the root of the project, which we `docker
build`.

In the next phase of the prototype, we will replace `function.v0` with
`project.v0`, so the `function.v0` manifest type will not live
forever, but until, `dotnet run` and `dotnet publish` works as
expected for Azure Functions projects, we'll continue to model this as
its own type in the manifest.

Note that there are still a lot of rough edges here... The initial
`azd up` works if you ensure your function app name in the app host is
unique across all of `azure` but future updates seem to hang. Also,
none of the corresponding aspire support is in tree yet, so this is
not something that anyone can just pick up and use right now, but I
want to get the work out from behind our `-pr` repository and rebased
on top of the latest main as we are starting to pick up steam on this
work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant