Wednesday, March 22, 2017

how to extract MS azure DCs subnets for a batch of address Fortigate

Here's a simple means for extracting the ranges of address that MS AZURE POSTs for it's geo-datacenters listings.



The link below lists the file in a a xml format which is posted every week or so.


https://www.microsoft.com/en-us/download/details.aspx?id=41653


{ script }

#!/bin/bash
#
#

#rev 1.0

#  azure dc ranges  prep script make for fortigate batch execution
# reference href https://www.microsoft.com/en-us/download/details.aspx?id=41653
#
#
if [ ! $1 ]; then
            echo " USAGE azuredcrange.sh filename"
            echo ""
            echo  " azuredcrange.sh PublicIPs.xml"
            exit 1
fi

#

#
#

for p in `cat $1 |  grep IpRange |  cut -d "=" -f2 | awk '{print$1}'  |  sed -e 's/"//g' ` ;


do echo -e " config  firewall address\n edit  $p\n   set subnet $p\n   set tag MSAZURE_DC\n   set comment MS_AZURE_DC\n   end\n" ;


done



You can catch the output in a text file and use  the batch cfg mode for execution within the webGUI




Ken Felix
NSE ( network security expert) and Route/Switching Engineer
kfelix  -----a----t---- socpuppets ---dot---com
     ^      ^
=(  @  @ )=
         o 
        /  \
  


No comments:

Post a Comment