Skip to content

Instantly share code, notes, and snippets.

@marlinspike
Created October 29, 2018 14:39
Show Gist options
  • Save marlinspike/95a79ac0ffaa5c079e66775c7012cc18 to your computer and use it in GitHub Desktop.
Save marlinspike/95a79ac0ffaa5c079e66775c7012cc18 to your computer and use it in GitHub Desktop.
Create an Azure Web App from scratch using PowerShell
# Replace the following URL with a public GitHub repo URL
$gitrepo="https://github.com/Azure-Samples/app-service-web-dotnet-get-started.git"
#Name the web app
$webappname="mywebapp$(Get-Random)"
$location="West Europe"
# Create a resource group.
New-AzureRmResourceGroup -Name myResourceGroup -Location $location
# Create an App Service plan in Free tier.
New-AzureRmAppServicePlan -Name $webappname -Location $location -ResourceGroupName myResourceGroup -Tier Free
# Create a web app.
New-AzureRmWebApp -Name $webappname -Location $location -AppServicePlan $webappname -ResourceGroupName myResourceGroup
# Configure GitHub deployment from your GitHub repo and deploy once.
$PropertiesObject = @{
repoUrl = "$gitrepo";
branch = "master";
isManualIntegration = "true";
}
Set-AzureRmResource -PropertyObject $PropertiesObject -ResourceGroupName myResourceGroup -ResourceType Microsoft.Web/sites/sourcecontrols -ResourceName $webappname/web -ApiVersion 2015-08-01 -Force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment