diff --git a/Azure-IP-Downloader.ps1 b/Azure-IP-Downloader.ps1 index c7ac2b1..fb96ebd 100644 --- a/Azure-IP-Downloader.ps1 +++ b/Azure-IP-Downloader.ps1 @@ -1,4 +1,4 @@ -# Azure IP filter and downloader script v1.0 +# Azure IP filter and downloader script v1.1.0 # Author: Daniel Keer # Author URI: https://thedxt.ca # Script URI: https://github.com/thedxt/IP-Downloader @@ -11,19 +11,19 @@ # the uri from MS will need to be replaced as that may change # the uri is here https://www.microsoft.com/en-us/download/details.aspx?id=56519 # -# # change the variables as needed - #save location $exportlocation = "C:\temp\" #region filter $regionFilter = "canada" -#download the JSON file from MS -$MSjsonDL = Invoke-WebRequest -Uri "https://download.microsoft.com/download/7/1/D/71D86715-5596-4529-9B13-DA13A5DE5B63/ServiceTags_Public_20210104.json" +#grab URI from txt file +$DLURI = Invoke-WebRequest -uri "https://raw.githubusercontent.com/thedxt/IP-Downloader/main/URIs/Azure-JSON-URI.txt" +#download the JSON file from MS +$MSjsonDL = Invoke-WebRequest -Uri $DLURI.Content #getting date $time = get-date -f yyyy_MMM_dd_hhmm_tt @@ -34,7 +34,6 @@ $MSjsonOBJ = ConvertFrom-Json $MSjsonDL #select the values $properties = $MSjsonOBJ.values.properties - #filter to pick only specific regions and null for ones that dont have regions $regions = $properties | where-object { $_.region -match $regionFilter -OR $_.region -eq ""} diff --git a/README.md b/README.md index 4df8470..de2be78 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Azure IP filter and downloader script v1.0 +# Azure IP filter and downloader script v1.1.0 Grabs the JSON file for the Azure IP Ranges and Service Tags – Public Cloud. Script allows for flitering and downloads the ips into one big file it also makes a file just for IPv4 and IPv6 @@ -10,6 +10,7 @@ The uri from microsoft will need to be replaced as that may change (they update * change your region filter as needed to suit your needs * in download the JSON file from MS replace the uri in from MS when they update the file to keep it as updated as possible * the filter includes null regions as some of the data doesn't have a region +* DLURI will grab the most recent MS URI that I've saved in URIs/Azure-JSON-URI.txt. You can change this to something you control. All that you have to do after that is just update the URI in that file and the reset of the script doesnt need to change. ## known issues * C:\temp needs to exist diff --git a/URIs/Azure-JSON-URI.txt b/URIs/Azure-JSON-URI.txt new file mode 100644 index 0000000..425b9c9 --- /dev/null +++ b/URIs/Azure-JSON-URI.txt @@ -0,0 +1 @@ +https://download.microsoft.com/download/7/1/D/71D86715-5596-4529-9B13-DA13A5DE5B63/ServiceTags_Public_20210104.json