Created
March 17, 2017 02:08
-
-
Save calvimor/3cd8c66d82743f00c80e8dc6753b666a to your computer and use it in GitHub Desktop.
deploy a web app in azure with azure-cli bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
gitdirectory=<Replace with path to local Git repo> | |
username=<Replace with desired deployment username> | |
password=<Replace with desired deployment password> | |
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 appservice web create --name $webappname --resource-group myResourceGroup --plan $webappname | |
# Set the account-level deployment credentials | |
az appservice web deployment user set --user-name $username --password $password | |
# Configure local Git and get deployment URL | |
url=$(az appservice web source-control config-local-git --name $webappname \ | |
--resource-group myResourceGroup --query url --output tsv) | |
# Add the Azure remote to your local Git respository and push your code | |
cd $gitdirectory | |
git remote add azure $url | |
git push azure master | |
# When prompted for password, use the value of $password that you specified | |
# Browse to the deployed web app. | |
az appservice web browse --name $webappname --resource-group myResourceGroup | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
az group delete --name cmdemonodegroup |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment