Skip to content

Commit

Permalink
adding DLURI
Browse files Browse the repository at this point in the history
adding the ability to update a txt for the MS URI
thedxt authored Jan 11, 2021
1 parent 5c0688c commit 2cbe2ff
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions Azure-IP-Downloader.ps1
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
# 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
# Script URI: https://github.com/thedxt/Azure-IP-Downloader
#
# DESCRIPTION
#
# 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
# 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
#
# the url from MS will need to be replaced as that may change
# the url 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 ""}

0 comments on commit 2cbe2ff

Please sign in to comment.