This repository has been archived by the owner on Nov 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Update README.md 2. Add script assignFQDNtoIP.sh to bind IP to host name
- Loading branch information
Showing
3 changed files
with
86 additions
and
28 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
while getopts "g:d:i:" opt; do | ||
case $opt in | ||
g) | ||
echo "Resource Group is $OPTARG" | ||
RESOURCEGROUP=$OPTARG | ||
;; | ||
d) | ||
echo "DNS name is $OPTARG" | ||
DNSNAME=$OPTARG | ||
;; | ||
i) | ||
echo "IP is $OPTARG" | ||
IP=$OPTARG | ||
;; | ||
\?) | ||
echo "Invalid option: -$OPTARG" | ||
;; | ||
esac | ||
done | ||
|
||
# Get resource group and public ip name | ||
RESOURCEGROUP=$(az network public-ip list --query "[?ipAddress!=null]|[?contains(ipAddress, '$IP')].[resourceGroup]" --output tsv) | ||
PIPNAME=$(az network public-ip list --query "[?ipAddress!=null]|[?contains(ipAddress, '$IP')].[name]" --output tsv) | ||
|
||
# Update public ip address with dns name | ||
echo "Start assigning domain name to IP $IP..." | ||
az network public-ip update --resource-group $RESOURCEGROUP --name $PIPNAME --dns-name $DNSNAME >/dev/null | ||
|
||
az network public-ip list --query "[?ipAddress=='$IP']|[0].dnsSettings.fqdn" |
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