Deploy your application to Azure using GitHub Actions workflows created by Visual Studio

Applies to: yesVisual Studio noVisual Studio for Mac noVisual Studio Code

Starting in Visual Studio 2019 version 16.11, you can create new GitHub Action workflows for .NET projects hosted on GitHub.com.

How does it work?

In Solution Explorer, right-click your GitHub.com hosted project and choose Publish.

right-click > Publish

On the next screen, select Azure and then choose Next.

select Azure

Depending on your project type, you get a different list of Azure services to pick from. Pick one of the supported Azure services that fits your needs.

select the appropriate Azure service for your project

On the final step of the wizard, select CI/CD using GitHub Actions workflows (generates yml file) and then choose Finish.

CI/CD using GitHub Actions workflows (generates yml file)

Visual Studio generates a new GitHub Actions workflow and asks you to commit it and push it to GitHub.com.

commit and push

If you complete this step by using the built-in Git tooling, Visual Studio will detect the execution of the workflow.

workflow is running

Setting the GitHub secrets

For the generated workflow to successfully deploy to Azure, it may require access to a publish profile.

one github secret

A successful deployment may also require access to a service principal.

two github secrets

In all cases, Visual Studio tries to set the GitHub secret for you with the correct value. If it fails, it will let you know and give you the opportunity to try again.

github secret missing

If it fails to set the secret again, Visual Studio gives you the opportunity to get access to the secret manually, so you can complete the process through your repo's page on github.com.

set missing github secret

Which project types are supported?

  • ASP.NET Core
  • ASP.NET 5 and above
  • Azure Functions

Which Azure services are supported?

  • Azure Web Apps
  • Azure Functions
  • Azure API Management