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 |
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.
[!INCLUDE updated-for-az]
[!code-azurepowershell-interactivemain]
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
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. |
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.