-
Notifications
You must be signed in to change notification settings - Fork 69
/
Copy pathscrape_azure_diagrams.py
66 lines (55 loc) · 3.78 KB
/
scrape_azure_diagrams.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import os
import requests
from urllib.parse import urlparse
# Direct URLs to key Azure architecture diagrams
ARCHITECTURE_IMAGES = [
# Core Architectures (keeping successful ones)
('https://learn.microsoft.com/en-us/azure/architecture/guide/architecture-styles/images/microservices-logical.png', 'microservices-architecture.png'),
('https://learn.microsoft.com/en-us/azure/architecture/reference-architectures/containers/aks/images/aks-baseline-architecture.svg', 'aks-baseline-architecture.png'),
('https://learn.microsoft.com/en-us/azure/architecture/reference-architectures/hybrid-networking/images/hub-spoke.png', 'hub-spoke-architecture.png'),
('https://learn.microsoft.com/en-us/azure/architecture/reference-architectures/app-service-web-app/images/scalable-web-app.png', 'scalable-web-app-architecture.png'),
# Networking and Connectivity
('https://learn.microsoft.com/en-us/azure/virtual-network/media/service-endpoints-overview.png', 'service-endpoints.png'),
('https://learn.microsoft.com/en-us/azure/private-link/media/private-endpoint-basics.png', 'private-endpoint-basics.png'),
('https://learn.microsoft.com/en-us/azure/private-link/media/private-link-service-overview.png', 'private-link-service.png'),
('https://learn.microsoft.com/en-us/azure/dns/media/private-dns-portal.png', 'private-dns-portal.png'),
('https://learn.microsoft.com/en-us/azure/virtual-network/media/routing-overview.png', 'vnet-routing-overview.png'),
# DNS and Hybrid Networking
('https://learn.microsoft.com/en-us/azure/dns/media/dns-overview.png', 'azure-dns-overview.png'),
('https://learn.microsoft.com/en-us/azure/dns/media/private-resolver-overview.png', 'private-resolver-overview.png'),
('https://learn.microsoft.com/en-us/azure/dns/media/custom-domain-name.png', 'custom-domain-dns.png'),
# Identity and Security
('https://learn.microsoft.com/en-us/azure/active-directory/conditional-access/media/overview/conditional-access-overview.png', 'conditional-access-overview.png'),
('https://learn.microsoft.com/en-us/azure/active-directory/conditional-access/media/what-if-tool/what-if-tool.png', 'conditional-access-what-if.png'),
('https://learn.microsoft.com/en-us/azure/active-directory/conditional-access/media/location-condition.png', 'conditional-access-location.png'),
# Container and DevSecOps (keeping successful ones)
('https://learn.microsoft.com/en-us/azure/architecture/reference-architectures/containers/aks/images/secure-baseline-architecture.svg', 'aks-secure-baseline.png'),
('https://learn.microsoft.com/en-us/azure/architecture/solution-ideas/media/devsecops-in-azure.png', 'aks-devsecops.png'),
('https://learn.microsoft.com/en-us/azure/container-registry/media/container-registry-service-tiers.png', 'acr-service-tiers.png')
]
def create_images_dir():
"""Create images directory if it doesn't exist"""
if not os.path.exists('images'):
os.makedirs('images')
def download_image(url, filename):
"""Download image from URL and save to images directory"""
try:
response = requests.get(url)
response.raise_for_status()
filepath = os.path.join('images', filename)
with open(filepath, 'wb') as f:
f.write(response.content)
print(f"Successfully downloaded: {filename}")
return True
except Exception as e:
print(f"Error downloading {filename}: {str(e)}")
return False
def download_architecture_diagrams():
"""Download architecture diagrams from direct URLs"""
create_images_dir()
for url, filename in ARCHITECTURE_IMAGES:
download_image(url, filename)
if __name__ == '__main__':
print("Starting to download Azure architecture diagrams...")
download_architecture_diagrams()
print("Download completed!")