Intermediate · Microsoft Azure essentials · topic 26 of 50 · 35 min
Azure networking, Functions, databases and monitoring
Explanation
VNets and subnets
An Azure Virtual Network (VNet) is the same idea as an AWS VPC: a private address range, such as 10.10.0.0/16, in one region. You split it into subnets, such as 10.10.1.0/24 for web servers and 10.10.2.0/24 for databases. Azure reserves 5 addresses in every subnet (the first four and the last), so a /24 gives 251 usable addresses. One difference from AWS: Azure subnets span all availability zones in the region.
Microsoft is retiring the old automatic "default outbound access" to the internet for VMs in new networks. Plan an explicit way out, such as a NAT gateway or a load balancer outbound rule, and check the current docs.
Network security groups (NSGs)
An NSG is a list of allow and deny rules for traffic. You attach it to a subnet, a network interface, or both. Each rule has a priority from 100 to 4096, a source and destination (an IP range or a service tag such as Internet or VirtualNetwork), a port, a protocol, a direction and an action. Azure checks rules from the lowest number upwards and stops at the first match. NSGs are stateful: if inbound traffic is allowed, the reply is allowed automatically.
| Default inbound rule | Priority | Effect |
|---|---|---|
| AllowVNetInBound | 65000 | Allow traffic from inside the VNet (and connected networks) |
| AllowAzureLoadBalancerInBound | 65001 | Allow Azure load balancer health probes |
| DenyAllInBound | 65500 | Deny everything else |
Outbound has matching defaults: AllowVnetOutBound, AllowInternetOutBound and DenyAllOutBound. You cannot delete default rules, but your own rules (100 to 4096) are checked first, so they can override them.
az network nsg rule create --resource-group rg-web --nsg-name nsg-web \
--name Allow-HTTPS --priority 300 --direction Inbound --access Allow \
--protocol Tcp --source-address-prefixes Internet --destination-port-ranges 443Connecting networks
- VNet peering joins two VNets over Microsoft's backbone, in the same or different regions. Address ranges must not overlap, and peering is not transitive: if A peers with B and B with C, A cannot reach C through B.
- VPN Gateway connects your office or data centre over an encrypted IPsec tunnel across the internet (site-to-site), or single laptops (point-to-site).
- ExpressRoute is a private connection through a connectivity provider that does not travel over the public internet. It gives steadier speed for banks and large firms, at a higher price.
Spreading traffic
| Service | Layer and reach | Use it for |
|---|---|---|
| Azure Load Balancer | Layer 4 (TCP/UDP), regional | Spreading any TCP or UDP traffic across VMs |
| Application Gateway | Layer 7 (HTTP/HTTPS), regional, optional WAF | Web apps: URL path routing, TLS termination, a web application firewall |
| Azure Front Door | Layer 7, global, at Microsoft's edge, with WAF and caching | Global websites: send users to the nearest healthy region, CDN |
Azure Functions
Azure Functions is Azure's serverless compute, like AWS Lambda. Each function has exactly one trigger, the event that runs it: an HTTP request, a timer, a new blob, a queue message, a Cosmos DB change and more. Bindings connect a function to other services without boilerplate code: an input binding reads data in, an output binding writes data out, for example to a storage queue.
import azure.functions as func
app = func.FunctionApp()
@app.route(route="hello", auth_level=func.AuthLevel.ANONYMOUS)
def hello(req: func.HttpRequest) -> func.HttpResponse:
name = req.params.get("name", "friend")
return func.HttpResponse(f"Namaste, {name}!")
@app.timer_trigger(schedule="0 30 2 * * *", arg_name="timer")
def nightly(timer: func.TimerRequest) -> None:
print("Nightly clean-up ran")Function apps run on a hosting plan. Flex Consumption is the current recommended serverless plan (pay per use, scale to zero), Premium keeps warm instances for no cold starts, and a Dedicated plan runs on an App Service plan you already pay for. Timeouts, memory and scaling limits differ by plan and change over time, so check the hosting options page.
Databases
Azure SQL Database is managed SQL Server: Microsoft handles patching, backups (with point-in-time restore) and high availability. You choose a purchasing model (vCore or DTU), and a serverless compute tier can pause when idle. Azure Cosmos DB is a globally distributed NoSQL database. You pick an API (NoSQL, MongoDB, Cassandra, Gremlin or Table), a partition key, and throughput in request units (RU/s), or the serverless mode. It offers five consistency levels, from strong to eventual.
Azure Monitor and Log Analytics
Azure Monitor collects metrics and logs from every resource. Logs go into a Log Analytics workspace, where you query them with KQL (Kusto Query Language). The Activity Log records control-plane operations in a subscription, such as who deleted a VM, much like AWS CloudTrail. Application Insights watches application performance. Alerts send notifications through action groups (email, SMS, webhook).
Heartbeat
| summarize LastSeen = max(TimeGenerated) by Computer
| where LastSeen < ago(10m)
AppRequests
| where TimeGenerated > ago(1h)
| summarize requests = count(), failed = countif(Success == false), p95 = percentile(DurationMs, 95) by bin(TimeGenerated, 5m)Microsoft Defender for Cloud checks your subscriptions against security best practices, gives a secure score with recommendations, and with paid Defender plans adds threat protection for servers, storage, databases and containers.
AWS to Azure: the services in this module
| AWS | Azure |
|---|---|
| AWS account / Organizations OU | Subscription / management group |
| IAM users, groups and roles | Microsoft Entra ID plus Azure RBAC |
| IAM role for EC2 or Lambda | Managed identity |
| EC2 / Auto Scaling group | Virtual Machines / VM Scale Sets |
| Elastic Beanstalk | App Service |
| Lambda | Azure Functions |
| S3 / EBS / EFS | Blob storage / Managed Disks / Azure Files |
| VPC / security group | VNet / network security group |
| Network Load Balancer / Application Load Balancer + WAF | Azure Load Balancer / Application Gateway + WAF |
| CloudFront | Azure Front Door |
| Site-to-Site VPN / Direct Connect | VPN Gateway / ExpressRoute |
| RDS for SQL Server / DynamoDB | Azure SQL Database / Cosmos DB |
| CloudWatch / CloudTrail | Azure Monitor / Activity Log |
| CloudFormation | ARM templates and Bicep |
Need help?
Stuck on a word or an idea? Search this course, or every course, and jump straight to the explanation or a worked question.
Try:
Watch the lesson
Azure networking, Functions, databases and monitoring · 1/8
This lesson covers Azure networking, serverless Functions, databases and monitoring, and maps each to the AWS service you already know.
Prefer a video by a teacher? Find free videos on “azure vnet network security group priority azure functions triggers bindings tutorial” on YouTube ↗
In real life: A UPI payments startup moves an API to Azure
A payments startup in Gurugram runs its API on VM Scale Sets in two subnets of a VNet in Central India. Application Gateway with WAF receives HTTPS traffic and blocks common attacks. The app subnet's NSG allows port 8080 only from the gateway subnet, and the database subnet allows 1433 only from the app subnet; everything else falls to DenyAllInBound. Settlement files from the bank arrive as blobs and trigger an Azure Function that checks them and writes results to Azure SQL Database. The office connects through a site-to-site VPN Gateway. A KQL alert on failed requests above 2% pages the on-call engineer through an action group.
AzureActivity
| where TimeGenerated > ago(7d)
| where OperationNameValue endswith "DELETE"
| project TimeGenerated, Caller, OperationNameValue, ResourceGroupPractice (0/3 done)
An NSG has "Deny SSH from Internet" at priority 200 and "Allow SSH from Internet" at priority 300. What happens to an SSH connection from the internet?
Write evaluate_nsg(rules, port, source_ip, protocol="TCP") for inbound traffic. Each rule is a dict with "name", "priority", "port" (an int, "*" for any, or a range string like "8000-8100"), "protocol" ("TCP", "UDP" or "*"), "source" ("*" or a CIDR like "203.0.113.0/24") and "access" ("Allow" or "Deny"). Check rules in priority order, lowest number first; the first rule that matches port, protocol and source decides. Return (access, rule_name). If nothing matches, return ("Deny", "DenyAllInBound"). For this task, ignore the other default rules. Tip: the ipaddress module checks whether an IP is inside a CIDR.
Design the network for a three-tier app (web, app, database) in one Azure VNet in Central India. Give the address ranges, the NSG rules for each subnet with priorities, how admins log in, and how you would watch it.
Quick quiz
Read more (free)
Related help
Before this, learn
This topic builds on these. If something here feels new, open them first.
Related topics
- Microsoft Entra ID and Azure RBACMicrosoft Azure essentials · same module
- How Azure is organised: tenants, subscriptions and resource groupsMicrosoft Azure essentials · same module
- Virtualisation, VRFs and cloud networkingComputer Networking (CCNA level) · Automation, SDN and cloud networking
- Core Google Cloud servicesGoogle Cloud and comparing the clouds
- Logging and monitoring in the cloudCyber Security: from zero to SOC analyst · Cloud security basics
- Portfolio projects that get interviewsCertifications and cloud careers
Questions people ask about this
Open a question to see the answer and why. The first ones are this topic's own quiz, so try the quiz above before you peek.
What is the valid priority range for your own NSG rules?
Answer: 100 to 4096
Custom rules use 100 to 4096. The default rules sit at 65000, 65001 and 65500.
VNet A is peered with B, and B is peered with C. Can A reach C through B by default?
Answer: No, peering is not transitive
Peering connects only the two VNets in the pair. Use a hub with a firewall or direct peering for A to C.
Which service gives global layer 7 routing at Microsoft's edge, with caching and WAF?
Answer: Azure Front Door
Front Door is global and HTTP-aware. Application Gateway is regional; Load Balancer is layer 4.
In Azure Functions, what is a binding?
Answer: A declared connection that reads input from or writes output to another service
Bindings save you writing connection code: for example an output binding that writes to a storage queue.
Which language do you use to query logs in a Log Analytics workspace?
Answer: KQL (Kusto Query Language)
Log Analytics and Azure Monitor Logs use KQL, with pipes such as | where and | summarize.
Which option gives a dedicated private line from your data centre to AWS?Related
Answer: AWS Direct Connect
Direct Connect is a dedicated connection through a partner location. VPN runs over the public internet.
A private app server must download updates from the internet but must not accept connections from it. What does its subnet route to?Related
Answer: A NAT gateway
A NAT gateway lets private servers start outbound connections while blocking inbound ones.
How many usable addresses does an AWS subnet 10.0.5.0/26 have?Related
Answer: 59
A /26 has 64 addresses; AWS reserves 5, leaving 59.
Which service runs your container, scales with traffic and can scale down to zero?Related
Answer: Cloud Run
Cloud Run is serverless containers with scale to zero.
Pass the quiz (60% or more) or mark this topic as done when you are ready.
Your progress is saved on this device only.
Next steps
- This is the last topic of “Microsoft Azure essentials”. The module exam comes next.
- Module 6 exam: Microsoft Azure essentials · 13 questions · 20 min, without help. 4 topics of this module still to finish first.
- Then the next module, Google Cloud and comparing the clouds. 50 topics left in the course before the final exam.