Skip to content

Instantly share code, notes, and snippets.

@marlinspike
Created October 29, 2018 14:38
Show Gist options
  • Save marlinspike/6ca44a6ec1a2c823b24116f88a9c2773 to your computer and use it in GitHub Desktop.
Save marlinspike/6ca44a6ec1a2c823b24116f88a9c2773 to your computer and use it in GitHub Desktop.
Create and deploy an Azure Web App from scratch using CLI
#!/bin/bash
# Replace the following URL with a public GitHub repo URL
gitrepo=https://github.com/Azure-Samples/app-service-web-dotnet-get-started.git#
#Here's a PHP app you can use to test instead if you'd like
#gitrepo=https://github.com/Azure-Samples/php-docs-hello-world
#Name the web app
webappname=mywebapp$RANDOM
# Create a resource group.
az group create --location westeurope --name myResourceGroup
# Create an App Service plan in `FREE` tier.
az appservice plan create --name $webappname --resource-group myResourceGroup --sku FREE
# Create a web app.
az webapp create --name $webappname --resource-group myResourceGroup --plan $webappname
# Deploy code from a public GitHub repository.
az webapp deployment source config --name $webappname --resource-group myResourceGroup \
--repo-url $gitrepo --branch master --manual-integration
# Copy the result of the following command into a browser to see the web app.
echo http://$webappname.azurewebsites.net
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment