In this Microsoft Azure blog post, we’ll walk through how to publish a Blazor .NET app using Visual Studio Code (VS Code) to Azure.

VS Code, with its rich ecosystem of extensions and integrations, is more than just a code editor. It enables developers to build, test, integrate, and deploy applications—all from within the same interface.

The Azure extension for VS Code allows us to create and deploy applications directly to Azure. You can either create new Azure resources or deploy your app to existing ones.

For Blazor .NET applications, you have two main options: create a new Web App or deploy to an existing one. In this post, we’ll demonstrate how to deploy a Blazor WebAssembly app to an existing Web App in Azure.

Step 1: Publish the Application

Once your application is ready, open the terminal in VS Code and run the following command from the root directory of your project:

This command generates a deployment package located in:

This package contains all the compiled files, assets, and configuration needed to run your Blazor app in a production environment. Before deploying, it’s a good idea to test the published app locally using a lightweight web server such as dotnet serve or by manually copying the files to IIS for local testing.

Step 2: Deploy the Application

To deploy:

  1. In the VS Code Explorer, right-click on the publish folder that was created in the step above.
  2. Choose the option to deploy to Azure App Service.
  3. Select your existing Web App from the list.

VS Code will zip your publish folder, push the files to Azure, and trigger the deployment pipeline. The process typically takes less than a minute.

Once deployment starts, you can monitor its progress via the Azure Activity Log in VS Code. The Output window will also provide a detailed log of the deployment process, which is helpful for troubleshooting.

Final Thoughts

Deploying Blazor apps to Azure using VS Code is a fast and efficient way to get your application into the cloud. This approach is ideal for developers who prefer working in a lightweight environment without switching to Visual Studio. With integrated Azure extensions, the deployment workflow becomes seamless and repeatable.


Discover more from CPI Consulting Pty Ltd Experts in Cloud, AI and Cybersecurity

Subscribe to get the latest posts sent to your email.