├── FlowNotifications
├── AzureFunction
│ ├── host.json
│ ├── proxies.json
│ ├── README.md
│ ├── Format
│ │ ├── function.json
│ │ └── index.js
│ ├── package.json
│ └── package-lock.json
├── img
│ ├── image001.jpg
│ ├── image002.png
│ ├── image003.png
│ ├── image004.jpg
│ ├── image005.jpg
│ ├── image006.jpg
│ ├── image007.jpg
│ ├── image008.jpg
│ ├── image009.jpg
│ ├── image010.jpg
│ ├── image011.jpg
│ ├── image012.jpg
│ ├── image013.jpg
│ ├── image014.jpg
│ ├── image015.jpg
│ ├── image016.jpg
│ ├── image017.jpg
│ ├── image018.jpg
│ ├── image019.jpg
│ ├── image020.jpg
│ ├── image021.jpg
│ ├── image022.jpg
│ ├── image023.jpg
│ ├── image024.jpg
│ ├── image025.jpg
│ ├── image026.jpg
│ ├── image027.jpg
│ ├── image028.jpg
│ ├── image029.jpg
│ ├── image030.jpg
│ ├── image031.jpg
│ ├── image032.jpg
│ ├── image033.jpg
│ ├── image034.jpg
│ ├── image035.jpg
│ ├── image036.jpg
│ ├── image037.jpg
│ ├── image038.jpg
│ ├── image039.jpg
│ └── image040.jpg
└── README.md
├── .gitignore
├── README.md
└── OldFirewall
├── README.md
└── Generate-OldFirewall-XML.ps1
/FlowNotifications/AzureFunction/host.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "2.0"
3 | }
4 |
--------------------------------------------------------------------------------
/FlowNotifications/AzureFunction/proxies.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json.schemastore.org/proxies",
3 | "proxies": {}
4 | }
5 |
--------------------------------------------------------------------------------
/FlowNotifications/img/image001.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image001.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image002.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image002.png
--------------------------------------------------------------------------------
/FlowNotifications/img/image003.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image003.png
--------------------------------------------------------------------------------
/FlowNotifications/img/image004.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image004.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image005.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image005.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image006.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image006.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image007.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image007.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image008.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image008.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image009.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image009.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image010.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image010.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image011.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image011.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image012.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image012.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image013.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image013.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image014.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image014.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image015.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image015.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image016.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image016.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image017.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image017.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image018.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image018.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image019.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image019.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image020.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image020.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image021.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image021.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image022.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image022.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image023.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image023.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image024.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image024.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image025.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image025.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image026.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image026.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image027.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image027.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image028.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image028.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image029.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image029.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image030.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image030.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image031.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image031.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image032.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image032.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image033.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image033.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image034.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image034.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image035.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image035.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image036.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image036.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image037.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image037.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image038.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image038.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image039.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image039.jpg
--------------------------------------------------------------------------------
/FlowNotifications/img/image040.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pandrew1/Office365-IPURL-Samples/HEAD/FlowNotifications/img/image040.jpg
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | FlowNotifications/AzureFunction/node_modules
3 | FlowNotifications/AzureFunction/.vscode
4 | FlowNotifications/AzureFunction/bin
5 | FlowNotifications/AzureFunction/Debug
6 | FlowNotifications/AzureFunction/obj
7 |
--------------------------------------------------------------------------------
/FlowNotifications/AzureFunction/README.md:
--------------------------------------------------------------------------------
1 | # Azure Function for formatting JSON changes as HTML English text
2 | Sample code in JavaSCript for creating an Azure Function that generates HTML from the JSON changes web service output
3 |
4 | The project is arranged for downloading to a PC using Git and depoying to Azure using the Visual Studio Code extensions for Azure Functions.
5 |
--------------------------------------------------------------------------------
/FlowNotifications/AzureFunction/Format/function.json:
--------------------------------------------------------------------------------
1 | {
2 | "bindings": [
3 | {
4 | "authLevel": "function",
5 | "type": "httpTrigger",
6 | "direction": "in",
7 | "name": "req",
8 | "methods": [
9 | "get"
10 | ]
11 | },
12 | {
13 | "type": "http",
14 | "direction": "out",
15 | "name": "res"
16 | }
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Office365-IPURL-Samples
2 | Sample code for connecting with the Office 365 IP Address and URL web services
3 |
4 | There are two projects
5 | 1) OldFirewall which generates the old XML file we used to publish from the new REST format
6 | 2) FlowNotifications which provides JavaScript code for an Azure Function to use used in a Microsoft flow that sends an email notification when there are changes to the IP/URL data
7 |
--------------------------------------------------------------------------------
/FlowNotifications/AzureFunction/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "formatchanges",
3 | "version": "1.0.0",
4 | "dependencies": {
5 | "axios": "0.21.2"
6 | },
7 | "main": "index.js",
8 | "scripts": {
9 | "test": "echo \"Error: no test specified\" && exit 1"
10 | },
11 | "keywords": [],
12 | "author": "Paul Andrew",
13 | "license": "ISC",
14 | "description": "Formats JSON output from changes web services in HTML for Ofice 365 IPURL updates",
15 | "devDependencies": {},
16 | "repository": {
17 | "type": "git",
18 | "url": "git+https://github.com/pandrew1/Office365-IPURL-Samples.git"
19 | },
20 | "bugs": {
21 | "url": "https://github.com/pandrew1/Office365-IPURL-Samples/issues"
22 | },
23 | "homepage": "https://github.com/pandrew1/Office365-IPURL-Samples#readme"
24 | }
25 |
--------------------------------------------------------------------------------
/FlowNotifications/AzureFunction/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "formatchanges",
3 | "version": "1.0.0",
4 | "lockfileVersion": 1,
5 | "requires": true,
6 | "dependencies": {
7 | "axios": {
8 | "version": "0.21.2",
9 | "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.2.tgz",
10 | "integrity": "sha512-87otirqUw3e8CzHTMO+/9kh/FSgXt/eVDvipijwDtEuwbkySWZ9SBm6VEubmJ/kLKEoLQV/POhxXFb66bfekfg==",
11 | "requires": {
12 | "follow-redirects": "^1.14.0"
13 | }
14 | },
15 | "follow-redirects": {
16 | "version": "1.15.2",
17 | "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
18 | "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA=="
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/OldFirewall/README.md:
--------------------------------------------------------------------------------
1 | # Office365-IPURL-Samples
2 | Sample code for connecting with the Office 365 IP Address and URL web services
3 |
4 | Generate-OldFirewall-XML.ps1
5 | This sample is for customers who have a dependency on one of the old XML downloads that was provided for Office 365. Notification was provided on 4/2/2018 that these would be deprecated and the files are no longer updated since 10/2/2018. There is a new JSON format output available with additional attributes from a web service as documented at http://aka.ms/ipurlblog.
6 |
7 | The script calls the new IP/URL web service passing in a parameter for the service instance requested and outputs the data in XML format similar to the previous downloads. The acceptable service instances are:
8 | * Worldwide
9 | * USGovDoD
10 | * USGovGCCHigh
11 | * China
12 | * Germany
13 |
14 | Compared to the old XML file, the product names will be different. THe new product names included are:
15 | * Exchange
16 | * SharePoint
17 | * Skype
18 | * Common
19 |
20 | We have some recommended migration approaches detailed here: https://techcommunity.microsoft.com/t5/Office-365-Networking/Migrating-to-the-new-web-services-based-publishing-for-Office/m-p/229144
21 |
--------------------------------------------------------------------------------
/OldFirewall/Generate-OldFirewall-XML.ps1:
--------------------------------------------------------------------------------
1 | #
2 | # Script loads Office 365 endpoints from web service, orders them according to the XML schema, and outputs a file
3 | # 4 September 2018
4 | #
5 | # Copyright Microsoft 2018
6 | #
7 |
8 | # Set parameters for the script
9 | $wsRoot = "https://endpoints.office.com"
10 | $clientRequestId = "b10c5ed1-bad1-445f-b386-b919946339a7"
11 | $instanceName = "Worldwide"
12 | $outfilePath = "O365IPAddresses_$instanceName.xml"
13 |
14 | # Get latest endpoints data from the web service
15 | $e = Invoke-RestMethod -Uri ("$($wsRoot)/endpoints/$($instanceName)?clientrequestid=$($clientRequestId)")
16 |
17 | # Structure attributes and split IPv4 and IPv6
18 | $canon = $e | ForEach-Object {
19 | $ipv4 = @()
20 | $ipv6 = @()
21 |
22 | if ("ips" -in $_.PSobject.properties.name) {
23 | $ipv4 = $_.ips | Where-Object {$_ -like '*.*'}
24 | $ipv6 = $_.ips | Where-Object {$_ -like '*:*'}
25 | }
26 |
27 | [PSCustomObject]@{
28 | id = $_.id;
29 | product = $_.serviceArea;
30 | ipv4 = $ipv4;
31 | ipv6 = $ipv6;
32 | urls = $_.urls;
33 | }
34 | }
35 |
36 | # Order of the workload keys in the published XML
37 | $workloadKeysOrdered = @("Exchange","SharePoint","Skype","Common")
38 |
39 | # Helper func to sort IPs numerically
40 | $sortIPFunc = {
41 | $byteArray = [System.Net.IPAddress]::Parse($_.Split('/')[0]).GetAddressBytes()
42 | [System.Array]::Reverse($byteArray)
43 | if ($byteArray.Count -eq 16) {
44 | # IPv6 - convert to 4-element 32-bit int array and then to string
45 | (@(12, 8, 4, 0) | foreach { '{0:x8}' -f [System.BitConverter]::ToUInt32($byteArray, $_) }) -join ""
46 | }
47 | else {
48 | # IPv4 - converting to 32-bit int is sufficient
49 | [System.BitConverter]::ToUInt32($byteArray, 0)
50 | }
51 | }
52 |
53 | # Output XML
54 | $xml = "`r`n"
55 | $xml += "
Recent changes for Office 365 IP Addresses and URLs. For more information please see http://aka.ms/ipurlws
" + 18 | formatChanges(changes) + "" 19 | }; 20 | } else { 21 | context.log('JavaScript HTTP trigger function processed a request with an invalid parameters.'); 22 | context.res = { 23 | status: 400, 24 | body: "Please pass query string parameters since, instance, clientrequestid, and key. Docs at http://aka.ms/ipurlws" 25 | }; 26 | } 27 | } 28 | 29 | function formatChanges(changes) { 30 | var out = "" 31 | changes.forEach(function(obj) { 32 | out += "Endpoint Set ID: " + obj.endpointSetId 34 | out += ", Disposition: " + obj.disposition 35 | out += ", Version " + obj.version 36 | if (isdef(obj.impact)) { 37 | out += ", Impact: " + obj.impact 38 | } 39 | out += "
| Previous |
| Current |
| Add |
| " 48 | if (isdef(obj.add.effectiveDate)) { 49 | out += "Effective Date: {0} ".replace("{0}", obj.add.effectiveDate) 50 | } 51 | if (isdef(obj.add.urls)) { 52 | out += "URLs: " 53 | var first = true 54 | obj.add.urls.forEach(function(url) { 55 | if (!first) { out += ", " } 56 | out += url 57 | first = false 58 | }) 59 | out += " " 60 | } 61 | if (isdef(obj.add.ips)) { 62 | out += "IP Addresses: " 63 | var first = true 64 | obj.add.ips.forEach(function(url) { 65 | if (!first) { out += ", "} 66 | out += url 67 | first = false 68 | }) 69 | } 70 | out += " |
| Remove |
| " 73 | if (isdef(obj.remove.urls)) { 74 | out += "URLs: " 75 | var first = true 76 | obj.remove.urls.forEach(function(url) { 77 | if (!first) { out += ", "} 78 | out += url 79 | first = false 80 | }) 81 | out += " " 82 | } 83 | if (isdef(obj.remove.ips)) { 84 | out += "IP Addresses: " 85 | var first = true 86 | obj.remove.ips.forEach(function(url) { 87 | if (!first) { out += ", "} 88 | out += url 89 | first = false 90 | }) 91 | } 92 | out += " |