i need ci pipeline yaml file for isolated worker model deployment

Jinugu, Manasa 0 Reputation points
2025-12-02T18:28:58.92+00:00

i need ci pipeline yaml file for isolated worker model deployment, isolated creating .azurefunctions folder, the dlls in this folder are not copying to the wwwroot/bin folder and getting cast exceptions.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
{count} votes

2 answers

Sort by: Most helpful
  1. Q&A Assist
    2025-12-02T18:29:09.52+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To create a CI pipeline YAML file for deploying an Azure Functions project using the isolated worker model, you need to ensure that the build process correctly handles the .azurefunctions folder and the DLLs. Below is a sample YAML configuration that you can adapt for your needs:

    trigger:
      branches:
        include:
          - main
    
    pool:
      vmImage: 'windows-latest'
    
    steps:
    - task: DotNetCoreCLI@2
      inputs:
        command: 'restore'
        projects: '**/*.csproj'
    
    - task: DotNetCoreCLI@2
      inputs:
        command: 'build'
        projects: '**/*.csproj'
        arguments: '--configuration Release'
    
    - task: DotNetCoreCLI@2
      inputs:
        command: 'publish'
        projects: '**/*.csproj'
        arguments: '--configuration Release --output $(Build.ArtifactStagingDirectory)'
    
    - task: ArchiveFiles@2
      inputs:
        rootFolderOrFile: '$(Build.ArtifactStagingDirectory)'
        includeRootFolder: false
        archiveType: 'zip'
        archiveFile: '$(Build.ArtifactStagingDirectory)/functionapp.zip'
        replaceExistingArchive: true
    
    - task: PublishBuildArtifacts@1
      inputs:
        PathtoPublish: '$(Build.ArtifactStagingDirectory)/functionapp.zip'
        ArtifactName: 'functionapp'
        publishLocation: 'Container'
    

    Key Points:

    1. Restore: The pipeline restores the NuGet packages required for the project.
    2. Build: The project is built in Release configuration.
    3. Publish: The output is published to a specified directory, which should include the .azurefunctions folder and the necessary DLLs.
    4. Archive: The published files are archived into a zip file for deployment.
    5. Publish Artifacts: The zip file is published as an artifact for later use in the release pipeline.

    Ensure that your project structure aligns with the expected output for Azure Functions, particularly that the .azurefunctions folder and DLLs are correctly included in the published output.

    If you are experiencing issues with the DLLs not copying to the wwwroot/bin folder, ensure that your project file is configured to output the necessary files correctly during the publish step.


    References:

    0 comments No comments

  2. Pravallika KV 2,845 Reputation points Microsoft External Staff Moderator
    2025-12-02T18:41:27.54+00:00

    Hi Jinugu, Manasa,

    Thanks for reaching out to Microsoft Q&A.

    Below is the example YAML configuration for your CI pipeline. Adjust this as per your project structure and needs:

    trigger:
    - main  # Change this to your default branch
    
    pool:
      vmImage: 'ubuntu-latest'  # Use an appropriate image
    
    steps:
    - task: UseDotNet@2
      inputs:
        packageType: 'sdk'
        version: '8.0.x'  # Specify the SDK version required for .NET 8.0
        installationPath: $(Agent.ToolsDirectory)/dotnet
    
    - script: |
        dotnet restore
        dotnet build --configuration Release
        dotnet publish --configuration Release --output $(Build.ArtifactStagingDirectory)
      displayName: 'Build project'
    
    - task: PublishBuildArtifacts@1
      inputs:
        PathtoPublish: '$(Build.ArtifactStagingDirectory)'
        ArtifactName: 'drop'
        publishLocation: 'Container'
    
    - task: AzureFunctionApp@1
      inputs:
        azureSubscription: 'YOUR-SUBSCRIPTION-NAME'  # Azure subscription service connection
        appType: 'functionApp'
        appName: 'YOUR-FUNCTION-APP-NAME'
        package: '$(Pipeline.Workspace)/drop/**.zip'
    

    Important Steps to Ensure DLLs Copy Properly:

    1. Ensure that your project folder structure aligns with what Azure Functions requires. The FUNCTIONS_WORKER_RUNTIME environment variable should be set properly to dotnet-isolated.
    2. In your .csproj file, make sure you have the following configurations:
       <PropertyGroup>
        <TargetFramework>net8.0</TargetFramework>
        <Isolated>true</Isolated>
       </PropertyGroup>
    
    1. Make sure the deployable ZIP archive contains the .azurefunctions/ directory along with other necessary files like extensions.json, host.json, etc., following the Deployment requirements.

    Hope it helps!


    Please do not forget to click "Accept the answer” and Yes, this can be beneficial to other community members.

    User's image

    If you have any other questions, let me know in the "comments" and I would be happy to help you.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.