Created
November 27, 2018 05:49
-
-
Save slogsdon/3aff51deff3cdb0b774512d6acf9975a to your computer and use it in GitHub Desktop.
This file contains 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 | |
SERVICE_PLAN_NAME="Default1" | |
SERVICE_PLAN_RESOURCE_GROUP_NAME="Default-Web-EastUS" | |
SERVICE_PLAN_ID=$(az appservice plan show --name $SERVICE_PLAN_NAME --resource-group $SERVICE_PLAN_RESOURCE_GROUP_NAME --query id --output tsv) | |
RESOURCE_GROUP_NAME=$(basename `pwd`) | |
RESOURCE_GROUP_LOCATION=$(az appservice plan show --name $SERVICE_PLAN_NAME --resource-group $SERVICE_PLAN_RESOURCE_GROUP_NAME --query location --output tsv) | |
APP_NAME="${RESOURCE_GROUP_NAME}-${RANDOM}" | |
# Create a resource group. | |
az group create --name $RESOURCE_GROUP_NAME --location "$RESOURCE_GROUP_LOCATION" > /dev/null 2>&1 | |
echo "Created resource group '$RESOURCE_GROUP_NAME'" | |
# Create a web app. | |
az webapp create --name $APP_NAME --resource-group $RESOURCE_GROUP_NAME --plan $SERVICE_PLAN_ID --runtime "PHP|7.2" > /dev/null 2>&1 | |
echo "Created web app '$APP_NAME'" | |
# Configure local Git and get deployment URL | |
APP_DEPLOYMENT_URL=$(az webapp deployment source config-local-git --name $APP_NAME --resource-group $RESOURCE_GROUP_NAME --query url --output tsv) | |
# Add the Azure remote to your local Git respository | |
git remote add azure $APP_DEPLOYMENT_URL > /dev/null 2>&1 | |
echo "Added Azure deployment URL as a remote" | |
APP_URL="https://$APP_NAME.azurewebsites.net" | |
echo $APP_URL | pbcopy | |
echo "Copied '$APP_URL' to the system clipboard" | |
echo "Deploy via:" | |
echo "" | |
echo " git add ." | |
echo " git commit -m \"add files\"" | |
echo " git push -u azure master" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment