Agents & OrchestrationSûr100100/100
Migrating Azure Functions Startup (Microsoft)
Migrates Azure Functions projects from in-process Startup hooks (FunctionsStartup, IFunctionsHostBuilder) to the isolated worker model with Program.cs service registration. Use when upgrading Azure Functions from in-process to isolated, migrating Startup.cs to Program.cs, removing Microsoft.Azure.Functions.Extensions, or converting FunctionsHostBuilderContext to HostBuilderContext. Triggers for Startup.cs, FunctionsStartup, ConfigureFunctionsWorkerDefaults, ConfigureFunctionsWebApplication, and project files (.csproj, .vbproj, .fsproj) referencing Microsoft.NET.Sdk.Functions.
ou envoie-le directement à ton agent.
Installer dans ton projet
$ curl -fsSL https://arboristhree.xyz/cli/install-skill.mjs -o /tmp/arboris-install-skill.mjs && node /tmp/arboris-install-skill.mjs migrating-azure-functions-startup__microsoft-upgrade-agent-plugins__plugins-upgrade-agent-extenders-upgrade-dotnet-upgrade-skills-lazy-cloud-0d2833b53adaMicrosoft
microsoft/upgrade-agent-plugins
Contenu à copier
---
name: migrating-azure-functions-startup
description: >
Migrates Azure Functions projects from in-process Startup hooks (FunctionsStartup,
IFunctionsHostBuilder) to the isolated worker model with Program.cs service registration. Use
when upgrading Azure Functions from in-process to isolated, migrating Startup.cs to Program.cs,
removing Microsoft.Azure.Functions.Extensions, or converting FunctionsHostBuilderContext to
HostBuilderContext. Triggers for Startup.cs, FunctionsStartup,
ConfigureFunctionsWorkerDefaults, ConfigureFunctionsWebApplication, and project files (.csproj,
.vbproj, .fsproj) referencing Microsoft.NET.Sdk.Functions.
metadata:
origin: Microsoft
discovery: lazy
traits: .NET|CSharp|VisualBasic|DotNetCore
---
# Azure Functions Startup Hooks Migration
## Overview
Migrate Azure Functions from the in-process model (using `FunctionsStartup` and `IFunctionsHostBuilder`) to the isolated worker model, moving all service registrations and configuration from `Startup.cs` into `Program.cs`.
> **Related skill:** For upgrading an already-isolated project to the V2 hosting pattern (IHostApplicationBuilder), use `migrating-azure-functions-to-v2` instead.
The startup file may not be named `Startup.cs`.Identify it by looking for classes inheriting `FunctionsStartup`, usage of `IFunctionsHostBuilder` or `FunctionsHostBuilderContext`, or the `[assembly: FunctionsStartup(...)]` attribute. Throughout this skill, "Startup.cs" refers to whichever file contains these patterns.
## Workflow
Track progress using this checklist:
```
Migration Progress:
- [ ] Phase 1, Step 1: Get target framework
- [ ] Phase 1, Step 2: Determine in-process vs isolated
- [ ] Phase 1, Step 3: Determine upgrade path
- [ ] Phase 1, Step 4: Check ASP.NET Core integration
- [ ] Phase 2, Step 1: Remove obsolete packages
- [ ] Phase 2, Step 2: Comment out Startup.cs
- [ ] Phase 2, Step 3: Create or update Program.cs
- [ ] Phase 2, Step 4: Migrate service registrations
- [ ] Phase 2, Step 5: Handle build failures
- [ ] Phase 2, Step 6: Verify
```
### Phase 1: Assessment
#### Step 1: Get Target Framework
Open the project file and note `<TargetFramework>` (net6.0, net8.0, net9.0, etc.).
#### Step 2: Determine In-Process vs Isolated
**In-process indicators** (project file):
```xml
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.x.x" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Http" Version="3.x.x" />
```
**Isolated indicators** (project file):
```xml
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="x.x.x" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="x.x.x" />
```
Additional signals: in-process uses `[FunctionName]` attribute; isolated has `Program.cs` with a host builder.
#### Step 3: Determine Upgrade Path
- **Already isolated** → skip to Phase 2.
- **.NET 8 in-process** → ask user whether to also upgrade the framework, or just switch to isolated model.
- **.NET 6 in-process** → upgrade to .NET 8+ using isolated worker model (start .NET upgrade scenario flow).
#### Step 4: Check ASP.NET Core Integration
Determine whether the project uses ASP.NET Core integration. This controls the builder method in Program.cs:
- **With ASP.NET Core** → `ConfigureFunctionsWebApplication()`
- **Without** → `ConfigureFunctionsWorkerDefaults()`
### Phase 2: Execution
#### Step 1: Remove Obsolete Packages
Remove `Microsoft.Azure.Functions.Extensions` from the project file. This package only supports in-process and causes build conflicts with the isolated model.
#### Step 2: Comment Out Startup.cs
Comment out the entire class rather than deleting the file — this preserves the original code as a rollback reference until the user verifies the migration works.
```csharp
// Logic has been moved to Program.cs. Delete this file once migration is verified.
/*
[assembly: FunctionsStartup(typeof(MyNamespace.Startup))]
namespace MyNamespace
{
public class Startup : FunctionsStartup
{
public override void Configure(IFunctionsHostBuilder builder)
{
builder.Services.AddSingleton<IMyService, MyService>();
}
}
}
*/
```
#### Step 3: Create or Update Program.cs
Use the appropriate builder method based on Step 4 above.
**Without ASP.NET Core integration:**
```csharp
using Microsoft.Azure.Functions.Worker;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
var host = new HostBuilder()
.ConfigureFunctionsWorkerDefaults()
.ConfigureServices((context, services) =>
{
// Migrated from Startup.cs
})
.Build();
host.Run();
```
**With ASP.NET Core integration:**
```csharp
using Microsoft.Azure.Functions.Worker;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
var host = new HostBuilder()
.ConfigureFunctionsWebApplication()
.ConfigureServices((context, services) =>
{
// Migrated from Startup.cs
})
.Build();
host.Run();
```
#### Step 4: Migrate Service Registrations
Move all registrations from `IFunctionsHostBuilder.Services` into the `ConfigureServices` lambda.
If `FunctionsHostBuilderContext` was used, replace with `HostBuilderContext` and add a comment explaining the scope change — in the in-process model, custom configuration could influence the host; in isolated mode it applies to the worker only.
**Before (Startup.cs):**
```csharp
public override void Configure(IFunctionsHostBuilder builder)
{
var context = builder.GetContext();
var connectionString = context.Configuration["ConnectionStrings:MyDb"];
builder.Services.AddSingleton<IMyService, MyService>();
builder.Services.AddDbContext<MyDbContext>(options =>
options.UseSqlServer(connectionString));
}
```
**After (Program.cs):**
```csharp
.ConfigureServices((context, services) =>
{
// Note: Custom configuration sources now apply to worker only (not host).
var connectionString = context.Configuration["ConnectionStrings:MyDb"];
services.AddSingleton<IMyService, MyService>();
services.AddDbContext<MyDbContext>(options =>
options.UseSqlServer(connectionString));
})
```
#### Step 5: Handle Build Failures
If build errors persist after migration, add a placeholder to signal incomplete migration and notify the user that manual review is required:
```csharp
.ConfigureServices((context, services) =>
{
throw new NotImplementedException(
"Migrate services from Startup.cs to ConfigureServices within Program.cs.");
})
```
#### Step 6: Verify
Confirm:
- Isolated worker packages are referenced; no in-process packages remain
- `Microsoft.Azure.Functions.Extensions` is removed
- Startup.cs is commented out with a deletion note
- Program.cs uses the correct builder method
- All service registrations and configuration are migrated
- Project builds without errors
Notify the user to review the migration, test all functions, and delete `Startup.cs` once verified.
## Success Criteria
- Project uses isolated worker model (`Microsoft.Azure.Functions.Worker` packages)
- No in-process packages remain (`Microsoft.NET.Sdk.Functions`, `Microsoft.Azure.WebJobs.*`)
- `Microsoft.Azure.Functions.Extensions` removed
- Startup.cs commented out (not deleted) with migration note
- Program.cs uses correct builder method
- All service registrations migrated; `FunctionsHostBuilderContext` replaced with `HostBuilderContext`
- Project builds without errors
## References
- [Migrate to isolated worker model](https://learn.microsoft.com/en-us/azure/azure-functions/migrate-dotnet-to-isolated-model?tabs=net8)
- [Isolated process guide](https://learn.microsoft.com/en-us/azure/azure-functions/dotnet-isolated-process-guide?tabs=hostbuilder%2Cwindows)
- [Dependency injection in Azure Functions](https://learn.microsoft.com/en-us/azure/azure-functions/functions-dotnet-dependency-injection)
- [ASP.NET Core integration](https://learn.microsoft.com/en-us/azure/azure-functions/dotnet-isolated-process-guide?tabs=hostbuilder%2Cwindows#aspnet-core-integration)Colle ce Markdown dans ton agent ou utilise les boutons ci-dessus pour l’écrire dans ton projet.
Ce que fait Migrating Azure Functions Startup (Microsoft)
[ ] Phase 1, Step 1: Get target framework
[ ] Phase 1, Step 2: Determine in-process vs isolated
[ ] Phase 1, Step 3: Determine upgrade path
[ ] Phase 1, Step 4: Check ASP.NET Core integration
Comment utiliser Migrating Azure Functions Startup (Microsoft)
1
Copie le prompt
Un clic copie le prompt packagé (ou l'envoie à ton agent).
2
L'agent installe le skill
Il ajoute le SKILL.md et ses ressources à ton projet.
3
Activation automatique
Le skill s'active dès que le contexte correspond.
Déclencheurs pour Migrating Azure Functions Startup (Microsoft)
Dis simplement à ton agent quelque chose comme :
Applique le skill migrating-azure-functions-startup__microsoft-upgrade-agent-plugins__plugins-upgrade-agent-extenders-upgrade-dotnet-upgrade-skills-lazy-cloud-0d2833b53ada à cette tâche
Utilise migrating-azure-functions-startup__microsoft-upgrade-agent-plugins__plugins-upgrade-agent-extenders-upgrade-dotnet-upgrade-skills-lazy-cloud-0d2833b53ada pour améliorer cette implémentation
Passe en revue ce sujet avec migrating-azure-functions-startup__microsoft-upgrade-agent-plugins__plugins-upgrade-agent-extenders-upgrade-dotnet-upgrade-skills-lazy-cloud-0d2833b53ada
Skills liés à Migrating Azure Functions Startup (Microsoft)
Acceleration (Microsoft)
Compare synthetic acceleration options and clearly separate scenario value from forecast commitments.Account Overview (Microsoft)
Create a synthetic Acme account overview and identify evidence that merits seller attention.Acroform Writer (Microsoft)
Use this skill whenever the user wants values written INTO an existing PDF form that lives in the connected SharePoint knowledge source — filling out, completing, populating, or submitting a fillable PDF (application, intake sheet, contract, government form) from data they supply, a spreadsheet row, or the conversation. Triggers include "fill out the job application form", "complete the intake form for [person]", "populate our standard NDA template", and "make this ready to send / non-editable" (flatten). The source form should be found via knowledge search; only ask the user to upload it if knowledge search turns up nothing plausible. different task), and do NOT use it on scanned/image-only PDFs that have no real fillable fields — those need OCR or manual overlay instead, which this skill explicitly detects and reports rather than silently failing.