Deploying a Blazor Server-Side Application to Azure App Service Using GitHub Actions
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (179).NET Core  (28).NET MAUI  (214)Angular  (110)ASP.NET  (51)ASP.NET Core  (83)ASP.NET MVC  (90)Azure  (41)Black Friday Deal  (1)Blazor  (226)BoldSign  (15)DocIO  (24)Essential JS 2  (109)Essential Studio  (200)File Formats  (69)Flutter  (133)JavaScript  (226)Microsoft  (120)PDF  (81)Python  (1)React  (105)Streamlit  (1)Succinctly series  (131)Syncfusion  (942)TypeScript  (33)Uno Platform  (3)UWP  (3)Vue  (45)Webinar  (52)Windows Forms  (61)WinUI  (71)WPF  (163)Xamarin  (160)XlsIO  (38)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (9)Business intelligence  (55)Button  (4)C#  (158)Chart  (140)Chart of the week  (54)Cloud  (15)Company  (443)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (70)Development  (658)Doc  (8)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (7)Essential Tools  (14)Excel  (43)Extensions  (22)File Manager  (7)Gantt  (19)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (512)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (43)Performance  (12)PHP  (2)PivotGrid  (4)Predictive Analytics  (6)Report Server  (3)Reporting  (10)Reporting / Back Office  (11)Rich Text Editor  (12)Road Map  (12)Scheduler  (54)Security  (4)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (31)Solution Services  (4)Spreadsheet  (11)SQL  (14)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (393)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (19)Web  (614)What's new  (333)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
Deploying a Blazor Server-Side Application to Azure App Service Using GitHub Actions

Deploying a Blazor Server-Side Application to Azure App Service Using GitHub Actions

GitHub Actions is a CI/CD platform that helps us to automate the deployment process of applications using the GitHub repository. We can build, test, and deploy our applications to the Azure App Service using GitHub Actions. This blog will demonstrate the procedure to deploy a Blazor server-side app to the Azure App Service using GitHub Actions.


Before starting to create and deploy the Blazor application, you need to have the following tools installed:

Step 1: Create Azure Web App in Azure App Service

Microsoft’s Azure App Service is a platform as a service (PaaS) solution. We can use it to host web apps, REST APIs, and backend services for mobile apps. In this blog, we use Azure App Service to host a Blazor server-side application as a web app.

First, open the Azure portal and select Azure App Service. Then, click Create to create an Azure web app.

After that, you need to enter several details to finalize the Azure web app.

Creating Azure Web App in Azure App Service

In the previously pictured form, select the resource group first. If there isn’t a resource group, create a resource group by clicking Create New. Second, provide a unique name for the app. Third, select the runtime stack to build and run the application. For this example, I select .NET 6 as the runtime stack for the Blazor server-side application, Linux as the operating system, and East Asia as the region.

Once the application is created, click on the application name. Now, you will see an option named Get publish profile. Make sure to download the published profile from there and save it locally, since we will use it in one of the next steps with the GitHub Repository.

Click on Get publish profile

Step 2: Create the Blazor Server-Side Application

In this step, we create a Blazor server-side application using Visual Studio 2022. First, open Visual Studio and create a new project with the Blazor Server App template. Then, select .NET 6 as the framework for this project.

Creating the Blazor Server-Side Application

After creating the project, run it, and check that everything is working.

Step 3: Configure the YAML File for GitHub Workflow

Now, we create the YAML file to create the GitHub workflow for GitHub Actions. First, navigate to the Blazor application project folder created in the previous step. Then, create a directory named .github followed by a directory named workflows inside the .github directory.

After that, create a YAML file named demo.yml inside the workflows directory and update it with the following code.

name: Build and deploy Blazor App
# use this 'on' to trigger the workflow
  push: # trigger when pushing the commits into main branch
      - main

    runs-on: windows-latest  # OS or machine to run each job
    steps: # steps - series of tasks to run the job
      - uses: actions/checkout@v2#Setup .NET Core SDK
      - name: Set up .NET Core
        uses: actions/setup-dotnet@v1
        with:# Use latest version of dotnet 6
          dotnet-version: '6.0.x'# include pre-release of dotnet
          include-prerelease: true
      - name: Build with dotnet# run the command for build the dotnet app
        run: dotnet build --configuration Release

      - name: dotnet publish# run the command to pack the build files and dependencies into folder for deployment
        run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp

      - name: Upload artifact for deployment job#Reference a specific upload artifact
        uses: actions/upload-artifact@v2

          name: .net-app
          path: ${{env.DOTNET_ROOT}}/myapp

    runs-on: windows-latest
    needs: build #contains the output from the build job#set environment
      name: 'Production'# use deploy-to-webapp step in the job and look at the output of the dependent job. Then find the webapp-url and set it for URL in the environment
      url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

      - name: Download artifact from build job#Reference a specific download artifact from build job
        uses: actions/download-artifact@v2
          name: .net-app

      - name: Deploy to Azure Web App
        id: deploy-to-webapp# Reference the deploy web app
        uses: azure/webapps-deploy@v2
        with:#use app name
          app-name: 'blazordemo-git'
          slot-name: 'Production'#use publish profile from the GitHub secrets
          publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE }}
          package: .

In the previous script, the name property in the first line is issued to define the GitHub workflow name. Then, the trigger conditions are defined to execute the workflow. Based on these configurations, the workflow will be triggered when a commit is pushed into the main branch.

After that, a new job is initialized to build the Blazor server-side application. We include the necessary commands to build the application. Finally, a new deployment job is created to deploy the application to the Azure App Service as a web app. In this example, I have used secrets from the publish profile. I will show you how to create this in the next step. The publish profile contains information and settings used to deploy the application to Azure.

Step 4: Configure the Secrets and Deploy the Application

In this step, we create a GitHub repository for the Blazor application and add secret data to it. For this, we need to use the publish profile downloaded in step 1.

Configuring the Secrets

After adding the secret data, we push the changes to the GitHub repository. Then, the action will trigger and start the GitHub workflow. It will run two jobs, one to build and another to deploy the application. You can check the status of the action in the Action tab, as shown in the following screenshot.

Push the changes to the GitHub repository

Once the application is deployed, go to the portal and check the created web app.

Check the created web app
You will see the status is running. If you need to stop this application, click Stop.

Click the URL to check the website.
Deploying Blazor server-side application to Azure App service using GitHub Actions


This article discussed how to deploy a Blazor server-side application to the Azure App Service using GitHub Actions. With the increasing popularity of GitHub Actions and Blazor applications, it is an advantage to understand how to automate your CI/CD process by combining them.

I hope this article helps you in your next Blazor project. Thank you for reading.

Syncfusion’s Blazor component suite offers over 70 UI components. They work with both server-side and client-side (WebAssembly) hosting models seamlessly. Use them to build marvelous apps!

If you have any questions or comments, you can contact us through our support forumssupport portal, or feedback portal. We are always happy to assist you!

Related blogs


Share this post:

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed