Deploying in Azure Web App
In the same way as I wrote an article on how to deploy a static website in Azure, it is also possible to deploy a website in a Azure Hosted App Service, using CLI commands.
Azure App Service is a platform as a service (PaaS) offered by Microsoft Azure. It enables developers to rapidly create, deploy and scale web and mobile applications and APIs without worrying about the underlying infrastructure.
Deploying to Azure App Service can be done easily using the command az
.
Follow these steps:
-
Publish your website locally, for example using the command:
dotnet publish -c Release -o ./bin/Publish -f net8.0
-
Compress the resulting folder into a ZIP file.
Compress-Archive ./bin/Publish/* ./bin/mysite.zip
-
Once you have downloaded and installed the
az
command, you will need to sign in to your Azure hosting.az account login
-
If you have several Azure subscriptions, please select the one you want.
az account set --subscription "0cd5a0db-3c55-43ab-8ff0-a88b1886464c"
-
Finally, publish your local (and compressed) website.
az webapp deploy --resource-group <YourResourceGroup> --name <YourAppServiceName> --src-path ./bin/mysite.zip
YourResourceGroup and YourAppServiceName are displayed on the Overview page of your website in Azure.