-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy_production.sh
34 lines (26 loc) · 1.02 KB
/
deploy_production.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# Constants
PRODUCTION_DOMAIN="timeentry-minijob.com"
# Check if az is logged in, exit if not
if [ -z "$(az account show 2> /dev/null)" ]; then
echo "Please login to Azure first."
exit 1
fi
# Get Azure subscription ID
AZURE_SUBSCRIPTION_ID=$(az account show --query "id" --output tsv)
echo "Azure Subscription ID: $AZURE_SUBSCRIPTION_ID"
# Ensure Azure subscription is set
az account set --subscription $AZURE_SUBSCRIPTION_ID
# Check if the required arguments are provided
if [ -z "$1" ]; then
echo "Usage: $0 <web_app_name>"
exit 1
fi
WEB_APP_NAME="$1"
# Generate the resource group name from the web app name
RESOURCE_GROUP="${WEB_APP_NAME/WebApp-/}"
echo "Resource Group: $RESOURCE_GROUP"
# Map the App Service Domain to the Web App
echo "Mapping App Service Domain $PRODUCTION_DOMAIN to $WEB_APP_NAME..."
az webapp config hostname add --webapp-name $WEB_APP_NAME --resource-group $RESOURCE_GROUP --hostname $PRODUCTION_DOMAIN
echo "App Service Domain $PRODUCTION_DOMAIN is now mapped to $WEB_APP_NAME."