Follow the steps below to deploy a Blazor WebAssembly application to Azure App Service.
- Prerequisites:
-
.NET Core 3.1/.NET 5.0
-
Visual Studio 2019 or a more current version, which should include Azure and ASP.NET as well as web development workloads.
-
Azure App Service account.
- Create a Blazor WebAssemby Application
To create a blazor WebAssembly Application using the following steps
-
Open Visual Studio 2019 and create a new project.

-
Once Blazor App is selected, click Next button to configure the project name and location.
-
Save the application, and then click Create button.
-
Select Blazor WebAssembly App and click Create button to complete the application creation.

- Deploying to Azure App Service
To Deploying the Azure App Service using the following steps.
-
If you don’t have a login for Azure, sign up to access the Azure portal.
-
Click Create a resource in Azure to create a resource group.

-
Select the Web App Azure application service.

-
Once Web App is selected, select the following options:
-
Select Free Trial as the subscription.
-
Create a resource group name, such as “Blazor.”
-
Update the Instance Details:
-
Name: blazor-publish. The application hosted will be available in this URL: blazor-publish.azurewebsites.net.
-
Select the Code radio button for Publish.
-
Choose the .NET Core 3.1 LTS runtime stack and Windows operating system.
-
Select the region in which to publish the app. Central US was chosen for this demo.
-
The app service plan with the Free F1 option will be selected by default, but this can be modified.
-
Once this is done, click Review + create.

-
After configuring the Web App service, get the publish profile for the Web App service to host the Blazor WebAssembly application. Select the created web app service (blazor-publish).

-
Navigate to the overview section, click on Get publish profile, and save the profile locally.

- Publish a Blazor WebAssembly application in Azure
- Using import-profile option
To using import-profile option using the following steps.
-
Right-click the project and click Publish in the context menu.

-
Choose Import Profile and click Next. Then, locate the downloaded publish profile for the web app service.

-
Finally, publish the application by clicking Publish. The application will be deployed and will be available in the URL https://blazor-publish.azurewebsites.net/.

- Using Azure account login
To using Azure account login using the following steps.
-
In Visual Studio 2019, right-click on the project and click Publish in the context menu.

-
Select Azure as the target.

-
Select Azure App Service (Windows) as the specific target.

-
You need to log in to your Azure account and choose the web app service.

-
Now click Publish to deploy the application.

-
Now, the application will be deployed and will be available in the following URL. https://blazor-publish.azurewebsites.net/
Refer to “Publish an ASP.NET Core app to Azure with Visual Studio” for more details.
Share with