This repository obtains and stores (using Action) the current Azure's Datacenters public IP addresses. Results you can check here.
By default, Microsoft doesn't provide a posibility to obtain Azure DC IP anonymously. Instead, it suggest to use Azure CLI/Powershell/REST to query Azure using an authorized account. The main aim of this repository is to show how with a minimum effort you can obtain and store all necessary configs/data in one place.
There is only one workflow which do a few things:
- Converts and stores SPN_KEY_BASE64 secret as a certificate (which is used for authentication).
- Using the certificate logins to Azure CLI.
- Executes script.sh, which get IPs and stores them in separate files locally.
- Pushes changes to this repository.
The result of the workflow is a bunch of files with IP addresses. For easier search I also wrote a small Python script which can be used to search for a specific IP in all of these files. The script is located here. You can install it using the following command(you'll need to have Python and Linux OS/WSL installed):
curl -s https://raw.githubusercontent.com/groovy-sky/azure-ip-ranges/main/requirements.txt | xargs -n 1 pip install --user
alias azsearch='curl -s https://raw.githubusercontent.com/groovy-sky/azure-ip-ranges/main/search.py | python -' # Add this to your .bashrc or .zshrc
After that you can use it like this:
azsearch [IP_ADDRESS]
As a result you will get a list of files where the IP is located (or none if it's not found). Also works in Azure CLI: