Skip to main content

Security Pillar

TL;DR​

The Security pillar focuses on protecting your workload from threats and ensuring compliance with regulations. Key concepts:

  • Zero Trust: Never trust, always verifyβ€”authenticate and authorize every request
  • Defense in Depth: Multiple layers of security controls
  • Least Privilege: Grant minimum permissions necessary
  • Data Protection: Encrypt data at rest and in transit
  • Security Operations: Continuous monitoring and incident response

Design Principles​

Core Security Principles​

PrincipleDescriptionImplementation
Zero TrustVerify explicitly, least privilege, assume breachIdentity verification, micro-segmentation
Defense in DepthMultiple security layersNetwork, identity, application, data controls
Least PrivilegeMinimum necessary permissionsRBAC, JIT access, PIM
Shift LeftSecurity early in developmentDevSecOps, security scanning
Assume BreachPlan for compromiseDetection, response, recovery

Zero Trust Model​


Defense in Depth​

Security Layers​

Controls by Layer​

LayerAzure ServicesKey Controls
IdentityEntra ID, PIM, Conditional AccessMFA, SSO, identity protection
PerimeterDDoS Protection, Firewall, Front DoorTraffic filtering, rate limiting
NetworkNSG, Private Link, VNetSegmentation, private connectivity
ComputeDefender for Cloud, Update ManagementVulnerability scanning, patching
ApplicationApp Service, API ManagementWAF, input validation, CORS
DataKey Vault, Storage encryptionEncryption, access control

Identity and Access Management​

Microsoft Entra ID (Azure AD)​

Authentication Methods​

MethodSecurity LevelUse Case
Password onlyLowLegacy (avoid)
MFA (SMS)MediumBasic protection
MFA (Authenticator)HighStandard enterprise
Passwordless (FIDO2)Very HighHigh-security scenarios
Certificate-basedVery HighDevice authentication

Role-Based Access Control (RBAC)​

RBAC Best Practices​

# List role assignments for a resource group
az role assignment list --resource-group myRG --output table

# Assign Reader role to a user
az role assignment create \
--assignee user@example.com \
--role "Reader" \
--resource-group myRG

# Create custom role
az role definition create --role-definition '{
"Name": "VM Operator",
"Description": "Can start and stop VMs",
"Actions": [
"Microsoft.Compute/virtualMachines/start/action",
"Microsoft.Compute/virtualMachines/restart/action",
"Microsoft.Compute/virtualMachines/deallocate/action"
],
"AssignableScopes": ["/subscriptions/{subscription-id}"]
}'

Privileged Identity Management (PIM)​

FeatureDescription
Just-in-Time AccessActivate roles only when needed
Time-boundAccess expires automatically
Approval WorkflowRequire approval for sensitive roles
Audit TrailComplete history of privilege usage
Access ReviewsRegular review of role assignments

Network Security​

Network Segmentation​

Network Security Groups (NSG)​

# Create NSG
az network nsg create --name myNSG --resource-group myRG

# Add inbound rule - allow HTTPS
az network nsg rule create \
--nsg-name myNSG \
--resource-group myRG \
--name AllowHTTPS \
--priority 100 \
--direction Inbound \
--access Allow \
--protocol Tcp \
--destination-port-ranges 443

# Add inbound rule - deny all other
az network nsg rule create \
--nsg-name myNSG \
--resource-group myRG \
--name DenyAllInbound \
--priority 4096 \
--direction Inbound \
--access Deny \
--protocol '*' \
--destination-port-ranges '*'

Private Connectivity Options​

ServiceUse CaseTraffic Path
Private EndpointAccess PaaS over private IPVNet β†’ Private IP β†’ PaaS
Service EndpointOptimized PaaS accessVNet β†’ Azure backbone β†’ PaaS
VNet IntegrationApp Service to VNetApp Service β†’ VNet resources
Private Link ServiceExpose your service privatelyConsumer VNet β†’ Your service

Private Endpoint Example​

// Bicep - Create Private Endpoint for Storage
resource privateEndpoint 'Microsoft.Network/privateEndpoints@2023-05-01' = {
name: 'pe-storage'
location: location
properties: {
subnet: {
id: subnetId
}
privateLinkServiceConnections: [
{
name: 'storage-connection'
properties: {
privateLinkServiceId: storageAccount.id
groupIds: ['blob']
}
}
]
}
}

resource privateDnsZone 'Microsoft.Network/privateDnsZones@2020-06-01' = {
name: 'privatelink.blob.core.windows.net'
location: 'global'
}

Data Protection​

Encryption Overview​

Encryption Options​

Data StateServiceKey Management
At RestStorage Service EncryptionMicrosoft-managed or CMK
At RestAzure Disk EncryptionKey Vault (BitLocker/DM-Crypt)
At RestSQL TDEService-managed or CMK
In TransitTLS 1.2+Certificate management
In UseAlways EncryptedClient-side encryption
In UseConfidential VMsHardware-based TEE

Azure Key Vault​

// C# - Using Key Vault for secrets
using Azure.Identity;
using Azure.Security.KeyVault.Secrets;

var client = new SecretClient(
new Uri("https://myvault.vault.azure.net/"),
new DefaultAzureCredential());

// Get secret
KeyVaultSecret secret = await client.GetSecretAsync("DatabasePassword");
string connectionString = secret.Value;

// Set secret
await client.SetSecretAsync("ApiKey", "my-api-key-value");
# Azure CLI - Key Vault operations
# Create Key Vault
az keyvault create --name myKeyVault --resource-group myRG --location eastus

# Add secret
az keyvault secret set --vault-name myKeyVault --name "DbPassword" --value "SecretValue123"

# Get secret
az keyvault secret show --vault-name myKeyVault --name "DbPassword" --query value -o tsv

# Enable soft delete and purge protection
az keyvault update --name myKeyVault --enable-soft-delete true --enable-purge-protection true

Data Classification​

ClassificationDescriptionControls
PublicNo business impact if disclosedBasic access control
InternalInternal use onlyAuthentication required
ConfidentialBusiness sensitiveEncryption, audit logging
Highly ConfidentialSevere impact if disclosedEncryption, MFA, DLP, monitoring

Application Security​

Secure Development Practices​

PracticeDescriptionTools
SASTStatic code analysisSonarQube, CodeQL, Checkmarx
DASTDynamic application testingOWASP ZAP, Burp Suite
SCADependency scanningDependabot, Snyk, WhiteSource
Secret ScanningDetect leaked secretsGitHub Secret Scanning, GitLeaks
Container ScanningImage vulnerability scanningTrivy, Aqua, Defender for Containers

OWASP Top 10 Mitigations​

VulnerabilityMitigationAzure Service
InjectionParameterized queries, input validationWAF, API Management
Broken AuthMFA, session managementEntra ID, B2C
Sensitive DataEncryption, maskingKey Vault, Always Encrypted
XXEDisable external entitiesWAF rules
Broken AccessRBAC, authorization checksEntra ID, custom middleware
MisconfigurationSecurity baselines, scanningDefender for Cloud
XSSOutput encoding, CSPWAF, CDN headers
DeserializationInput validation, type checkingCustom code
ComponentsDependency scanning, updatesDependabot, Defender
LoggingCentralized logging, monitoringLog Analytics, Sentinel

Web Application Firewall (WAF)​

// Bicep - Application Gateway with WAF
resource appGateway 'Microsoft.Network/applicationGateways@2023-05-01' = {
name: 'appgw-waf'
location: location
properties: {
sku: {
name: 'WAF_v2'
tier: 'WAF_v2'
}
webApplicationFirewallConfiguration: {
enabled: true
firewallMode: 'Prevention'
ruleSetType: 'OWASP'
ruleSetVersion: '3.2'
disabledRuleGroups: []
requestBodyCheck: true
maxRequestBodySizeInKb: 128
}
// ... other configuration
}
}

Security Operations​

Microsoft Defender for Cloud​

Security Monitoring Stack​

ServicePurposeData Type
Defender for CloudPosture management, threat protectionSecurity findings
Microsoft SentinelSIEM and SOARSecurity events, incidents
Log AnalyticsLog aggregation and analysisAll logs
Azure MonitorMetrics and alertsPerformance, availability

Security Alerts and Response​

// KQL - Query security alerts in Log Analytics
SecurityAlert
| where TimeGenerated > ago(24h)
| where AlertSeverity == "High"
| summarize Count = count() by AlertName, ProviderName
| order by Count desc

// Query failed sign-ins
SigninLogs
| where TimeGenerated > ago(1h)
| where ResultType != 0
| summarize FailedAttempts = count() by UserPrincipalName, IPAddress
| where FailedAttempts > 5
| order by FailedAttempts desc

Governance and Compliance​

Azure Policy for Security​

// Azure Policy - Require HTTPS for Storage
{
"mode": "All",
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Storage/storageAccounts"
},
{
"field": "Microsoft.Storage/storageAccounts/supportsHttpsTrafficOnly",
"notEquals": true
}
]
},
"then": {
"effect": "deny"
}
}
}

Compliance Frameworks​

FrameworkDescriptionAzure Support
SOC 2Service organization controlsCompliance Manager
ISO 27001Information security managementBuilt-in policies
PCI DSSPayment card industryRegulatory compliance
HIPAAHealthcare data protectionBAA available
GDPREU data protectionData residency, DPAs
FedRAMPUS government cloudAzure Government

Security Checklist​

Identity & Access​

  • Enable MFA for all users
  • Implement Conditional Access policies
  • Use Privileged Identity Management for admin roles
  • Review and remove unused permissions
  • Use managed identities for Azure resources

Network Security​

  • Implement network segmentation
  • Use Private Endpoints for PaaS services
  • Configure NSGs with deny-by-default
  • Enable DDoS Protection for public endpoints
  • Deploy Web Application Firewall

Data Protection​

  • Enable encryption at rest for all data stores
  • Enforce TLS 1.2+ for all connections
  • Store secrets in Key Vault
  • Implement data classification
  • Configure backup and retention policies

Security Operations​

  • Enable Defender for Cloud
  • Configure security alerts and notifications
  • Implement centralized logging
  • Create incident response procedures
  • Conduct regular security assessments

Assessment Questions​

AreaQuestion
IdentityIs MFA enforced for all users?
AccessDo you follow least privilege principles?
NetworkAre PaaS services accessed via private endpoints?
DataIs all sensitive data encrypted?
SecretsAre secrets stored in Key Vault?
MonitoringDo you have security monitoring in place?
ComplianceWhat compliance frameworks apply?
Incident ResponseDo you have an IR plan?

Key Takeaways​

  1. Zero Trust: Verify every request, regardless of source
  2. Defense in Depth: Multiple layers prevent single points of failure
  3. Least Privilege: Grant minimum necessary permissions
  4. Encrypt Everything: Data at rest, in transit, and in use
  5. Monitor Continuously: Detect and respond to threats quickly

Resources​