Skip to content

Latest commit

 

History

History
46 lines (30 loc) · 2.26 KB

powershell-deploy-local-git.md

File metadata and controls

46 lines (30 loc) · 2.26 KB
title description tags ms.assetid ms.topic ms.date ms.custom
PowerShell: Deploy from local Git repo
Learn how to use Azure PowerShell to automate deployment and management of App Service. This sample shows how to deploy code from a local Git repository.
azure-service-management
5a927f23-8e70-45fd-9aae-980d4e7a007d
sample
12/06/2022
mvc, devx-track-azurepowershell

Create a web app and deploy code from a local Git repository

This sample script creates a web app in App Service with its related resources, and then deploys your web app code from a local Git repository.

If needed, update to the latest Azure PowerShell using the instruction found in the Azure PowerShell guide, and then run Connect-AzAccount to create a connection with Azure. Also, your application code needs to be committed into a local Git repository.

Sample script

[!INCLUDE updated-for-az]

[!code-azurepowershell-interactivemain]

Clean up deployment

After the script sample has been run, the following command can be used to remove the resource group, web app, and all related resources.

Remove-AzResourceGroup -Name $webappname -Force

Script explanation

This script uses the following commands. Each command in the table links to command specific documentation.

Command Notes
New-AzWebApp Creates a web app with necessary resource group and App Service group. When the current directory contains a Git repository, also add an azure remote.
Set-AzResource Modifies a resource in a resource group.
Get-AzWebAppPublishingProfile Get a web app's publishing profile.

Next steps

For more information on the Azure PowerShell module, see Azure PowerShell documentation.

Additional Azure PowerShell samples for Azure App Service Web Apps can be found in the Azure PowerShell samples.